23 #include "allheaders.h"
31 int scale,
int scaled_yres,
32 int rect_left,
int rect_top,
33 int rect_width,
int rect_height)
35 rect_left, rect_top, rect_width, rect_height),
36 line_separator_(
"\n"),
37 paragraph_separator_(
"\n") {
76 int length = text.
length() + 1;
77 char* result =
new char[length];
78 strncpy(result, text.
string(), length);
96 float mean_certainty = 0.0f;
97 int certainty_count = 0;
106 mean_certainty += best_choice->
certainty();
115 mean_certainty += best_choice->
certainty();
125 mean_certainty += best_choice->
certainty();
131 mean_certainty += best_choice->
certainty();
135 BLOB_CHOICE_LIST_CLIST* choices = best_choice->
blob_choices();
136 if (choices !=
NULL) {
137 BLOB_CHOICE_LIST_C_IT blob_choices_it(choices);
139 blob_choices_it.forward();
140 BLOB_CHOICE_IT choice_it(blob_choices_it.data());
141 for (choice_it.mark_cycle_pt();
142 !choice_it.cycled_list();
143 choice_it.forward()) {
144 if (choice_it.data()->unichar_id() ==
148 mean_certainty += choice_it.data()->certainty();
150 mean_certainty += best_choice->
certainty();
154 if (certainty_count > 0) {
155 mean_certainty /= certainty_count;
156 float confidence = 100 + 5 * mean_certainty;
157 if (confidence < 0.0
f) confidence = 0.0f;
158 if (confidence > 100.0
f) confidence = 100.0f;
179 int* font_id)
const {
187 *is_bold = font_info.
is_bold();
189 *is_underlined =
false;
200 return font_info.
name;
214 if (has_rtl && !has_ltr)
216 if (has_ltr && !has_rtl)
218 if (!has_ltr && !has_rtl)
227 return permuter == SYSTEM_DAWG_PERM || permuter == FREQ_DAWG_PERM ||
228 permuter == USER_DAWG_PERM;
235 return permuter == NUMBER_PERM;
275 for (
int i = 0; i < truth_vec.
size(); ++i) truth_text += truth_vec[i];
276 int length = truth_text.
length() + 1;
277 char* result =
new char[length];
278 strncpy(result, truth_text.
string(), length);
320 word_res_ = result_it.
it_->
word();
323 BLOB_CHOICE_LIST_CLIST* choices = best_choice->
blob_choices();
324 if (choices !=
NULL) {
325 BLOB_CHOICE_LIST_C_IT blob_choices_it(choices);
326 for (
int blob = 0; blob < result_it.
blob_index_; ++blob)
327 blob_choices_it.forward();
328 choice_it_ =
new BLOB_CHOICE_IT(blob_choices_it.data());
329 choice_it_->mark_cycle_pt();
342 if (choice_it_ ==
NULL)
344 choice_it_->forward();
345 return !choice_it_->cycled_list();
351 if (choice_it_ ==
NULL)
353 UNICHAR_ID id = choice_it_->data()->unichar_id();
360 if (choice_it_ ==
NULL)
362 float confidence = 100 + 5 * choice_it_->data()->certainty();
363 if (confidence < 0.0
f) confidence = 0.0f;
364 if (confidence > 100.0
f) confidence = 100.0f;
void truncate_at(inT32 index)
void * GetParamsTrainingBundle() const
BLOCK_RES * prev_block() const
char * GetUTF8Text(PageIteratorLevel level) const
const STRING & unichar_string() const
ChoiceIterator(const LTRResultIterator &result_it)
const char *const id_to_unichar_ext(UNICHAR_ID id) const
const char * line_separator_
IncorrectResultReason incorrect_result_reason
LTRResultIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
BLOB_CHOICE_LIST_CLIST * blob_choices()
const FontInfo * fontinfo
tesseract::Tesseract * tesseract
float Confidence(PageIteratorLevel level) const
const char *const BestUTF8(int blob_index, bool in_rtl_context) const
bool WordIsFromDictionary() const
bool WordIsNumeric() const
const char * GetUTF8Text() const
bool SymbolIsSuperscript() const
bool SymbolIsDropcap() const
virtual ~LTRResultIterator()
bool is_fixed_pitch() const
BLOCK_RES * block() const
char * WordTruthUTF8Text() const
const UNICHARSET * uch_set
void SetLineSeparator(const char *new_line)
GenericVector< STRING > truth_text
const char * string() const
tesseract::ParamsTrainingBundle params_training_bundle
void SetParagraphSeparator(const char *new_para)
const char * GetBlamerMisadaptionDebug() const
bool SymbolIsSubscript() const
ScriptPos BlobPosition(int index) const
ROW_RES * prev_row() const
bool AnyLtrCharsInWord() const
StrongScriptDirection WordDirection() const
const char * WordFontAttributes(bool *is_bold, bool *is_italic, bool *is_underlined, bool *is_monospace, bool *is_serif, bool *is_smallcaps, int *pointsize, int *font_id) const
bool HasBlamerInfo() const
bool AnyRtlCharsInWord() const
tesseract::BoxWord * box_word
const char * WordRecognitionLanguage() const
const char * WordLattice(int *lattice_size) const
const char * GetBlamerDebug() const
const char * paragraph_separator_
const UNICHAR_ID unichar_id(int index) const
BlamerBundle * blamer_bundle
WERD_CHOICE * best_choice