22 #ifndef TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_ 23 #define TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_ 73 : context(c), context_unichar_step_len(l), pruned(p), ngram_cost(nc),
74 ngram_and_classifier_cost(ncc) {}
97 LanguageModelFlagsType tcf,
100 const char *debug_uch)
101 : cost(c), curr_b(b), parent_vse(pe), competing_vse(
NULL),
102 ratings_sum(b->rating()),
103 min_certainty(b->certainty()), adapted(b->IsAdapted()), length(1),
104 outline_length(ol), consistency_info(ci), associate_stats(as),
105 top_choice_flags(tcf), dawg_info(d), ngram_info(n),
118 if (debug_str !=
NULL && debug_uch !=
NULL) *debug_str += debug_uch;
127 static int Compare(
const void *e1,
const void *e2) {
132 return (ve1->
cost < ve2->
cost) ? -1 : 1;
135 if (dawg_info !=
NULL && consistency_info.NumInconsistentCase() == 0) {
138 return consistency_info.Consistent();
143 if (curr_b ==
NULL)
return false;
150 void Print(
const char *msg)
const;
196 viterbi_state_entries_prunable_length(0),
197 viterbi_state_entries_prunable_max_cost(
MAX_FLOAT32),
198 viterbi_state_entries_length(0) {}
204 void Print(
const char *msg);
218 : updated(false), best_vse(
NULL) {
219 beam.reserve(matrix_dimension);
220 for (
int i = 0; i < matrix_dimension; ++i)
239 #endif // TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
ViterbiStateEntry_LIST viterbi_state_entries
ViterbiStateEntry * best_vse
float ngram_and_classifier_cost
LanguageModelDawgInfo * dawg_info
LanguageModelFlagsType top_choice_flags
AssociateStats associate_stats
DawgPositionVector * active_dawgs
ViterbiStateEntry * competing_vse
static int Compare(const void *e1, const void *e2)
int context_unichar_step_len
float viterbi_state_entries_prunable_max_cost
int viterbi_state_entries_length
LanguageModelDawgInfo(DawgPositionVector *a, PermuterType pt)
bool get_isalpha(UNICHAR_ID unichar_id) const
LanguageModelNgramInfo * ngram_info
ViterbiStateEntry * parent_vse
PointerVector< LanguageModelState > beam
bool get_isdigit(UNICHAR_ID unichar_id) const
bool HasAlnumChoice(const UNICHARSET &unicharset)
unsigned char LanguageModelFlagsType
BestChoiceBundle(int matrix_dimension)
int viterbi_state_entries_prunable_length
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)
LanguageModelNgramInfo(const char *c, int l, bool p, float nc, float ncc)
LMConsistencyInfo consistency_info