Go to the documentation of this file.
22 #include "allheaders.h"
30 int scale,
int scaled_yres,
int rect_left,
31 int rect_top,
int rect_width,
34 rect_width, rect_height),
35 line_separator_(
"\n"),
36 paragraph_separator_(
"\n") {}
46 if (
it_->
word() ==
nullptr)
return nullptr;
76 int length = text.
length() + 1;
77 char* result =
new char[length];
78 strncpy(result, text.
string(), length);
95 if (
it_->
word() ==
nullptr)
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 {
165 bool* is_bold,
bool* is_italic,
bool* is_underlined,
bool* is_monospace,
166 bool* is_serif,
bool* is_smallcaps,
int* pointsize,
int* font_id)
const {
167 const char* result =
nullptr;
182 #ifndef DISABLED_LEGACY_ENGINE
187 *is_bold = font_info->
is_bold();
189 *is_underlined =
false;
192 result = font_info->
name;
194 #endif // ndef DISABLED_LEGACY_ENGINE
202 *is_underlined =
false;
203 *is_monospace =
false;
205 *is_smallcaps =
false;
232 if (
it_->
word() ==
nullptr)
return false;
240 if (
it_->
word() ==
nullptr)
return 1;
246 if (
it_->
word() ==
nullptr)
return false;
257 #ifndef DISABLED_LEGACY_ENGINE
265 #endif // ndef DISABLED_LEGACY_ENGINE
281 if (
it_->
word() ==
nullptr)
return false;
303 int length = truth_text.
length() + 1;
304 char* result =
new char[length];
305 strncpy(result, truth_text.
string(), length);
312 if (
it_->
word() ==
nullptr)
return nullptr;
317 for (
int i = 0; i < best_choice->
length(); ++i) {
320 int length = ocr_text.
length() + 1;
321 char* result =
new char[length];
322 strncpy(result, ocr_text.
string(), length);
329 if (
it_->
word() ==
nullptr)
return nullptr;
365 word_res_ = result_it.
it_->
word();
366 BLOB_CHOICE_LIST* choices =
nullptr;
367 if (word_res_->
ratings !=
nullptr)
369 if (choices !=
nullptr && !choices->empty()) {
370 choice_it_ =
new BLOB_CHOICE_IT(choices);
371 choice_it_->mark_cycle_pt();
373 choice_it_ =
nullptr;
381 if (choice_it_ ==
nullptr)
return false;
382 choice_it_->forward();
383 return !choice_it_->cycled_list();
389 if (choice_it_ ==
nullptr)
return nullptr;
390 UNICHAR_ID id = choice_it_->data()->unichar_id();
401 if (choice_it_ ==
nullptr)
return 0.0f;
402 float confidence = 100 + 5 * choice_it_->data()->certainty();
403 if (confidence < 0.0f) confidence = 0.0f;
404 if (confidence > 100.0f) confidence = 100.0f;
bool WordIsFromDictionary() const
constexpr int kPointsPerInch
const char * string() const
tesseract::ScriptPos BlobPosition(int index) const
tesseract::Tesseract * tesseract
WERD_CHOICE * best_choice
bool SymbolIsSuperscript() const
BlamerBundle * blamer_bundle
const STRING & unichar_string() const
const char * GetBlamerMisadaptionDebug() const
const UNICHARSET * uch_set
bool HasBlamerInfo() const
char * WordTruthUTF8Text() const
char * GetUTF8Text(PageIteratorLevel level) const
const tesseract::ParamsTrainingBundle & params_training_bundle() const
bool SymbolIsSubscript() const
STRING TruthString() const
UNICHAR_ID unichar_id(int index) const
void SetParagraphSeparator(const char *new_para)
void SetLineSeparator(const char *new_line)
bool HasDebugInfo() const
BLOB_CHOICE_LIST * GetBlobChoices(int index) const
bool HasTruthString() const
const char * GetBlamerDebug() const
BLOCK_RES * block() const
bool AnyRtlCharsInWord() const
bool SymbolIsDropcap() const
void RowAttributes(float *row_height, float *descenders, float *ascenders) const
const char * lattice_data() const
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
ROW_RES * prev_row() const
const char * line_separator_
const STRING & debug() const
const char * GetUTF8Text() const
StrongScriptDirection WordDirection() const
char * WordNormedUTF8Text() const
float Confidence(PageIteratorLevel level) const
const STRING & misadaption_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 * paragraph_separator_
bool is_fixed_pitch() const
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
int BlanksBeforeWord() const
~LTRResultIterator() override
BLOCK_RES * prev_block() const
const char * id_to_unichar_ext(UNICHAR_ID id) const
const char * WordLattice(int *lattice_size) const
const char * BestUTF8(int blob_index, bool in_rtl_context) const
const char * WordRecognitionLanguage() const
void truncate_at(int32_t index)
bool WordIsNumeric() const
const FontInfo * fontinfo
bool AnyLtrCharsInWord() 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
ChoiceIterator(const LTRResultIterator &result_it)
const void * GetParamsTrainingBundle() const