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 false;
257 if (
it_->
word() == NULL)
return false;
279 int length = truth_text.
length() + 1;
280 char* result =
new char[length];
281 strncpy(result, truth_text.
string(), length);
288 if (
it_->
word() == NULL)
return NULL;
293 for (
int i = 0; i < best_choice->
length(); ++i) {
296 int length = ocr_text.
length() + 1;
297 char* result =
new char[length];
298 strncpy(result, ocr_text.
string(), length);
305 if (
it_->
word() == NULL)
return NULL;
341 word_res_ = result_it.
it_->
word();
342 BLOB_CHOICE_LIST* choices = NULL;
343 if (word_res_->ratings != NULL)
345 if (choices != NULL && !choices->empty()) {
346 choice_it_ =
new BLOB_CHOICE_IT(choices);
347 choice_it_->mark_cycle_pt();
360 if (choice_it_ == NULL)
362 choice_it_->forward();
363 return !choice_it_->cycled_list();
369 if (choice_it_ == NULL)
371 UNICHAR_ID id = choice_it_->data()->unichar_id();
378 if (choice_it_ == NULL)
380 float confidence = 100 + 5 * choice_it_->data()->certainty();
381 if (confidence < 0.0f) confidence = 0.0f;
382 if (confidence > 100.0f) confidence = 100.0f;
const STRING & misadaption_debug() const
void RowAttributes(float *row_height, float *descenders, float *ascenders) const
BLOCK_RES * prev_block() const
const STRING & unichar_string() const
UNICHAR_ID unichar_id(int index) const
bool HasTruthString() const
STRING TruthString() const
bool HasDebugInfo() const
char * WordNormedUTF8Text() const
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
tesseract::ScriptPos BlobPosition(int index) const
char * WordTruthUTF8Text() const
float Confidence(PageIteratorLevel level) const
StrongScriptDirection WordDirection() const
const char * BestUTF8(int blob_index, bool in_rtl_context) const
const char * lattice_data() const
const STRING & debug() 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 char * id_to_unichar_ext(UNICHAR_ID id) const
const char * GetBlamerDebug() const
WERD_CHOICE * best_choice
const char * GetUTF8Text() const
bool SymbolIsSuperscript() const
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
void truncate_at(inT32 index)
const char * string() const
const char * paragraph_separator_
const FontInfo * fontinfo
bool AnyLtrCharsInWord() const
void SetLineSeparator(const char *new_line)
bool is_fixed_pitch() const
bool AnyRtlCharsInWord() const
bool WordIsNumeric() const
BlamerBundle * blamer_bundle
const char * line_separator_
ChoiceIterator(const LTRResultIterator &result_it)
ROW_RES * prev_row() const
BLOB_CHOICE_LIST * GetBlobChoices(int index) const
BLOCK_RES * block() const
char * GetUTF8Text(PageIteratorLevel level) const
const UNICHARSET * uch_set
const char * GetBlamerMisadaptionDebug() const
void SetParagraphSeparator(const char *new_para)
tesseract::Tesseract * tesseract
bool EquivalentToTruth(const char *str) const
bool WordIsFromDictionary() const
bool SymbolIsDropcap() const
bool SymbolIsSubscript() const
const char * WordRecognitionLanguage() const
const char * WordLattice(int *lattice_size) const
const void * GetParamsTrainingBundle() const
const tesseract::ParamsTrainingBundle & params_training_bundle() const
virtual ~LTRResultIterator()
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