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();
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;
163 int* font_id)
const {
171 *is_bold = font_info.
is_bold();
173 *is_underlined =
false;
184 return font_info.
name;
198 if (has_rtl && !has_ltr)
200 if (has_ltr && !has_rtl)
202 if (!has_ltr && !has_rtl)
271 int length = truth_text.
length() + 1;
272 char* result =
new char[length];
273 strncpy(result, truth_text.
string(), length);
285 for (
int i = 0; i < best_choice->
length(); ++i) {
288 int length = ocr_text.
length() + 1;
289 char* result =
new char[length];
290 strncpy(result, ocr_text.
string(), length);
333 word_res_ = result_it.
it_->
word();
334 BLOB_CHOICE_LIST* choices =
NULL;
335 if (word_res_->ratings !=
NULL)
336 choices = word_res_->GetBlobChoices(result_it.
blob_index_);
337 if (choices !=
NULL && !choices->empty()) {
338 choice_it_ =
new BLOB_CHOICE_IT(choices);
339 choice_it_->mark_cycle_pt();
352 if (choice_it_ ==
NULL)
354 choice_it_->forward();
355 return !choice_it_->cycled_list();
361 if (choice_it_ ==
NULL)
363 UNICHAR_ID id = choice_it_->data()->unichar_id();
370 if (choice_it_ ==
NULL)
372 float confidence = 100 + 5 * choice_it_->data()->certainty();
373 if (confidence < 0.0f) confidence = 0.0f;
374 if (confidence > 100.0f) confidence = 100.0f;
tesseract::ScriptPos BlobPosition(int index) const
void SetParagraphSeparator(const char *new_para)
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 ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
bool WordIsNumeric() const
virtual ~LTRResultIterator()
WERD_CHOICE * best_choice
const char * WordLattice(int *lattice_size) const
const char * GetBlamerDebug() const
const char * WordRecognitionLanguage() const
BLOCK_RES * prev_block() const
const FontInfo * fontinfo
const char * lattice_data() const
bool AnyRtlCharsInWord() const
const void * GetParamsTrainingBundle() const
const STRING & unichar_string() const
void SetLineSeparator(const char *new_line)
BLOCK_RES * block() const
StrongScriptDirection WordDirection() const
bool HasDebugInfo() const
STRING TruthString() const
const UNICHAR_ID unichar_id(int index) const
void truncate_at(inT32 index)
const UNICHARSET * uch_set
bool is_fixed_pitch() const
bool EquivalentToTruth(const char *str) const
bool HasTruthString() const
const char * paragraph_separator_
const char * line_separator_
tesseract::Tesseract * tesseract
char * WordNormedUTF8Text() const
const STRING & misadaption_debug() const
const char * GetUTF8Text() const
bool SymbolIsSuperscript() 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)
const tesseract::ParamsTrainingBundle & params_training_bundle() const
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
bool WordIsFromDictionary() const
bool AnyLtrCharsInWord() const
float Confidence(PageIteratorLevel level) const
ChoiceIterator(const LTRResultIterator &result_it)
char * GetUTF8Text(PageIteratorLevel level) const
bool SymbolIsSubscript() const
const char *const id_to_unichar_ext(UNICHAR_ID id) const
bool SymbolIsDropcap() const
char * WordTruthUTF8Text() const
const char * GetBlamerMisadaptionDebug() const
const char * string() const
ROW_RES * prev_row() const
const char *const BestUTF8(int blob_index, bool in_rtl_context) const
BlamerBundle * blamer_bundle
const STRING & debug() const