tesseract  5.0.0-alpha-619-ge9db
ltrresultiterator.cpp
Go to the documentation of this file.
1 // File: ltrresultiterator.cpp
3 // Description: Iterator for tesseract results in strict left-to-right
4 // order that avoids using tesseract internal data structures.
5 // Author: Ray Smith
6 //
7 // (C) Copyright 2010, Google Inc.
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 //
19 
21 
22 #include "allheaders.h"
23 #include "pageres.h"
24 #include <tesseract/strngs.h>
25 #include "tesseractclass.h"
26 
27 namespace tesseract {
28 
30  int scale, int scaled_yres, int rect_left,
31  int rect_top, int rect_width,
32  int rect_height)
33  : PageIterator(page_res, tesseract, scale, scaled_yres, rect_left, rect_top,
34  rect_width, rect_height),
35  line_separator_("\n"),
36  paragraph_separator_("\n") {}
37 
38 // Destructor.
39 // It is defined here, so the compiler can create a single vtable
40 // instead of weak vtables in every compilation unit.
42 
43 // Returns the null terminated UTF-8 encoded text string for the current
44 // object at the given level. Use delete [] to free after use.
46  if (it_->word() == nullptr)
47  return nullptr; // Already at the end!
48  STRING text;
49  PAGE_RES_IT res_it(*it_);
50  WERD_CHOICE* best_choice = res_it.word()->best_choice;
51  ASSERT_HOST(best_choice != nullptr);
52  if (level == RIL_SYMBOL) {
53  text = res_it.word()->BestUTF8(blob_index_, false);
54  } else if (level == RIL_WORD) {
55  text = best_choice->unichar_string();
56  } else {
57  bool eol = false; // end of line?
58  bool eop = false; // end of paragraph?
59  do { // for each paragraph in a block
60  do { // for each text line in a paragraph
61  do { // for each word in a text line
62  best_choice = res_it.word()->best_choice;
63  ASSERT_HOST(best_choice != nullptr);
64  text += best_choice->unichar_string();
65  text += " ";
66  res_it.forward();
67  eol = res_it.row() != res_it.prev_row();
68  } while (!eol);
69  text.truncate_at(text.length() - 1);
70  text += line_separator_;
71  eop = res_it.block() != res_it.prev_block() ||
72  res_it.row()->row->para() != res_it.prev_row()->row->para();
73  } while (level != RIL_TEXTLINE && !eop);
74  if (eop)
75  text += paragraph_separator_;
76  } while (level == RIL_BLOCK && res_it.block() == res_it.prev_block());
77  }
78  int length = text.length() + 1;
79  char* result = new char[length];
80  strncpy(result, text.c_str(), length);
81  return result;
82 }
83 
84 // Set the string inserted at the end of each text line. "\n" by default.
85 void LTRResultIterator::SetLineSeparator(const char* new_line) {
86  line_separator_ = new_line;
87 }
88 
89 // Set the string inserted at the end of each paragraph. "\n" by default.
90 void LTRResultIterator::SetParagraphSeparator(const char* new_para) {
91  paragraph_separator_ = new_para;
92 }
93 
94 // Returns the mean confidence of the current object at the given level.
95 // The number should be interpreted as a percent probability. (0.0f-100.0f)
97  if (it_->word() == nullptr)
98  return 0.0f; // Already at the end!
99  float mean_certainty = 0.0f;
100  int certainty_count = 0;
101  PAGE_RES_IT res_it(*it_);
102  WERD_CHOICE* best_choice = res_it.word()->best_choice;
103  ASSERT_HOST(best_choice != nullptr);
104  switch (level) {
105  case RIL_BLOCK:
106  do {
107  best_choice = res_it.word()->best_choice;
108  ASSERT_HOST(best_choice != nullptr);
109  mean_certainty += best_choice->certainty();
110  ++certainty_count;
111  res_it.forward();
112  } while (res_it.block() == res_it.prev_block());
113  break;
114  case RIL_PARA:
115  do {
116  best_choice = res_it.word()->best_choice;
117  ASSERT_HOST(best_choice != nullptr);
118  mean_certainty += best_choice->certainty();
119  ++certainty_count;
120  res_it.forward();
121  } while (res_it.block() == res_it.prev_block() &&
122  res_it.row()->row->para() == res_it.prev_row()->row->para());
123  break;
124  case RIL_TEXTLINE:
125  do {
126  best_choice = res_it.word()->best_choice;
127  ASSERT_HOST(best_choice != nullptr);
128  mean_certainty += best_choice->certainty();
129  ++certainty_count;
130  res_it.forward();
131  } while (res_it.row() == res_it.prev_row());
132  break;
133  case RIL_WORD:
134  mean_certainty += best_choice->certainty();
135  ++certainty_count;
136  break;
137  case RIL_SYMBOL:
138  mean_certainty += best_choice->certainty(blob_index_);
139  ++certainty_count;
140  }
141  if (certainty_count > 0) {
142  mean_certainty /= certainty_count;
143  return ClipToRange(100 + 5 * mean_certainty, 0.0f, 100.0f);
144  }
145  return 0.0f;
146 }
147 
148 void LTRResultIterator::RowAttributes(float* row_height, float* descenders,
149  float* ascenders) const {
150  *row_height = it_->row()->row->x_height() + it_->row()->row->ascenders() -
151  it_->row()->row->descenders();
152  *descenders = it_->row()->row->descenders();
153  *ascenders = it_->row()->row->ascenders();
154 }
155 
156 // Returns the font attributes of the current word. If iterating at a higher
157 // level object than words, eg textlines, then this will return the
158 // attributes of the first word in that textline.
159 // The actual return value is a string representing a font name. It points
160 // to an internal table and SHOULD NOT BE DELETED. Lifespan is the same as
161 // the iterator itself, ie rendered invalid by various members of
162 // TessBaseAPI, including Init, SetImage, End or deleting the TessBaseAPI.
163 // Pointsize is returned in printers points (1/72 inch.)
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;
168 
169  if (it_->word() == nullptr) {
170  // Already at the end!
171  *pointsize = 0;
172  } else {
173  float row_height = it_->row()->row->x_height() +
174  it_->row()->row->ascenders() -
175  it_->row()->row->descenders();
176  // Convert from pixels to printers points.
177  *pointsize =
178  scaled_yres_ > 0
179  ? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
180  : 0;
181 
182  #ifndef DISABLED_LEGACY_ENGINE
183  const FontInfo* font_info = it_->word()->fontinfo;
184  if (font_info) {
185  // Font information available.
186  *font_id = font_info->universal_id;
187  *is_bold = font_info->is_bold();
188  *is_italic = font_info->is_italic();
189  *is_underlined = false; // TODO(rays) fix this!
190  *is_monospace = font_info->is_fixed_pitch();
191  *is_serif = font_info->is_serif();
192  result = font_info->name;
193  }
194  #endif // ndef DISABLED_LEGACY_ENGINE
195 
196  *is_smallcaps = it_->word()->small_caps;
197  }
198 
199  if (!result) {
200  *is_bold = false;
201  *is_italic = false;
202  *is_underlined = false;
203  *is_monospace = false;
204  *is_serif = false;
205  *is_smallcaps = false;
206  *font_id = -1;
207  }
208 
209  return result;
210 }
211 
212 // Returns the name of the language used to recognize this word.
214  if (it_->word() == nullptr || it_->word()->tesseract == nullptr)
215  return nullptr;
216  return it_->word()->tesseract->lang.c_str();
217 }
218 
219 // Return the overall directionality of this word.
221  if (it_->word() == nullptr)
222  return DIR_NEUTRAL;
223  bool has_rtl = it_->word()->AnyRtlCharsInWord();
224  bool has_ltr = it_->word()->AnyLtrCharsInWord();
225  if (has_rtl && !has_ltr)
226  return DIR_RIGHT_TO_LEFT;
227  if (has_ltr && !has_rtl)
228  return DIR_LEFT_TO_RIGHT;
229  if (!has_ltr && !has_rtl)
230  return DIR_NEUTRAL;
231  return DIR_MIX;
232 }
233 
234 // Returns true if the current word was found in a dictionary.
236  if (it_->word() == nullptr)
237  return false; // Already at the end!
238  int permuter = it_->word()->best_choice->permuter();
239  return permuter == SYSTEM_DAWG_PERM || permuter == FREQ_DAWG_PERM ||
240  permuter == USER_DAWG_PERM;
241 }
242 
243 // Returns the number of blanks before the current word.
245  if (it_->word() == nullptr)
246  return 1;
247  return it_->word()->word->space();
248 }
249 
250 // Returns true if the current word is numeric.
252  if (it_->word() == nullptr)
253  return false; // Already at the end!
254  int permuter = it_->word()->best_choice->permuter();
255  return permuter == NUMBER_PERM;
256 }
257 
258 // Returns true if the word contains blamer information.
260  return it_->word() != nullptr && it_->word()->blamer_bundle != nullptr &&
262 }
263 
264 #ifndef DISABLED_LEGACY_ENGINE
265 // Returns the pointer to ParamsTrainingBundle stored in the BlamerBundle
266 // of the current word.
268  return (it_->word() != nullptr && it_->word()->blamer_bundle != nullptr)
270  : nullptr;
271 }
272 #endif // ndef DISABLED_LEGACY_ENGINE
273 
274 // Returns the pointer to the string with blamer information for this word.
275 // Assumes that the word's blamer_bundle is not nullptr.
277  return it_->word()->blamer_bundle->debug().c_str();
278 }
279 
280 // Returns the pointer to the string with misadaption information for this word.
281 // Assumes that the word's blamer_bundle is not nullptr.
283  return it_->word()->blamer_bundle->misadaption_debug().c_str();
284 }
285 
286 // Returns true if a truth string was recorded for the current word.
288  if (it_->word() == nullptr)
289  return false; // Already at the end!
290  if (it_->word()->blamer_bundle == nullptr ||
291  it_->word()->blamer_bundle->NoTruth()) {
292  return false; // no truth information for this word
293  }
294  return true;
295 }
296 
297 // Returns true if the given string is equivalent to the truth string for
298 // the current word.
299 bool LTRResultIterator::EquivalentToTruth(const char* str) const {
300  if (!HasTruthString())
301  return false;
302  ASSERT_HOST(it_->word()->uch_set != nullptr);
303  WERD_CHOICE str_wd(str, *(it_->word()->uch_set));
304  return it_->word()->blamer_bundle->ChoiceIsCorrect(&str_wd);
305 }
306 
307 // Returns the null terminated UTF-8 encoded truth string for the current word.
308 // Use delete [] to free after use.
310  if (!HasTruthString())
311  return nullptr;
312  STRING truth_text = it_->word()->blamer_bundle->TruthString();
313  int length = truth_text.length() + 1;
314  char* result = new char[length];
315  strncpy(result, truth_text.c_str(), length);
316  return result;
317 }
318 
319 // Returns the null terminated UTF-8 encoded normalized OCR string for the
320 // current word. Use delete [] to free after use.
322  if (it_->word() == nullptr)
323  return nullptr; // Already at the end!
324  STRING ocr_text;
325  WERD_CHOICE* best_choice = it_->word()->best_choice;
326  const UNICHARSET* unicharset = it_->word()->uch_set;
327  ASSERT_HOST(best_choice != nullptr);
328  for (int i = 0; i < best_choice->length(); ++i) {
329  ocr_text += unicharset->get_normed_unichar(best_choice->unichar_id(i));
330  }
331  int length = ocr_text.length() + 1;
332  char* result = new char[length];
333  strncpy(result, ocr_text.c_str(), length);
334  return result;
335 }
336 
337 // Returns a pointer to serialized choice lattice.
338 // Fills lattice_size with the number of bytes in lattice data.
339 const char* LTRResultIterator::WordLattice(int* lattice_size) const {
340  if (it_->word() == nullptr)
341  return nullptr; // Already at the end!
342  if (it_->word()->blamer_bundle == nullptr)
343  return nullptr;
344  *lattice_size = it_->word()->blamer_bundle->lattice_size();
345  return it_->word()->blamer_bundle->lattice_data();
346 }
347 
348 // Returns true if the current symbol is a superscript.
349 // If iterating at a higher level object than symbols, eg words, then
350 // this will return the attributes of the first symbol in that word.
352  if (cblob_it_ == nullptr && it_->word() != nullptr)
355  return false;
356 }
357 
358 // Returns true if the current symbol is a subscript.
359 // If iterating at a higher level object than symbols, eg words, then
360 // this will return the attributes of the first symbol in that word.
362  if (cblob_it_ == nullptr && it_->word() != nullptr)
364  return false;
365 }
366 
367 // Returns true if the current symbol is a dropcap.
368 // If iterating at a higher level object than symbols, eg words, then
369 // this will return the attributes of the first symbol in that word.
371  if (cblob_it_ == nullptr && it_->word() != nullptr)
373  return false;
374 }
375 
377  ASSERT_HOST(result_it.it_->word() != nullptr);
378  word_res_ = result_it.it_->word();
379  oemLSTM_ = word_res_->tesseract->AnyLSTMLang();
380  // Is there legacy engine related trained data?
381  bool oemLegacy = word_res_->tesseract->AnyTessLang();
382  // Is lstm_choice_mode activated?
383  bool lstm_choice_mode = word_res_->tesseract->lstm_choice_mode;
384  rating_coefficient_ = word_res_->tesseract->lstm_rating_coefficient;
385  blanks_before_word_ = result_it.BlanksBeforeWord();
386  BLOB_CHOICE_LIST* choices = nullptr;
387  tstep_index_ = &result_it.blob_index_;
388  if (oemLSTM_ && !word_res_->CTC_symbol_choices.empty()) {
389  if (!word_res_->CTC_symbol_choices[0].empty() &&
390  strcmp(word_res_->CTC_symbol_choices[0][0].first, " ")) {
391  blanks_before_word_ = 0;
392  }
393  auto index = *tstep_index_;
394  index += blanks_before_word_;
395  if (index < word_res_->CTC_symbol_choices.size()) {
396  LSTM_choices_ = &word_res_->CTC_symbol_choices[index];
397  filterSpaces();
398  }
399  }
400  if ((oemLegacy || !lstm_choice_mode) && word_res_->ratings != nullptr)
401  choices = word_res_->GetBlobChoices(result_it.blob_index_);
402  if (choices != nullptr && !choices->empty()) {
403  choice_it_ = new BLOB_CHOICE_IT(choices);
404  choice_it_->mark_cycle_pt();
405  } else {
406  choice_it_ = nullptr;
407  }
408  if (LSTM_choices_ != nullptr && !LSTM_choices_->empty()) {
409  LSTM_choice_it_ = LSTM_choices_->begin();
410  }
411 }
413  delete choice_it_;
414 }
415 
416 // Moves to the next choice for the symbol and returns false if there
417 // are none left.
419  if (oemLSTM_ && LSTM_choices_ != nullptr && !LSTM_choices_->empty()) {
420  if (LSTM_choice_it_ != LSTM_choices_->end() &&
421  next(LSTM_choice_it_) == LSTM_choices_->end()) {
422  return false;
423  } else {
424  ++LSTM_choice_it_;
425  return true;
426  }
427  } else {
428  if (choice_it_ == nullptr)
429  return false;
430  choice_it_->forward();
431  return !choice_it_->cycled_list();
432  }
433 }
434 
435 // Returns the null terminated UTF-8 encoded text string for the current
436 // choice. Do NOT use delete [] to free after use.
437 const char* ChoiceIterator::GetUTF8Text() const {
438  if (oemLSTM_ && LSTM_choices_ != nullptr && !LSTM_choices_->empty()) {
439  std::pair<const char*, float> choice = *LSTM_choice_it_;
440  return choice.first;
441  } else {
442  if (choice_it_ == nullptr)
443  return nullptr;
444  UNICHAR_ID id = choice_it_->data()->unichar_id();
445  return word_res_->uch_set->id_to_unichar_ext(id);
446  }
447 }
448 
449 // Returns the confidence of the current choice depending on the used language
450 // data. If only LSTM traineddata is used the value range is 0.0f - 1.0f. All
451 // choices for one symbol should roughly add up to 1.0f.
452 // If only traineddata of the legacy engine is used, the number should be
453 // interpreted as a percent probability. (0.0f-100.0f) In this case
454 // probabilities won't add up to 100. Each one stands on its own.
456  float confidence;
457  if (oemLSTM_ && LSTM_choices_ != nullptr && !LSTM_choices_->empty()) {
458  std::pair<const char*, float> choice = *LSTM_choice_it_;
459  confidence = 100 - rating_coefficient_ * choice.second;
460  } else {
461  if (choice_it_ == nullptr)
462  return 0.0f;
463  confidence = 100 + 5 * choice_it_->data()->certainty();
464  }
465  return ClipToRange(confidence, 0.0f, 100.0f);
466 }
467 
468 // Returns the set of timesteps which belong to the current symbol
469 std::vector<std::vector<std::pair<const char*, float>>>*
471  int offset = *tstep_index_ + blanks_before_word_;
472  if (offset >= word_res_->segmented_timesteps.size() || !oemLSTM_) {
473  return nullptr;
474  }
475  return &word_res_->segmented_timesteps[offset];
476 }
477 
478 void ChoiceIterator::filterSpaces() {
479  if (LSTM_choices_->empty())
480  return;
481  std::vector<std::pair<const char*, float>>::iterator it;
482  for (it = LSTM_choices_->begin(); it != LSTM_choices_->end();) {
483  if (!strcmp(it->first, " ")) {
484  it = LSTM_choices_->erase(it);
485  } else {
486  ++it;
487  }
488  }
489 }
490 } // namespace tesseract.
WERD_CHOICE::unichar_string
const STRING & unichar_string() const
Definition: ratngs.h:529
ClipToRange
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
Definition: helpers.h:106
strngs.h
tesseract::LTRResultIterator::WordLattice
const char * WordLattice(int *lattice_size) const
Definition: ltrresultiterator.cpp:339
BlamerBundle::ChoiceIsCorrect
bool ChoiceIsCorrect(const WERD_CHOICE *word_choice) const
Definition: blamer.cpp:117
BlamerBundle::TruthString
STRING TruthString() const
Definition: blamer.h:115
tesseract::LTRResultIterator::HasTruthString
bool HasTruthString() const
Definition: ltrresultiterator.cpp:287
ROW::para
PARA * para() const
Definition: ocrrow.h:117
PAGE_RES_IT::forward
WERD_RES * forward()
Definition: pageres.h:728
tesseract::RIL_WORD
Definition: publictypes.h:220
pageres.h
tesseract::LTRResultIterator::HasBlamerInfo
bool HasBlamerInfo() const
Definition: ltrresultiterator.cpp:259
kPointsPerInch
constexpr int kPointsPerInch
Definition: publictypes.h:32
ROW::descenders
float descenders() const
Definition: ocrrow.h:84
tesseract::LTRResultIterator::SetParagraphSeparator
void SetParagraphSeparator(const char *new_para)
Definition: ltrresultiterator.cpp:90
WERD_CHOICE::unichar_id
UNICHAR_ID unichar_id(int index) const
Definition: ratngs.h:303
UNICHARSET::id_to_unichar_ext
const char * id_to_unichar_ext(UNICHAR_ID id) const
Definition: unicharset.cpp:298
WERD_CHOICE
Definition: ratngs.h:261
tesseract::PageIterator::it_
PAGE_RES_IT * it_
Definition: pageiterator.h:332
tesseractclass.h
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
SYSTEM_DAWG_PERM
Definition: ratngs.h:239
tesseract::RIL_BLOCK
Definition: publictypes.h:217
WERD_RES::BestUTF8
const char * BestUTF8(int blob_index, bool in_rtl_context) const
Definition: pageres.h:357
PAGE_RES_IT::block
BLOCK_RES * block() const
Definition: pageres.h:754
PAGE_RES_IT::row
ROW_RES * row() const
Definition: pageres.h:751
tesseract::Tesseract
Definition: tesseractclass.h:172
tesseract::LTRResultIterator::WordIsNumeric
bool WordIsNumeric() const
Definition: ltrresultiterator.cpp:251
tesseract::LTRResultIterator::WordTruthUTF8Text
char * WordTruthUTF8Text() const
Definition: ltrresultiterator.cpp:309
tesseract::ChoiceIterator::Timesteps
std::vector< std::vector< std::pair< const char *, float > > > * Timesteps() const
Definition: ltrresultiterator.cpp:470
BlamerBundle::lattice_data
const char * lattice_data() const
Definition: blamer.h:153
tesseract::PageIterator
Definition: pageiterator.h:52
StrongScriptDirection
StrongScriptDirection
Definition: unichar.h:43
tesseract::LTRResultIterator::GetBlamerDebug
const char * GetBlamerDebug() const
Definition: ltrresultiterator.cpp:276
WERD_CHOICE::certainty
float certainty() const
Definition: ratngs.h:318
tesseract::LTRResultIterator::WordDirection
StrongScriptDirection WordDirection() const
Definition: ltrresultiterator.cpp:220
tesseract::FontInfo::is_italic
bool is_italic() const
Definition: fontinfo.h:111
STRING
Definition: strngs.h:45
BlamerBundle::misadaption_debug
const STRING & misadaption_debug() const
Definition: blamer.h:134
ltrresultiterator.h
STRING::truncate_at
void truncate_at(int32_t index)
Definition: strngs.cpp:258
WERD_CHOICE::permuter
uint8_t permuter() const
Definition: ratngs.h:334
WERD_RES::fontinfo
const FontInfo * fontinfo
Definition: pageres.h:303
tesseract::ChoiceIterator::~ChoiceIterator
~ChoiceIterator()
Definition: ltrresultiterator.cpp:412
tesseract::LTRResultIterator::line_separator_
const char * line_separator_
Definition: ltrresultiterator.h:181
PAGE_RES_IT::prev_row
ROW_RES * prev_row() const
Definition: pageres.h:742
tesseract::LTRResultIterator::LTRResultIterator
LTRResultIterator(PAGE_RES *page_res, Tesseract *tesseract, int scale, int scaled_yres, int rect_left, int rect_top, int rect_width, int rect_height)
Definition: ltrresultiterator.cpp:29
WERD_CHOICE::BlobPosition
tesseract::ScriptPos BlobPosition(int index) const
Definition: ratngs.h:310
UNICHARSET::get_normed_unichar
const char * get_normed_unichar(UNICHAR_ID unichar_id) const
Definition: unicharset.h:818
tesseract::LTRResultIterator
Definition: ltrresultiterator.h:47
tesseract::FontInfo::universal_id
int32_t universal_id
Definition: fontinfo.h:123
tesseract::LTRResultIterator::paragraph_separator_
const char * paragraph_separator_
Definition: ltrresultiterator.h:182
WERD_RES::uch_set
const UNICHARSET * uch_set
Definition: pageres.h:197
tesseract::ChoiceIterator::Confidence
float Confidence() const
Definition: ltrresultiterator.cpp:455
DIR_LEFT_TO_RIGHT
Definition: unichar.h:45
WERD_RES::blamer_bundle
BlamerBundle * blamer_bundle
Definition: pageres.h:246
tesseract::RIL_SYMBOL
Definition: publictypes.h:221
tesseract::SP_SUBSCRIPT
Definition: ratngs.h:252
tesseract::LTRResultIterator::~LTRResultIterator
~LTRResultIterator() override
WERD_RES::segmented_timesteps
std::vector< std::vector< std::vector< std::pair< const char *, float > > > > segmented_timesteps
Definition: pageres.h:218
tesseract::LTRResultIterator::WordNormedUTF8Text
char * WordNormedUTF8Text() const
Definition: ltrresultiterator.cpp:321
WERD_RES::AnyLtrCharsInWord
bool AnyLtrCharsInWord() const
Definition: pageres.h:403
tesseract::LTRResultIterator::Confidence
float Confidence(PageIteratorLevel level) const
Definition: ltrresultiterator.cpp:96
ROW::x_height
float x_height() const
Definition: ocrrow.h:63
WERD_RES::best_choice
WERD_CHOICE * best_choice
Definition: pageres.h:235
WERD::space
uint8_t space()
Definition: werd.h:98
BlamerBundle::HasDebugInfo
bool HasDebugInfo() const
Definition: blamer.h:128
STRING::c_str
const char * c_str() const
Definition: strngs.cpp:192
ROW_RES::row
ROW * row
Definition: pageres.h:136
tesseract::LTRResultIterator::SymbolIsSuperscript
bool SymbolIsSuperscript() const
Definition: ltrresultiterator.cpp:351
tesseract::LTRResultIterator::WordIsFromDictionary
bool WordIsFromDictionary() const
Definition: ltrresultiterator.cpp:235
ROW::ascenders
float ascenders() const
Definition: ocrrow.h:81
PAGE_RES_IT::prev_block
BLOCK_RES * prev_block() const
Definition: pageres.h:745
UNICHARSET
Definition: unicharset.h:145
WERD_RES::AnyRtlCharsInWord
bool AnyRtlCharsInWord() const
Definition: pageres.h:387
tesseract::LTRResultIterator::BlanksBeforeWord
int BlanksBeforeWord() const
Definition: ltrresultiterator.cpp:244
tesseract::PageIteratorLevel
PageIteratorLevel
Definition: publictypes.h:216
tesseract::CCUtil::lang
STRING lang
Definition: ccutil.h:55
tesseract::LTRResultIterator::GetParamsTrainingBundle
const void * GetParamsTrainingBundle() const
Definition: ltrresultiterator.cpp:267
tesseract
Definition: baseapi.h:65
PAGE_RES_IT::word
WERD_RES * word() const
Definition: pageres.h:748
tesseract::FontInfo::is_fixed_pitch
bool is_fixed_pitch() const
Definition: fontinfo.h:113
PAGE_RES
Definition: pageres.h:73
tesseract::PageIterator::cblob_it_
C_BLOB_IT * cblob_it_
Definition: pageiterator.h:347
tesseract::ChoiceIterator::GetUTF8Text
const char * GetUTF8Text() const
Definition: ltrresultiterator.cpp:437
tesseract::SP_DROPCAP
Definition: ratngs.h:254
tesseract::FontInfo
Definition: fontinfo.h:62
tesseract::RIL_TEXTLINE
Definition: publictypes.h:219
UNICHAR_ID
int UNICHAR_ID
Definition: unichar.h:36
DIR_NEUTRAL
Definition: unichar.h:44
tesseract::FontInfo::name
char * name
Definition: fontinfo.h:117
PAGE_RES_IT
Definition: pageres.h:668
tesseract::LTRResultIterator::SetLineSeparator
void SetLineSeparator(const char *new_line)
Definition: ltrresultiterator.cpp:85
tesseract::LTRResultIterator::GetBlamerMisadaptionDebug
const char * GetBlamerMisadaptionDebug() const
Definition: ltrresultiterator.cpp:282
STRING::length
int32_t length() const
Definition: strngs.cpp:187
BlamerBundle::debug
const STRING & debug() const
Definition: blamer.h:131
WERD_CHOICE::length
int length() const
Definition: ratngs.h:291
WERD_RES::tesseract
tesseract::Tesseract * tesseract
Definition: pageres.h:274
tesseract::SP_SUPERSCRIPT
Definition: ratngs.h:253
tesseract::LTRResultIterator::SymbolIsDropcap
bool SymbolIsDropcap() const
Definition: ltrresultiterator.cpp:370
tesseract::LTRResultIterator::WordRecognitionLanguage
const char * WordRecognitionLanguage() const
Definition: ltrresultiterator.cpp:213
BlamerBundle::lattice_size
int lattice_size() const
Definition: blamer.h:156
BlamerBundle::params_training_bundle
const tesseract::ParamsTrainingBundle & params_training_bundle() const
Definition: blamer.h:166
tesseract::LTRResultIterator::GetUTF8Text
char * GetUTF8Text(PageIteratorLevel level) const
Definition: ltrresultiterator.cpp:45
DIR_RIGHT_TO_LEFT
Definition: unichar.h:46
tesseract::ChoiceIterator::Next
bool Next()
Definition: ltrresultiterator.cpp:418
tesseract::PageIterator::scaled_yres_
int scaled_yres_
Definition: pageiterator.h:353
BlamerBundle::NoTruth
bool NoTruth() const
Definition: blamer.h:124
DIR_MIX
Definition: unichar.h:47
WERD_RES::word
WERD * word
Definition: pageres.h:180
tesseract::LTRResultIterator::WordFontAttributes
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
Definition: ltrresultiterator.cpp:164
tesseract::LTRResultIterator::EquivalentToTruth
bool EquivalentToTruth(const char *str) const
Definition: ltrresultiterator.cpp:299
tesseract::ChoiceIterator::ChoiceIterator
ChoiceIterator(const LTRResultIterator &result_it)
Definition: ltrresultiterator.cpp:376
tesseract::FontInfo::is_bold
bool is_bold() const
Definition: fontinfo.h:112
FREQ_DAWG_PERM
Definition: ratngs.h:242
tesseract::RIL_PARA
Definition: publictypes.h:218
tesseract::LTRResultIterator::RowAttributes
void RowAttributes(float *row_height, float *descenders, float *ascenders) const
Definition: ltrresultiterator.cpp:148
tesseract::LTRResultIterator::SymbolIsSubscript
bool SymbolIsSubscript() const
Definition: ltrresultiterator.cpp:361
WERD_RES::small_caps
bool small_caps
Definition: pageres.h:300
NUMBER_PERM
Definition: ratngs.h:237
tesseract::FontInfo::is_serif
bool is_serif() const
Definition: fontinfo.h:114
USER_DAWG_PERM
Definition: ratngs.h:241
tesseract::PageIterator::blob_index_
int blob_index_
Definition: pageiterator.h:341