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