22 #ifndef TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
23 #define TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
103 const char *debug_uch)
130 static int Compare(
const void *e1,
const void *e2) {
135 return (ve1->
cost < ve2->
cost) ? -1 : 1;
146 if (
curr_b == NULL)
return false;
153 void Print(
const char *msg)
const;
207 void Print(
const char *msg);
222 beam.reserve(matrix_dimension);
223 for (
int i = 0; i < matrix_dimension; ++i)
242 #endif // TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
ViterbiStateEntry(ViterbiStateEntry *pe, BLOB_CHOICE *b, float c, float ol, const LMConsistencyInfo &ci, const AssociateStats &as, LanguageModelFlagsType tcf, LanguageModelDawgInfo *d, LanguageModelNgramInfo *n, const char *debug_uch)
LMConsistencyInfo consistency_info
int context_unichar_step_len
ViterbiStateEntry_LIST viterbi_state_entries
Storage for the Viterbi state.
ViterbiStateEntry * best_vse
Best ViterbiStateEntry and BLOB_CHOICE.
LanguageModelDawgInfo * dawg_info
LanguageModelFlagsType top_choice_flags
bool updated
Flag to indicate whether anything was changed.
AssociateStats associate_stats
Bundle together all the things pertaining to the best choice/state.
void Clear()
Clears the viterbi search state back to its initial conditions.
BLOB_CHOICE * curr_b
Pointers to BLOB_CHOICE and parent ViterbiStateEntry (not owned by this).
int NumInconsistentCase() const
void Print(const char *msg)
bool get_isdigit(UNICHAR_ID unichar_id) const
bool get_isalpha(UNICHAR_ID unichar_id) const
float viterbi_state_entries_prunable_max_cost
ViterbiStateEntry * parent_vse
int viterbi_state_entries_length
Total number of entries in viterbi_state_entries.
static int Compare(const void *e1, const void *e2)
LanguageModelNgramInfo * ngram_info
float ngram_and_classifier_cost
-[ ln(P_classifier(path)) + scale_factor * ln(P_ngram_model(path)) ]
unsigned char LanguageModelFlagsType
Used for expressing various language model flags.
BestChoiceBundle(int matrix_dimension)
LanguageModelDawgInfo(DawgPositionVector *a, PermuterType pt)
ViterbiStateEntry * competing_vse
int viterbi_state_entries_prunable_length
Number and max cost of prunable paths in viterbi_state_entries.
bool HasAlnumChoice(const UNICHARSET &unicharset)
PointerVector< LanguageModelState > beam
DANGERR fixpt
Places to try to fix the word suggested by ambiguity checking.
DawgPositionVector * active_dawgs
Struct to store information maintained by various language model components.
void Print(const char *msg) const
LanguageModelNgramInfo(const char *c, int l, bool p, float nc, float ncc)
float ngram_cost
-ln(P_ngram_model(path))
UNICHAR_ID unichar_id() const