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") {
48 if (
it_->
word() ==
nullptr)
return nullptr;
78 int length = text.
length() + 1;
79 char* result =
new char[length];
80 strncpy(result, text.
string(), length);
97 if (
it_->
word() ==
nullptr)
return 0.0f;
98 float mean_certainty = 0.0f;
99 int certainty_count = 0;
108 mean_certainty += best_choice->
certainty();
117 mean_certainty += best_choice->
certainty();
127 mean_certainty += best_choice->
certainty();
133 mean_certainty += best_choice->
certainty();
140 if (certainty_count > 0) {
141 mean_certainty /= certainty_count;
142 float confidence = 100 + 5 * mean_certainty;
143 if (confidence < 0.0f) confidence = 0.0f;
144 if (confidence > 100.0f) confidence = 100.0f;
151 float* ascenders)
const {
173 int* font_id)
const {
174 if (
it_->
word() ==
nullptr)
return nullptr;
187 *is_bold = font_info.
is_bold();
189 *is_underlined =
false;
194 return font_info.
name;
208 if (has_rtl && !has_ltr)
210 if (has_ltr && !has_rtl)
212 if (!has_ltr && !has_rtl)
219 if (
it_->
word() ==
nullptr)
return false;
227 if (
it_->
word() ==
nullptr)
return 1;
233 if (
it_->
word() ==
nullptr)
return false;
265 if (
it_->
word() ==
nullptr)
return false;
287 int length = truth_text.
length() + 1;
288 char* result =
new char[length];
289 strncpy(result, truth_text.
string(), length);
296 if (
it_->
word() ==
nullptr)
return nullptr;
301 for (
int i = 0; i < best_choice->
length(); ++i) {
304 int length = ocr_text.
length() + 1;
305 char* result =
new char[length];
306 strncpy(result, ocr_text.
string(), length);
313 if (
it_->
word() ==
nullptr)
return nullptr;
349 word_res_ = result_it.
it_->
word();
350 BLOB_CHOICE_LIST* choices =
nullptr;
351 if (word_res_->ratings !=
nullptr)
353 if (choices !=
nullptr && !choices->empty()) {
354 choice_it_ =
new BLOB_CHOICE_IT(choices);
355 choice_it_->mark_cycle_pt();
357 choice_it_ =
nullptr;
368 if (choice_it_ ==
nullptr)
370 choice_it_->forward();
371 return !choice_it_->cycled_list();
377 if (choice_it_ ==
nullptr)
379 UNICHAR_ID id = choice_it_->data()->unichar_id();
386 if (choice_it_ ==
nullptr)
388 float confidence = 100 + 5 * choice_it_->data()->certainty();
389 if (confidence < 0.0f) confidence = 0.0f;
390 if (confidence > 100.0f) confidence = 100.0f;
BLOCK_RES * block() const
const STRING & debug() const
const char * WordLattice(int *lattice_size) const
const char * GetBlamerMisadaptionDebug() const
const char * paragraph_separator_
bool SymbolIsDropcap() const
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
char * WordTruthUTF8Text() const
const char * lattice_data() const
void RowAttributes(float *row_height, float *descenders, float *ascenders) const
const char * string() const
bool SymbolIsSubscript() const
const char * GetBlamerDebug() const
BLOB_CHOICE_LIST * GetBlobChoices(int index) const
const char * line_separator_
bool AnyRtlCharsInWord() const
constexpr int kPointsPerInch
const FontInfo * fontinfo
void SetLineSeparator(const char *new_line)
const char * WordRecognitionLanguage() const
const tesseract::ParamsTrainingBundle & params_training_bundle() const
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
ChoiceIterator(const LTRResultIterator &result_it)
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
StrongScriptDirection WordDirection() const
ROW_RES * prev_row() const
virtual ~LTRResultIterator()
const void * GetParamsTrainingBundle() const
STRING TruthString() const
char * WordNormedUTF8Text() const
UNICHAR_ID unichar_id(int index) const
void truncate_at(int32_t index)
const char * id_to_unichar_ext(UNICHAR_ID id) const
BLOCK_RES * prev_block() const
bool AnyLtrCharsInWord() const
bool SymbolIsSuperscript() const
const char * BestUTF8(int blob_index, bool in_rtl_context) const
tesseract::Tesseract * tesseract
const STRING & misadaption_debug() const
float Confidence(PageIteratorLevel level) const
const char * GetUTF8Text() const
const UNICHARSET * uch_set
BlamerBundle * blamer_bundle
const STRING & unichar_string() const
bool WordIsNumeric() const
bool EquivalentToTruth(const char *str) const
tesseract::ScriptPos BlobPosition(int index) const
bool is_fixed_pitch() const
bool HasBlamerInfo() 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)
bool HasTruthString() const
bool WordIsFromDictionary() const
void SetParagraphSeparator(const char *new_para)
WERD_CHOICE * best_choice
int BlanksBeforeWord() const
bool HasDebugInfo() const
char * GetUTF8Text(PageIteratorLevel level) const