tesseract
3.03
|
#include <lm_state.h>
Public Member Functions | |
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) | |
~ViterbiStateEntry () | |
bool | Consistent () const |
bool | HasAlnumChoice (const UNICHARSET &unicharset) |
void | Print (const char *msg) const |
Static Public Member Functions | |
static int | Compare (const void *e1, const void *e2) |
Public Attributes | |
float | cost |
BLOB_CHOICE * | curr_b |
ViterbiStateEntry * | parent_vse |
ViterbiStateEntry * | competing_vse |
float | ratings_sum |
float | min_certainty |
int | adapted |
int | length |
float | outline_length |
LMConsistencyInfo | consistency_info |
AssociateStats | associate_stats |
LanguageModelFlagsType | top_choice_flags |
LanguageModelDawgInfo * | dawg_info |
LanguageModelNgramInfo * | ngram_info |
bool | updated |
STRING * | debug_str |
Definition at line 92 of file lm_state.h.
tesseract::ViterbiStateEntry::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 | ||
) | [inline] |
Definition at line 93 of file lm_state.h.
: cost(c), curr_b(b), parent_vse(pe), competing_vse(NULL), ratings_sum(b->rating()), min_certainty(b->certainty()), adapted(b->IsAdapted()), length(1), outline_length(ol), consistency_info(ci), associate_stats(as), top_choice_flags(tcf), dawg_info(d), ngram_info(n), updated(true) { debug_str = (debug_uch == NULL) ? NULL : new STRING(); if (pe != NULL) { ratings_sum += pe->ratings_sum; if (pe->min_certainty < min_certainty) { min_certainty = pe->min_certainty; } adapted += pe->adapted; length += pe->length; outline_length += pe->outline_length; if (debug_uch != NULL) *debug_str += *(pe->debug_str); } if (debug_str != NULL && debug_uch != NULL) *debug_str += debug_uch; }
tesseract::ViterbiStateEntry::~ViterbiStateEntry | ( | ) | [inline] |
Definition at line 120 of file lm_state.h.
{ delete dawg_info; delete ngram_info; delete debug_str; }
static int tesseract::ViterbiStateEntry::Compare | ( | const void * | e1, |
const void * | e2 | ||
) | [inline, static] |
Definition at line 127 of file lm_state.h.
{ const ViterbiStateEntry *ve1 = *reinterpret_cast<const ViterbiStateEntry * const *>(e1); const ViterbiStateEntry *ve2 = *reinterpret_cast<const ViterbiStateEntry * const *>(e2); return (ve1->cost < ve2->cost) ? -1 : 1; }
bool tesseract::ViterbiStateEntry::Consistent | ( | ) | const [inline] |
Definition at line 134 of file lm_state.h.
{ if (dawg_info != NULL && consistency_info.NumInconsistentCase() == 0) { return true; } return consistency_info.Consistent(); }
bool tesseract::ViterbiStateEntry::HasAlnumChoice | ( | const UNICHARSET & | unicharset | ) | [inline] |
Definition at line 142 of file lm_state.h.
{ if (curr_b == NULL) return false; UNICHAR_ID unichar_id = curr_b->unichar_id(); if (unicharset.get_isalpha(unichar_id) || unicharset.get_isdigit(unichar_id)) return true; return false; }
void tesseract::ViterbiStateEntry::Print | ( | const char * | msg | ) | const |
Definition at line 27 of file lm_state.cpp.
{ tprintf("%s ViterbiStateEntry", msg); if (updated) tprintf("(NEW)"); if (this->debug_str != NULL) { tprintf(" str=%s", this->debug_str->string()); } tprintf(" with ratings_sum=%.4f length=%d cost=%.6f", this->ratings_sum, this->length, this->cost); if (this->top_choice_flags) { tprintf(" top_choice_flags=0x%x", this->top_choice_flags); } if (!this->Consistent()) { tprintf(" inconsistent=(punc %d case %d chartype %d script %d font %d)", this->consistency_info.NumInconsistentPunc(), this->consistency_info.NumInconsistentCase(), this->consistency_info.NumInconsistentChartype(), this->consistency_info.inconsistent_script, this->consistency_info.inconsistent_font); } if (this->dawg_info) tprintf(" permuter=%d", this->dawg_info->permuter); if (this->ngram_info) { tprintf(" ngram_cl_cost=%g context=%s ngram pruned=%d", this->ngram_info->ngram_and_classifier_cost, this->ngram_info->context.string(), this->ngram_info->pruned); } if (this->associate_stats.shape_cost > 0.0f) { tprintf(" shape_cost=%g", this->associate_stats.shape_cost); } tprintf(" %s", XHeightConsistencyEnumName[this->consistency_info.xht_decision]); tprintf("\n"); }
Definition at line 167 of file lm_state.h.
Definition at line 171 of file lm_state.h.
Definition at line 161 of file lm_state.h.
Definition at line 170 of file lm_state.h.
Definition at line 154 of file lm_state.h.
Definition at line 157 of file lm_state.h.
Definition at line 179 of file lm_state.h.
Definition at line 188 of file lm_state.h.
Definition at line 168 of file lm_state.h.
Definition at line 166 of file lm_state.h.
Definition at line 183 of file lm_state.h.
Definition at line 169 of file lm_state.h.
Definition at line 158 of file lm_state.h.
Definition at line 165 of file lm_state.h.
Definition at line 175 of file lm_state.h.
Definition at line 185 of file lm_state.h.