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") {
46 if (
it_->
word() == NULL)
return NULL;
76 int length = text.
length() + 1;
77 char* result =
new char[length];
78 strncpy(result, text.
string(), length);
95 if (
it_->
word() == NULL)
return 0.0f;
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();
138 if (certainty_count > 0) {
139 mean_certainty /= certainty_count;
140 float confidence = 100 + 5 * mean_certainty;
141 if (confidence < 0.0f) confidence = 0.0f;
142 if (confidence > 100.0f) confidence = 100.0f;
149 float* ascenders)
const {
171 int* font_id)
const {
172 if (
it_->
word() == NULL)
return NULL;
179 *is_bold = font_info.
is_bold();
181 *is_underlined =
false;
192 return font_info.
name;
206 if (has_rtl && !has_ltr)
208 if (has_ltr && !has_rtl)
210 if (!has_ltr && !has_rtl)
217 if (
it_->
word() == NULL)
return false;
225 if (
it_->
word() == NULL)
return 1;
231 if (
it_->
word() == NULL)
return false;
263 if (
it_->
word() == NULL)
return false;
285 int length = truth_text.
length() + 1;
286 char* result =
new char[length];
287 strncpy(result, truth_text.
string(), length);
294 if (
it_->
word() == NULL)
return NULL;
299 for (
int i = 0; i < best_choice->
length(); ++i) {
302 int length = ocr_text.
length() + 1;
303 char* result =
new char[length];
304 strncpy(result, ocr_text.
string(), length);
311 if (
it_->
word() == NULL)
return NULL;
347 word_res_ = result_it.
it_->
word();
348 BLOB_CHOICE_LIST* choices = NULL;
349 if (word_res_->ratings != NULL)
351 if (choices != NULL && !choices->empty()) {
352 choice_it_ =
new BLOB_CHOICE_IT(choices);
353 choice_it_->mark_cycle_pt();
366 if (choice_it_ == NULL)
368 choice_it_->forward();
369 return !choice_it_->cycled_list();
375 if (choice_it_ == NULL)
377 UNICHAR_ID id = choice_it_->data()->unichar_id();
378 return word_res_->uch_set->id_to_unichar_ext(
id);
384 if (choice_it_ == NULL)
386 float confidence = 100 + 5 * choice_it_->data()->certainty();
387 if (confidence < 0.0f) confidence = 0.0f;
388 if (confidence > 100.0f) confidence = 100.0f;
const char * GetBlamerDebug() 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 EquivalentToTruth(const char *str) const
void truncate_at(inT32 index)
const char * GetBlamerMisadaptionDebug() const
UNICHAR_ID unichar_id(int index) const
const char * lattice_data() const
WERD_CHOICE * best_choice
ROW_RES * prev_row() const
BlamerBundle * blamer_bundle
bool AnyRtlCharsInWord() const
float Confidence(PageIteratorLevel level) const
void SetLineSeparator(const char *new_line)
bool HasBlamerInfo() const
bool WordIsFromDictionary() const
const char * string() const
tesseract::ScriptPos BlobPosition(int index) const
const STRING & misadaption_debug() const
int BlanksBeforeWord() const
const void * GetParamsTrainingBundle() const
tesseract::Tesseract * tesseract
const tesseract::ParamsTrainingBundle & params_training_bundle() const
bool HasTruthString() const
const STRING & debug() const
virtual ~LTRResultIterator()
const FontInfo * fontinfo
void RowAttributes(float *row_height, float *descenders, float *ascenders) const
bool SymbolIsDropcap() const
char * WordTruthUTF8Text() const
StrongScriptDirection WordDirection() const
const char * line_separator_
bool SymbolIsSuperscript() const
LTRResultIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
const STRING & unichar_string() const
void SetParagraphSeparator(const char *new_para)
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
bool HasDebugInfo() const
ChoiceIterator(const LTRResultIterator &result_it)
const char * paragraph_separator_
bool SymbolIsSubscript() const
BLOB_CHOICE_LIST * GetBlobChoices(int index) const
const char * BestUTF8(int blob_index, bool in_rtl_context) const
const char * GetUTF8Text() const
const char * WordLattice(int *lattice_size) const
bool is_fixed_pitch() const
const UNICHARSET * uch_set
BLOCK_RES * prev_block() const
bool AnyLtrCharsInWord() const
STRING TruthString() const
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
const char * WordRecognitionLanguage() const
BLOCK_RES * block() const
char * WordNormedUTF8Text() const
char * GetUTF8Text(PageIteratorLevel level) const
bool WordIsNumeric() const