File size: 1,051 Bytes
1ce325b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#ifndef LM_BUILDER_PAYLOAD_H
#define LM_BUILDER_PAYLOAD_H
#include "../weights.hh"
#include "../word_index.hh"
#include <stdint.h>
namespace lm { namespace builder {
struct Uninterpolated {
float prob; // Uninterpolated probability.
float gamma; // Interpolation weight for lower order.
};
union BuildingPayload {
uint64_t count;
Uninterpolated uninterp;
ProbBackoff complete;
/*mjd**********************************************************************/
bool IsMarked() const {
return count >> (sizeof(count) * 8 - 1);
}
void Mark() {
count |= (1ULL << (sizeof(count) * 8 - 1));
}
void Unmark() {
count &= ~(1ULL << (sizeof(count) * 8 - 1));
}
uint64_t UnmarkedCount() const {
return count & ~(1ULL << (sizeof(count) * 8 - 1));
}
uint64_t CutoffCount() const {
return IsMarked() ? 0 : UnmarkedCount();
}
/*mjd**********************************************************************/
};
const WordIndex kBOS = 1;
const WordIndex kEOS = 2;
}} // namespaces
#endif // LM_BUILDER_PAYLOAD_H
|