tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
20 #ifndef TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
21 #define TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
99 const char *debug_uch)
132 static int Compare(
const void *e1,
const void *e2) {
134 *static_cast<const ViterbiStateEntry *const *>(e1);
136 *static_cast<const ViterbiStateEntry *const *>(e2);
137 return (ve1->
cost < ve2->
cost) ? -1 : 1;
148 if (
curr_b ==
nullptr)
return false;
155 void Print(
const char *msg)
const;
210 void Print(
const char *msg);
225 beam.reserve(matrix_dimension);
226 for (
int i = 0; i < matrix_dimension; ++i)
245 #endif // TESSERACT_WORDREC_LANGUAGE_MODEL_DEFS_H_
LanguageModelFlagsType top_choice_flags
LanguageModelDawgInfo * dawg_info
void Print(const char *msg) const
int length
number of characters on the path
float outline_length
length of the outline so far
bool get_isdigit(UNICHAR_ID unichar_id) const
bool get_isalpha(UNICHAR_ID unichar_id) const
float ngram_cost
-ln(P_ngram_model(path))
ViterbiStateEntry * competing_vse
UNICHAR_ID unichar_id() const
#define ELISTIZEH(CLASSNAME)
ViterbiStateEntry * best_vse
Best ViterbiStateEntry and BLOB_CHOICE.
LanguageModelDawgInfo(const DawgPositionVector *a, PermuterType pt)
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)
PointerVector< LanguageModelState > beam
bool updated
Flag to indicate whether anything was changed.
Bundle together all the things pertaining to the best choice/state.
int viterbi_state_entries_length
Total number of entries in viterbi_state_entries.
LanguageModelNgramInfo * ngram_info
int NumInconsistentCase() const
void Print(const char *msg)
BestChoiceBundle(int matrix_dimension)
AssociateStats associate_stats
character widths/gaps/seams
BLOB_CHOICE * curr_b
Pointers to BLOB_CHOICE and parent ViterbiStateEntry (not owned by this).
unsigned char LanguageModelFlagsType
Used for expressing various language model flags.
LanguageModelNgramInfo(const char *c, int l, bool p, float nc, float ncc)
float viterbi_state_entries_prunable_max_cost
float ngram_and_classifier_cost
-[ ln(P_classifier(path)) + scale_factor * ln(P_ngram_model(path)) ]
Struct to store information maintained by various language model components.
DANGERR fixpt
Places to try to fix the word suggested by ambiguity checking.
LMConsistencyInfo consistency_info
path consistency info
ViterbiStateEntry_LIST viterbi_state_entries
Storage for the Viterbi state.
bool updated
set to true if the entry has just been created/updated
ViterbiStateEntry * parent_vse
void Clear()
Clears the viterbi search state back to its initial conditions.
DawgPositionVector active_dawgs
static int Compare(const void *e1, const void *e2)
bool HasAlnumChoice(const UNICHARSET &unicharset)
int adapted
number of BLOB_CHOICES from adapted templates
float min_certainty
minimum certainty on the path
int context_unichar_step_len
float ratings_sum
sum of ratings of character on the path
int viterbi_state_entries_prunable_length
Number and max cost of prunable paths in viterbi_state_entries.