| #ifndef LM_BUILDER_PAYLOAD_H |
| #define LM_BUILDER_PAYLOAD_H |
|
|
| #include "lm/weights.hh" |
| #include "lm/word_index.hh" |
| #include <stdint.h> |
|
|
| namespace lm { namespace builder { |
|
|
| struct Uninterpolated { |
| float prob; |
| float gamma; |
| }; |
|
|
| union BuildingPayload { |
| uint64_t count; |
| Uninterpolated uninterp; |
| ProbBackoff complete; |
|
|
| |
| bool IsMarked() const { |
| return count >> (sizeof(count) * 8 - 1); |
| } |
|
|
| void Mark() { |
| count |= (1ul << (sizeof(count) * 8 - 1)); |
| } |
|
|
| void Unmark() { |
| count &= ~(1ul << (sizeof(count) * 8 - 1)); |
| } |
|
|
| uint64_t UnmarkedCount() const { |
| return count & ~(1ul << (sizeof(count) * 8 - 1)); |
| } |
|
|
| uint64_t CutoffCount() const { |
| return IsMarked() ? 0 : UnmarkedCount(); |
| } |
| |
| }; |
|
|
| const WordIndex kBOS = 1; |
| const WordIndex kEOS = 2; |
|
|
| }} |
|
|
| #endif |
|
|