00001 #ifndef LM_BUILDER_PAYLOAD_H 00002 #define LM_BUILDER_PAYLOAD_H 00003 00004 #include "lm/weights.hh" 00005 #include "lm/word_index.hh" 00006 #include <stdint.h> 00007 00008 namespace lm { namespace builder { 00009 00010 struct Uninterpolated { 00011 float prob; // Uninterpolated probability. 00012 float gamma; // Interpolation weight for lower order. 00013 }; 00014 00015 union BuildingPayload { 00016 uint64_t count; 00017 Uninterpolated uninterp; 00018 ProbBackoff complete; 00019 00020 /*mjd**********************************************************************/ 00021 bool IsMarked() const { 00022 return count >> (sizeof(count) * 8 - 1); 00023 } 00024 00025 void Mark() { 00026 count |= (1ul << (sizeof(count) * 8 - 1)); 00027 } 00028 00029 void Unmark() { 00030 count &= ~(1ul << (sizeof(count) * 8 - 1)); 00031 } 00032 00033 uint64_t UnmarkedCount() const { 00034 return count & ~(1ul << (sizeof(count) * 8 - 1)); 00035 } 00036 00037 uint64_t CutoffCount() const { 00038 return IsMarked() ? 0 : UnmarkedCount(); 00039 } 00040 /*mjd**********************************************************************/ 00041 }; 00042 00043 const WordIndex kBOS = 1; 00044 const WordIndex kEOS = 2; 00045 00046 }} // namespaces 00047 00048 #endif // LM_BUILDER_PAYLOAD_H