tesseract  5.0.0-alpha-619-ge9db
tesseractclass.h
Go to the documentation of this file.
1 // File: tesseractclass.h
3 // Description: The Tesseract class. It holds/owns everything needed
4 // to run Tesseract on a single language, and also a set of
5 // sub-Tesseracts to run sub-languages. For thread safety, *every*
6 // global variable goes in here, directly, or indirectly.
7 // This makes it safe to run multiple Tesseracts in different
8 // threads in parallel, and keeps the different language
9 // instances separate.
10 // Author: Ray Smith
11 //
12 // (C) Copyright 2008, Google Inc.
13 // Licensed under the Apache License, Version 2.0 (the "License");
14 // you may not use this file except in compliance with the License.
15 // You may obtain a copy of the License at
16 // http://www.apache.org/licenses/LICENSE-2.0
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the License is distributed on an "AS IS" BASIS,
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 // See the License for the specific language governing permissions and
21 // limitations under the License.
22 //
24 
25 #ifndef TESSERACT_CCMAIN_TESSERACTCLASS_H_
26 #define TESSERACT_CCMAIN_TESSERACTCLASS_H_
27 
28 #include <cstdint> // for int16_t, int32_t, uint16_t
29 #include <cstdio> // for FILE
30 #include "allheaders.h" // for pixDestroy, pixGetWidth, pixGetHe...
31 #include "control.h" // for ACCEPTABLE_WERD_TYPE
32 #include "debugpixa.h" // for DebugPixa
33 #include "devanagari_processing.h" // for ShiroRekhaSplitter
34 #ifndef DISABLED_LEGACY_ENGINE
35 #include "docqual.h" // for GARBAGE_LEVEL
36 #endif
37 #include <tesseract/genericvector.h> // for GenericVector, PointerVector
38 #include "pageres.h" // for WERD_RES (ptr only), PAGE_RES (pt...
39 #include "params.h" // for BOOL_VAR_H, BoolParam, DoubleParam
40 #include "points.h" // for FCOORD
41 #include <tesseract/publictypes.h> // for OcrEngineMode, PageSegMode, OEM_L...
42 #include "ratngs.h" // for ScriptPos, WERD_CHOICE (ptr only)
43 #include <tesseract/strngs.h> // for STRING
44 #include "tessdatamanager.h" // for TessdataManager
45 #include "textord.h" // for Textord
46 #include <tesseract/unichar.h> // for UNICHAR_ID
47 #include "wordrec.h" // for Wordrec
48 
49 class BLOCK_LIST;
50 class ETEXT_DESC;
51 struct OSResults;
52 class PAGE_RES;
53 class PAGE_RES_IT;
54 struct Pix;
55 class ROW;
56 class SVMenuNode;
57 class TBOX;
58 class TO_BLOCK_LIST;
59 class WERD;
60 class WERD_CHOICE;
61 class WERD_RES;
62 
63 // Top-level class for all tesseract global instance data.
64 // This class either holds or points to all data used by an instance
65 // of Tesseract, including the memory allocator. When this is
66 // complete, Tesseract will be thread-safe. UNTIL THEN, IT IS NOT!
67 //
68 // NOTE to developers: Do not create cyclic dependencies through this class!
69 // The directory dependency tree must remain a tree! The keep this clean,
70 // lower-level code (eg in ccutil, the bottom level) must never need to
71 // know about the content of a higher-level directory.
72 // The following scheme will grant the easiest access to lower-level
73 // global members without creating a cyclic dependency:
74 //
75 // Class Hierarchy (^ = inheritance):
76 //
77 // CCUtil (ccutil/ccutil.h)
78 // ^ Members include: UNICHARSET
79 // CCStruct (ccstruct/ccstruct.h)
80 // ^ Members include: Image
81 // Classify (classify/classify.h)
82 // ^ Members include: Dict
83 // WordRec (wordrec/wordrec.h)
84 // ^ Members include: WERD*, DENORM*
85 // Tesseract (ccmain/tesseractclass.h)
86 // Members include: Pix*
87 //
88 // Other important classes:
89 //
90 // TessBaseAPI (tesseract/baseapi.h)
91 // Members include: BLOCK_LIST*, PAGE_RES*,
92 // Tesseract*, ImageThresholder*
93 // Dict (dict/dict.h)
94 // Members include: Image* (private)
95 //
96 // NOTE: that each level contains members that correspond to global
97 // data that is defined (and used) at that level, not necessarily where
98 // the type is defined so for instance:
99 // BOOL_VAR_H(textord_show_blobs, false, "Display unsorted blobs");
100 // goes inside the Textord class, not the cc_util class.
101 
102 namespace tesseract {
103 
104 class ColumnFinder;
105 class DocumentData;
106 class EquationDetect;
107 class ImageData;
108 class LSTMRecognizer;
109 class Tesseract;
110 
111 // A collection of various variables for statistics and debugging.
115  doc_blob_quality(0),
116  doc_outline_errs(0),
117  doc_char_quality(0),
118  good_char_count(0),
120  word_count(0),
121  dict_words(0),
122  tilde_crunch_written(false),
123  last_char_was_newline(true),
124  last_char_was_tilde(false),
126 
133  int32_t word_count; // count of word in the document
134  int32_t dict_words; // number of dicitionary words in the document
135  STRING dump_words_str; // accumulator used by dump_words()
136  // Flags used by write_results()
141 };
142 
143 // Struct to hold all the pointers to relevant data for processing a word.
144 struct WordData {
146  : word(nullptr), row(nullptr), block(nullptr), prev_word(nullptr) {}
147  explicit WordData(const PAGE_RES_IT& page_res_it)
148  : word(page_res_it.word()),
149  row(page_res_it.row()->row),
150  block(page_res_it.block()->block),
151  prev_word(nullptr) {}
152  WordData(BLOCK* block_in, ROW* row_in, WERD_RES* word_res)
153  : word(word_res), row(row_in), block(block_in), prev_word(nullptr) {}
154 
160 };
161 
162 // Definition of a Tesseract WordRecognizer. The WordData provides the context
163 // of row/block, in_word holds an initialized, possibly pre-classified word,
164 // that the recognizer may or may not consume (but if so it sets
165 // *in_word=nullptr) and produces one or more output words in out_words, which
166 // may be the consumed in_word, or may be generated independently. This api
167 // allows both a conventional tesseract classifier to work, or a line-level
168 // classifier that generates multiple words from a merged input.
169 using WordRecognizer = void (Tesseract::*)(const WordData&, WERD_RES**,
171 
172 class Tesseract : public Wordrec {
173  public:
174  Tesseract();
175  ~Tesseract() override;
176 
177  // Return appropriate dictionary
178  Dict& getDict() override;
179 
180  // Clear as much used memory as possible without resetting the adaptive
181  // classifier or losing any other classifier data.
182  void Clear();
183  // Clear all memory of adaption for this and all subclassifiers.
185  // Clear the document dictionary for this and all subclassifiers.
187 
188  // Set the equation detector.
189  void SetEquationDetect(EquationDetect* detector);
190 
191  // Simple accessors.
192  const FCOORD& reskew() const {
193  return reskew_;
194  }
195  // Destroy any existing pix and return a pointer to the pointer.
197  pixDestroy(&pix_binary_);
198  return &pix_binary_;
199  }
200  Pix* pix_binary() const {
201  return pix_binary_;
202  }
203  Pix* pix_grey() const {
204  return pix_grey_;
205  }
206  void set_pix_grey(Pix* grey_pix) {
207  pixDestroy(&pix_grey_);
208  pix_grey_ = grey_pix;
209  }
210  Pix* pix_original() const {
211  return pix_original_;
212  }
213  // Takes ownership of the given original_pix.
214  void set_pix_original(Pix* original_pix) {
215  pixDestroy(&pix_original_);
216  pix_original_ = original_pix;
217  // Clone to sublangs as well.
218  for (int i = 0; i < sub_langs_.size(); ++i) {
219  sub_langs_[i]->set_pix_original(original_pix ? pixClone(original_pix)
220  : nullptr);
221  }
222  }
223  // Returns a pointer to a Pix representing the best available resolution image
224  // of the page, with best available bit depth as second priority. Result can
225  // be of any bit depth, but never color-mapped, as that has always been
226  // removed. Note that in grey and color, 0 is black and 255 is
227  // white. If the input was binary, then black is 1 and white is 0.
228  // To tell the difference pixGetDepth() will return 32, 8 or 1.
229  // In any case, the return value is a borrowed Pix, and should not be
230  // deleted or pixDestroyed.
231  Pix* BestPix() const {
232  if (pixGetWidth(pix_original_) == ImageWidth()) {
233  return pix_original_;
234  } else if (pix_grey_ != nullptr) {
235  return pix_grey_;
236  } else {
237  return pix_binary_;
238  }
239  }
240  void set_pix_thresholds(Pix* thresholds) {
241  pixDestroy(&pix_thresholds_);
242  pix_thresholds_ = thresholds;
243  }
244  int source_resolution() const {
245  return source_resolution_;
246  }
247  void set_source_resolution(int ppi) {
248  source_resolution_ = ppi;
249  }
250  int ImageWidth() const {
251  return pixGetWidth(pix_binary_);
252  }
253  int ImageHeight() const {
254  return pixGetHeight(pix_binary_);
255  }
256  Pix* scaled_color() const {
257  return scaled_color_;
258  }
259  int scaled_factor() const {
260  return scaled_factor_;
261  }
262  void SetScaledColor(int factor, Pix* color) {
263  scaled_factor_ = factor;
264  scaled_color_ = color;
265  }
266  const Textord& textord() const {
267  return textord_;
268  }
270  return &textord_;
271  }
272 
273  bool right_to_left() const {
274  return right_to_left_;
275  }
276  int num_sub_langs() const {
277  return sub_langs_.size();
278  }
279  Tesseract* get_sub_lang(int index) const {
280  return sub_langs_[index];
281  }
282  // Returns true if any language uses Tesseract (as opposed to LSTM).
283  bool AnyTessLang() const {
285  return true;
286  for (int i = 0; i < sub_langs_.size(); ++i) {
287  if (sub_langs_[i]->tessedit_ocr_engine_mode != OEM_LSTM_ONLY)
288  return true;
289  }
290  return false;
291  }
292  // Returns true if any language uses the LSTM.
293  bool AnyLSTMLang() const {
295  return true;
296  for (int i = 0; i < sub_langs_.size(); ++i) {
297  if (sub_langs_[i]->tessedit_ocr_engine_mode != OEM_TESSERACT_ONLY) {
298  return true;
299  }
300  }
301  return false;
302  }
303 
304  void SetBlackAndWhitelist();
305 
306  // Perform steps to prepare underlying binary image/other data structures for
307  // page segmentation. Uses the strategy specified in the global variable
308  // pageseg_devanagari_split_strategy for perform splitting while preparing for
309  // page segmentation.
310  void PrepareForPageseg();
311 
312  // Perform steps to prepare underlying binary image/other data structures for
313  // Tesseract OCR. The current segmentation is required by this method.
314  // Uses the strategy specified in the global variable
315  // ocr_devanagari_split_strategy for performing splitting while preparing for
316  // Tesseract ocr.
317  void PrepareForTessOCR(BLOCK_LIST* block_list, Tesseract* osd_tess,
318  OSResults* osr);
319 
320  int SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
321  Tesseract* osd_tess, OSResults* osr);
322  void SetupWordScripts(BLOCK_LIST* blocks);
323  int AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST* blocks,
324  TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
325  Tesseract* osd_tess, OSResults* osr);
327  PageSegMode pageseg_mode, BLOCK_LIST* blocks, Tesseract* osd_tess,
328  OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
329  Pix** music_mask_pix);
330  // par_control.cpp
331  void PrerecAllWordsPar(const GenericVector<WordData>& words);
332 
334  // Generates training data for training a line recognizer, eg LSTM.
335  // Breaks the page into lines, according to the boxes, and writes them to a
336  // serialized DocumentData based on output_basename.
337  // Return true if successful, false if an error occurred.
338  bool TrainLineRecognizer(const STRING& input_imagename,
339  const STRING& output_basename,
340  BLOCK_LIST* block_list);
341  // Generates training data for training a line recognizer, eg LSTM.
342  // Breaks the boxes into lines, normalizes them, converts to ImageData and
343  // appends them to the given training_data.
344  void TrainFromBoxes(const GenericVector<TBOX>& boxes,
345  const GenericVector<STRING>& texts,
346  BLOCK_LIST* block_list, DocumentData* training_data);
347 
348  // Returns an Imagedata containing the image of the given textline,
349  // and ground truth boxes/truth text if available in the input.
350  // The image is not normalized in any way.
351  ImageData* GetLineData(const TBOX& line_box, const GenericVector<TBOX>& boxes,
352  const GenericVector<STRING>& texts, int start_box,
353  int end_box, const BLOCK& block);
354  // Helper gets the image of a rectangle, using the block.re_rotation() if
355  // needed to get to the image, and rotating the result back to horizontal
356  // layout. (CJK characters will be on their left sides) The vertical text flag
357  // is set in the returned ImageData if the text was originally vertical, which
358  // can be used to invoke a different CJK recognition engine. The revised_box
359  // is also returned to enable calculation of output bounding boxes.
360  ImageData* GetRectImage(const TBOX& box, const BLOCK& block, int padding,
361  TBOX* revised_box) const;
362  // Recognizes a word or group of words, converting to WERD_RES in *words.
363  // Analogous to classify_word_pass1, but can handle a group of words as well.
364  void LSTMRecognizeWord(const BLOCK& block, ROW* row, WERD_RES* word,
365  PointerVector<WERD_RES>* words);
366  // Apply segmentation search to the given set of words, within the constraints
367  // of the existing ratings matrix. If there is already a best_choice on a word
368  // leaves it untouched and just sets the done/accepted etc flags.
370 
372  bool ProcessTargetWord(const TBOX& word_box, const TBOX& target_word_box,
373  const char* word_config, int pass);
374  // Sets up the words ready for whichever engine is to be run
375  void SetupAllWordsPassN(int pass_n, const TBOX* target_word_box,
376  const char* word_config, PAGE_RES* page_res,
377  GenericVector<WordData>* words);
378  // Sets up the single word ready for whichever engine is to be run.
379  void SetupWordPassN(int pass_n, WordData* word);
380  // Runs word recognition on all the words.
381  bool RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor, PAGE_RES_IT* pr_it,
382  GenericVector<WordData>* words);
383  bool recog_all_words(PAGE_RES* page_res, ETEXT_DESC* monitor,
384  const TBOX* target_word_box, const char* word_config,
385  int dopasses);
386  void rejection_passes(PAGE_RES* page_res, ETEXT_DESC* monitor,
387  const TBOX* target_word_box, const char* word_config);
388  void bigram_correction_pass(PAGE_RES* page_res);
389  void blamer_pass(PAGE_RES* page_res);
390  // Sets script positions and detects smallcaps on all output words.
391  void script_pos_pass(PAGE_RES* page_res);
392  // Helper to recognize the word using the given (language-specific) tesseract.
393  // Returns positive if this recognizer found more new best words than the
394  // number kept from best_words.
395  int RetryWithLanguage(const WordData& word_data, WordRecognizer recognizer,
396  bool debug, WERD_RES** in_word,
397  PointerVector<WERD_RES>* best_words);
398  // Moves good-looking "noise"/diacritics from the reject list to the main
399  // blob list on the current word. Returns true if anything was done, and
400  // sets make_next_word_fuzzy if blob(s) were added to the end of the word.
401  bool ReassignDiacritics(int pass, PAGE_RES_IT* pr_it,
402  bool* make_next_word_fuzzy);
403  // Attempts to put noise/diacritic outlines into the blobs that they overlap.
404  // Input: a set of noisy outlines that probably belong to the real_word.
405  // Output: outlines that overlapped blobs are set to nullptr and put back into
406  // the word, either in the blobs or in the reject list.
408  const GenericVector<C_OUTLINE*>& outlines, int pass, WERD* real_word,
409  PAGE_RES_IT* pr_it, GenericVector<bool>* word_wanted,
410  GenericVector<bool>* overlapped_any_blob,
411  GenericVector<C_BLOB*>* target_blobs);
412  // Attempts to assign non-overlapping outlines to their nearest blobs or
413  // make new blobs out of them.
415  int pass, WERD* real_word, PAGE_RES_IT* pr_it,
416  GenericVector<bool>* word_wanted,
417  GenericVector<C_BLOB*>* target_blobs);
418  // Starting with ok_outlines set to indicate which outlines overlap the blob,
419  // chooses the optimal set (approximately) and returns true if any outlines
420  // are desired, in which case ok_outlines indicates which ones.
421  bool SelectGoodDiacriticOutlines(int pass, float certainty_threshold,
422  PAGE_RES_IT* pr_it, C_BLOB* blob,
423  const GenericVector<C_OUTLINE*>& outlines,
424  int num_outlines,
425  GenericVector<bool>* ok_outlines);
426  // Classifies the given blob plus the outlines flagged by ok_outlines, undoes
427  // the inclusion of the outlines, and returns the certainty of the raw choice.
428  float ClassifyBlobPlusOutlines(const GenericVector<bool>& ok_outlines,
429  const GenericVector<C_OUTLINE*>& outlines,
430  int pass_n, PAGE_RES_IT* pr_it, C_BLOB* blob,
431  STRING* best_str);
432  // Classifies the given blob (part of word_data->word->word) as an individual
433  // word, using languages, chopper etc, returning only the certainty of the
434  // best raw choice, and undoing all the work done to fake out the word.
435  float ClassifyBlobAsWord(int pass_n, PAGE_RES_IT* pr_it, C_BLOB* blob,
436  STRING* best_str, float* c2);
437  void classify_word_and_language(int pass_n, PAGE_RES_IT* pr_it,
438  WordData* word_data);
439  void classify_word_pass1(const WordData& word_data, WERD_RES** in_word,
440  PointerVector<WERD_RES>* out_words);
441  void recog_pseudo_word(PAGE_RES* page_res, // blocks to check
442  TBOX& selection_box);
443 
444  void fix_rep_char(PAGE_RES_IT* page_res_it);
445 
447  const char* s,
448  const char* lengths);
449  void match_word_pass_n(int pass_n, WERD_RES* word, ROW* row, BLOCK* block);
450  void classify_word_pass2(const WordData& word_data, WERD_RES** in_word,
451  PointerVector<WERD_RES>* out_words);
452  void ReportXhtFixResult(bool accept_new_word, float new_x_ht, WERD_RES* word,
453  WERD_RES* new_word);
454  bool RunOldFixXht(WERD_RES* word, BLOCK* block, ROW* row);
455  bool TrainedXheightFix(WERD_RES* word, BLOCK* block, ROW* row);
456  // Runs recognition with the test baseline shift and x-height and returns true
457  // if there was an improvement in recognition result.
458  bool TestNewNormalization(int original_misfits, float baseline_shift,
459  float new_x_ht, WERD_RES* word, BLOCK* block,
460  ROW* row);
461  bool recog_interactive(PAGE_RES_IT* pr_it);
462 
463  // Set fonts of this word.
464  void set_word_fonts(WERD_RES* word);
465  void font_recognition_pass(PAGE_RES* page_res);
466  void dictionary_correction_pass(PAGE_RES* page_res);
467  bool check_debug_pt(WERD_RES* word, int location);
468 
470  bool SubAndSuperscriptFix(WERD_RES* word_res);
472  const WERD_RES* word, int* num_rebuilt_leading, ScriptPos* leading_pos,
473  float* leading_certainty, int* num_rebuilt_trailing,
474  ScriptPos* trailing_pos, float* trailing_certainty, float* avg_certainty,
475  float* unlikely_threshold);
476  WERD_RES* TrySuperscriptSplits(int num_chopped_leading,
477  float leading_certainty, ScriptPos leading_pos,
478  int num_chopped_trailing,
479  float trailing_certainty,
480  ScriptPos trailing_pos, WERD_RES* word,
481  bool* is_good, int* retry_leading,
482  int* retry_trailing);
483  bool BelievableSuperscript(bool debug, const WERD_RES& word,
484  float certainty_threshold, int* left_ok,
485  int* right_ok) const;
486 
488 
489  void output_pass(PAGE_RES_IT& page_res_it, const TBOX* target_word_box);
490  void write_results(PAGE_RES_IT& page_res_it, // full info
491  char newline_type, // type of newline
492  bool force_eol // override tilde crunch?
493  );
494  void set_unlv_suspects(WERD_RES* word);
495  UNICHAR_ID get_rep_char(WERD_RES* word); // what char is repeated?
496  bool acceptable_number_string(const char* s, const char* lengths);
497  int16_t count_alphanums(const WERD_CHOICE& word);
498  int16_t count_alphas(const WERD_CHOICE& word);
499 
500  void read_config_file(const char* filename, SetParamConstraint constraint);
501  // Initialize for potentially a set of languages defined by the language
502  // string and recursively any additional languages required by any language
503  // traineddata file (via tessedit_load_sublangs in its config) that is loaded.
504  // See init_tesseract_internal for args.
505  int init_tesseract(const char* arg0, const char* textbase,
506  const char* language, OcrEngineMode oem, char** configs,
507  int configs_size, const GenericVector<STRING>* vars_vec,
508  const GenericVector<STRING>* vars_values,
509  bool set_only_init_params, TessdataManager* mgr);
510  int init_tesseract(const char* datapath, const char* language,
511  OcrEngineMode oem) {
512  TessdataManager mgr;
513  return init_tesseract(datapath, nullptr, language, oem, nullptr, 0, nullptr,
514  nullptr, false, &mgr);
515  }
516  // Common initialization for a single language.
517  // arg0 is the datapath for the tessdata directory, which could be the
518  // path of the tessdata directory with no trailing /, or (if tessdata
519  // lives in the same directory as the executable, the path of the executable,
520  // hence the name arg0.
521  // textbase is an optional output file basename (used only for training)
522  // language is the language code to load.
523  // oem controls which engine(s) will operate on the image
524  // configs (argv) is an array of config filenames to load variables from.
525  // May be nullptr.
526  // configs_size (argc) is the number of elements in configs.
527  // vars_vec is an optional vector of variables to set.
528  // vars_values is an optional corresponding vector of values for the variables
529  // in vars_vec.
530  // If set_only_init_params is true, then only the initialization variables
531  // will be set.
532  int init_tesseract_internal(const char* arg0, const char* textbase,
533  const char* language, OcrEngineMode oem,
534  char** configs, int configs_size,
535  const GenericVector<STRING>* vars_vec,
536  const GenericVector<STRING>* vars_values,
537  bool set_only_init_params, TessdataManager* mgr);
538 
539  // Set the universal_id member of each font to be unique among all
540  // instances of the same font loaded.
541  void SetupUniversalFontIds();
542 
543  int init_tesseract_lm(const char* arg0, const char* textbase,
544  const char* language, TessdataManager* mgr);
545 
546  void recognize_page(STRING& image_name);
547  void end_tesseract();
548 
549  bool init_tesseract_lang_data(const char* arg0, const char* textbase,
550  const char* language, OcrEngineMode oem,
551  char** configs, int configs_size,
552  const GenericVector<STRING>* vars_vec,
553  const GenericVector<STRING>* vars_values,
554  bool set_only_init_params,
555  TessdataManager* mgr);
556 
557  void ParseLanguageString(const char* lang_str, GenericVector<STRING>* to_load,
558  GenericVector<STRING>* not_to_load);
559 
562 #ifndef GRAPHICS_DISABLED
563  void pgeditor_main(int width, int height, PAGE_RES* page_res);
564 #endif // GRAPHICS_DISABLED
565  void process_image_event( // action in image win
566  const SVEvent& event);
567  bool process_cmd_win_event( // UI command semantics
568  int32_t cmd_event, // which menu item?
569  char* new_value // any prompt data
570  );
571  void debug_word(PAGE_RES* page_res, const TBOX& selection_box);
572  void do_re_display(
573  bool (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it));
574  bool word_display(PAGE_RES_IT* pr_it);
575  bool word_bln_display(PAGE_RES_IT* pr_it);
577  bool word_set_display(PAGE_RES_IT* pr_it);
578  // #ifndef GRAPHICS_DISABLED
579  bool word_dumper(PAGE_RES_IT* pr_it);
580  // #endif // GRAPHICS_DISABLED
581  void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box);
583  // make rej map for word
584  void make_reject_map(WERD_RES* word, ROW* row, int16_t pass);
585  bool one_ell_conflict(WERD_RES* word_res, bool update_map);
586  int16_t first_alphanum_index(const char* word, const char* word_lengths);
587  int16_t first_alphanum_offset(const char* word, const char* word_lengths);
588  int16_t alpha_count(const char* word, const char* word_lengths);
589  bool word_contains_non_1_digit(const char* word, const char* word_lengths);
590  void dont_allow_1Il(WERD_RES* word);
591  int16_t count_alphanums( // how many alphanums
592  WERD_RES* word);
593  void flip_0O(WERD_RES* word);
594  bool non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
595  bool non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
596  bool repeated_nonalphanum_wd(WERD_RES* word, ROW* row);
597  void nn_match_word( // Match a word
598  WERD_RES* word, ROW* row);
599  void nn_recover_rejects(WERD_RES* word, ROW* row);
600  void set_done( // set done flag
601  WERD_RES* word, int16_t pass);
602  int16_t safe_dict_word(const WERD_RES* werd_res); // is best_choice in dict?
603  void flip_hyphens(WERD_RES* word);
604  void reject_I_1_L(WERD_RES* word);
605  void reject_edge_blobs(WERD_RES* word);
606  void reject_mostly_rejects(WERD_RES* word);
608  bool word_adaptable( // should we adapt?
609  WERD_RES* word, uint16_t mode);
610 
612  void recog_word_recursive(WERD_RES* word);
613  void recog_word(WERD_RES* word);
614  void split_and_recog_word(WERD_RES* word);
615  void split_word(WERD_RES* word, int split_pt, WERD_RES** right_piece,
616  BlamerBundle** orig_blamer_bundle) const;
617  void join_words(WERD_RES* word, WERD_RES* word2, BlamerBundle* orig_bb) const;
619  bool digit_or_numeric_punct(WERD_RES* word, int char_position);
620  int16_t eval_word_spacing(WERD_RES_LIST& word_res_list);
621  void match_current_words(WERD_RES_LIST& words, ROW* row, BLOCK* block);
622  int16_t fp_eval_word_spacing(WERD_RES_LIST& word_res_list);
623  void fix_noisy_space_list(WERD_RES_LIST& best_perm, ROW* row, BLOCK* block);
624  void fix_fuzzy_space_list(WERD_RES_LIST& best_perm, ROW* row, BLOCK* block);
625  void fix_sp_fp_word(WERD_RES_IT& word_res_it, ROW* row, BLOCK* block);
626  void fix_fuzzy_spaces( // find fuzzy words
627  ETEXT_DESC* monitor, // progress monitor
628  int32_t word_count, // count of words in doc
629  PAGE_RES* page_res);
630  void dump_words(WERD_RES_LIST& perm, int16_t score, int16_t mode,
631  bool improved);
633  int16_t worst_noise_blob(WERD_RES* word_res, float* worst_noise_score);
634  float blob_noise_score(TBLOB* blob);
635  void break_noisiest_blob_word(WERD_RES_LIST& words);
637 #ifndef DISABLED_LEGACY_ENGINE
638  GARBAGE_LEVEL garbage_word(WERD_RES* word, bool ok_dict_word);
639  bool potential_word_crunch(WERD_RES* word, GARBAGE_LEVEL garbage_level,
640  bool ok_dict_word);
641 #endif
642  void tilde_crunch(PAGE_RES_IT& page_res_it);
643  void unrej_good_quality_words( // unreject potential
644  PAGE_RES_IT& page_res_it);
645  void doc_and_block_rejection( // reject big chunks
646  PAGE_RES_IT& page_res_it, bool good_quality_doc);
647  void quality_based_rejection(PAGE_RES_IT& page_res_it, bool good_quality_doc);
648  void convert_bad_unlv_chs(WERD_RES* word_res);
649  void tilde_delete(PAGE_RES_IT& page_res_it);
650  int16_t word_blob_quality(WERD_RES* word);
651  void word_char_quality(WERD_RES* word, int16_t* match_count,
652  int16_t* accepted_match_count);
653  void unrej_good_chs(WERD_RES* word);
654  int16_t count_outline_errs(char c, int16_t outline_count);
655  int16_t word_outline_errs(WERD_RES* word);
656 #ifndef DISABLED_LEGACY_ENGINE
657  bool terrible_word_crunch(WERD_RES* word, GARBAGE_LEVEL garbage_level);
658 #endif
659  CRUNCH_MODE word_deletable(WERD_RES* word, int16_t& delete_mode);
660  int16_t failure_count(WERD_RES* word);
661  bool noise_outlines(TWERD* word);
664  PAGE_RES* page_res, // blocks to check
665  // function to call
666  TBOX& selection_box,
667  bool (tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it));
669  void tess_add_doc_word( // test acceptability
670  WERD_CHOICE* word_choice // after context
671  );
672  void tess_segment_pass_n(int pass_n, WERD_RES* word);
673  bool tess_acceptable_word(WERD_RES* word);
674 
676  // Applies the box file based on the image name fname, and resegments
677  // the words in the block_list (page), with:
678  // blob-mode: one blob per line in the box file, words as input.
679  // word/line-mode: one blob per space-delimited unit after the #, and one word
680  // per line in the box file. (See comment above for box file format.)
681  // If find_segmentation is true, (word/line mode) then the classifier is used
682  // to re-segment words/lines to match the space-delimited truth string for
683  // each box. In this case, the input box may be for a word or even a whole
684  // text line, and the output words will contain multiple blobs corresponding
685  // to the space-delimited input string.
686  // With find_segmentation false, no classifier is needed, but the chopper
687  // can still be used to correctly segment touching characters with the help
688  // of the input boxes.
689  // In the returned PAGE_RES, the WERD_RES are setup as they would be returned
690  // from normal classification, ie. with a word, chopped_word, rebuild_word,
691  // seam_array, denorm, box_word, and best_state, but NO best_choice or
692  // raw_choice, as they would require a UNICHARSET, which we aim to avoid.
693  // Instead, the correct_text member of WERD_RES is set, and this may be later
694  // converted to a best_choice using CorrectClassifyWords. CorrectClassifyWords
695  // is not required before calling ApplyBoxTraining.
696  PAGE_RES* ApplyBoxes(const STRING& fname, bool find_segmentation,
697  BLOCK_LIST* block_list);
698 
699  // Any row xheight that is significantly different from the median is set
700  // to the median.
701  void PreenXHeights(BLOCK_LIST* block_list);
702 
703  // Builds a PAGE_RES from the block_list in the way required for ApplyBoxes:
704  // All fuzzy spaces are removed, and all the words are maximally chopped.
706  BLOCK_LIST* block_list);
707  // Tests the chopper by exhaustively running chop_one_blob.
708  // The word_res will contain filled chopped_word, seam_array, denorm,
709  // box_word and best_state for the maximally chopped word.
710  void MaximallyChopWord(const GenericVector<TBOX>& boxes, BLOCK* block,
711  ROW* row, WERD_RES* word_res);
712  // Gather consecutive blobs that match the given box into the best_state
713  // and corresponding correct_text.
714  // Fights over which box owns which blobs are settled by pre-chopping and
715  // applying the blobs to box or next_box with the least non-overlap.
716  // Returns false if the box was in error, which can only be caused by
717  // failing to find an appropriate blob for a box.
718  // This means that occasionally, blobs may be incorrectly segmented if the
719  // chopper fails to find a suitable chop point.
720  bool ResegmentCharBox(PAGE_RES* page_res, const TBOX* prev_box,
721  const TBOX& box, const TBOX* next_box,
722  const char* correct_text);
723  // Consume all source blobs that strongly overlap the given box,
724  // putting them into a new word, with the correct_text label.
725  // Fights over which box owns which blobs are settled by
726  // applying the blobs to box or next_box with the least non-overlap.
727  // Returns false if the box was in error, which can only be caused by
728  // failing to find an overlapping blob for a box.
729  bool ResegmentWordBox(BLOCK_LIST* block_list, const TBOX& box,
730  const TBOX* next_box, const char* correct_text);
731  // Resegments the words by running the classifier in an attempt to find the
732  // correct segmentation that produces the required string.
733  void ReSegmentByClassification(PAGE_RES* page_res);
734  // Converts the space-delimited string of utf8 text to a vector of UNICHAR_ID.
735  // Returns false if an invalid UNICHAR_ID is encountered.
736  bool ConvertStringToUnichars(const char* utf8,
737  GenericVector<UNICHAR_ID>* class_ids);
738  // Resegments the word to achieve the target_text from the classifier.
739  // Returns false if the re-segmentation fails.
740  // Uses brute-force combination of up to kMaxGroupSize adjacent blobs, and
741  // applies a full search on the classifier results to find the best classified
742  // segmentation. As a compromise to obtain better recall, 1-1 ambigiguity
743  // substitutions ARE used.
744  bool FindSegmentation(const GenericVector<UNICHAR_ID>& target_text,
745  WERD_RES* word_res);
746  // Recursive helper to find a match to the target_text (from text_index
747  // position) in the choices (from choices_pos position).
748  // Choices is an array of GenericVectors, of length choices_length, with each
749  // element representing a starting position in the word, and the
750  // GenericVector holding classification results for a sequence of consecutive
751  // blobs, with index 0 being a single blob, index 1 being 2 blobs etc.
753  int choices_pos, int choices_length,
754  const GenericVector<UNICHAR_ID>& target_text,
755  int text_index, float rating,
756  GenericVector<int>* segmentation, float* best_rating,
757  GenericVector<int>* best_segmentation);
758  // Counts up the labelled words and the blobs within.
759  // Deletes all unused or emptied words, counting the unused ones.
760  // Resets W_BOL and W_EOL flags correctly.
761  // Builds the rebuild_word and rebuilds the box_word.
762  void TidyUp(PAGE_RES* page_res);
763  // Logs a bad box by line in the box file and box coords.
764  void ReportFailedBox(int boxfile_lineno, TBOX box, const char* box_ch,
765  const char* err_msg);
766  // Creates a fake best_choice entry in each WERD_RES with the correct text.
767  void CorrectClassifyWords(PAGE_RES* page_res);
768  // Call LearnWord to extract features for labelled blobs within each word.
769  // Features are stored in an internal buffer.
770  void ApplyBoxTraining(const STRING& fontname, PAGE_RES* page_res);
771 
773  // Returns the number of misfit blob tops in this word.
774  int CountMisfitTops(WERD_RES* word_res);
775  // Returns a new x-height in pixels (original image coords) that is
776  // maximally compatible with the result in word_res.
777  // Returns 0.0f if no x-height is found that is better than the current
778  // estimate.
779  float ComputeCompatibleXheight(WERD_RES* word_res, float* baseline_shift);
781  // TODO(ocr-team): Find and remove obsolete parameters.
783  "Take segmentation and labeling from box file");
785  "Conversion of word/line box file to char box file");
787  "Generate training data from boxed chars");
789  "Generate more boxes from boxed chars");
791  "Break input into lines and remap boxes if present");
793  "Dump intermediate images made during page segmentation");
795  "Try inverting the image in `LSTMRecognizeWord`");
797  "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block,"
798  " 5=line, 6=word, 7=char"
799  " (Values from PageSegMode enum in tesseract/publictypes.h)");
801  "Which OCR engine(s) to run (Tesseract, LSTM, both). Defaults"
802  " to loading and running the most accurate available.");
804  "Blacklist of chars not to recognize");
805  STRING_VAR_H(tessedit_char_whitelist, "", "Whitelist of chars to recognize");
807  "List of chars to override tessedit_char_blacklist");
809  "Perform training for ambiguities");
812  "Whether to use the top-line splitting process for Devanagari "
813  "documents while performing page-segmentation.");
816  "Whether to use the top-line splitting process for Devanagari "
817  "documents while performing ocr.");
819  "Write all parameters to the given file.");
821  "Generate and print debug information for adaption");
822  INT_VAR_H(bidi_debug, 0, "Debug level for BiDi");
823  INT_VAR_H(applybox_debug, 1, "Debug level");
824  INT_VAR_H(applybox_page, 0, "Page number to apply boxes from");
826  "Exposure value follows this pattern in the image"
827  " filename. The name of the image files are expected"
828  " to be in the form [lang].[fontname].exp[num].tif");
830  "Learn both character fragments (as is done in the"
831  " special low exposure mode) as well as unfragmented"
832  " characters.");
834  "Each bounding box is assumed to contain ngrams. Only"
835  " learn the ngrams whose outlines overlap horizontally.");
836  BOOL_VAR_H(tessedit_display_outwords, false, "Draw output words");
837  BOOL_VAR_H(tessedit_dump_choices, false, "Dump char choices");
838  BOOL_VAR_H(tessedit_timing_debug, false, "Print timing stats");
839  BOOL_VAR_H(tessedit_fix_fuzzy_spaces, true, "Try to improve fuzzy spaces");
841  "Don't bother with word plausibility");
842  BOOL_VAR_H(tessedit_fix_hyphens, true, "Crunch double hyphens?");
844  "Add words to the document dictionary");
845  BOOL_VAR_H(tessedit_debug_fonts, false, "Output font info per char");
846  BOOL_VAR_H(tessedit_debug_block_rejection, false, "Block and Row stats");
848  "Enable correction based on the word bigram dictionary.");
850  "Enable single word correction based on the dictionary.");
852  "Amount of debug output for bigram "
853  "correction.");
855  "Remove and conditionally reassign small outlines when they"
856  " confuse layout analysis, determining diacritics vs noise");
857  INT_VAR_H(debug_noise_removal, 0, "Debug reassignment of small outlines");
858  // Worst (min) certainty, for which a diacritic is allowed to make the base
859  // character worse and still be included.
860  double_VAR_H(noise_cert_basechar, -8.0, "Hingepoint for base char certainty");
861  // Worst (min) certainty, for which a non-overlapping diacritic is allowed to
862  // make the base character worse and still be included.
863  double_VAR_H(noise_cert_disjoint, -2.5, "Hingepoint for disjoint certainty");
864  // Worst (min) certainty, for which a diacritic is allowed to make a new
865  // stand-alone blob.
866  double_VAR_H(noise_cert_punc, -2.5, "Threshold for new punc char certainty");
867  // Factor of certainty margin for adding diacritics to not count as worse.
869  "Scaling on certainty diff from Hingepoint");
870  INT_VAR_H(noise_maxperblob, 8, "Max diacritics to apply to a blob");
871  INT_VAR_H(noise_maxperword, 16, "Max diacritics to apply to a word");
872  INT_VAR_H(debug_x_ht_level, 0, "Reestimate debug");
873  STRING_VAR_H(chs_leading_punct, "('`\"", "Leading punctuation");
874  STRING_VAR_H(chs_trailing_punct1, ").,;:?!", "1st Trailing punctuation");
875  STRING_VAR_H(chs_trailing_punct2, ")'`\"", "2nd Trailing punctuation");
876  double_VAR_H(quality_rej_pc, 0.08, "good_quality_doc lte rejection limit");
877  double_VAR_H(quality_blob_pc, 0.0, "good_quality_doc gte good blobs limit");
879  "good_quality_doc lte outline error limit");
880  double_VAR_H(quality_char_pc, 0.95, "good_quality_doc gte good char limit");
881  INT_VAR_H(quality_min_initial_alphas_reqd, 2, "alphas in a good word");
883  "Adaptation decision algorithm for tess");
885  "Do minimal rejection on pass 1 output");
886  BOOL_VAR_H(tessedit_test_adaption, false, "Test adaption criteria");
887  BOOL_VAR_H(test_pt, false, "Test for point");
888  double_VAR_H(test_pt_x, 99999.99, "xcoord");
889  double_VAR_H(test_pt_y, 99999.99, "ycoord");
890  INT_VAR_H(multilang_debug_level, 0, "Print multilang debug info.");
891  INT_VAR_H(paragraph_debug_level, 0, "Print paragraph debug info.");
893  "Run paragraph detection on the post-text-recognition "
894  "(more accurate)");
895  BOOL_VAR_H(lstm_use_matrix, 1, "Use ratings matrix/beam searct with lstm");
896  STRING_VAR_H(outlines_odd, "%| ", "Non standard number of outlines");
897  STRING_VAR_H(outlines_2, "ij!?%\":;", "Non standard number of outlines");
899  "Reduce rejection on good docs");
900  BOOL_VAR_H(tessedit_use_reject_spaces, true, "Reject spaces?");
902  "%rej allowed before rej whole doc");
904  "%rej allowed before rej whole block");
906  "%rej allowed before rej whole row");
908  "Number of row rejects in whole word rejects"
909  "which prevents whole row rejection");
911  "Only rej partially rejected words in block rejection");
913  "Only rej partially rejected words in row rejection");
915  "Use word segmentation quality metric");
917  "Use word segmentation quality metric");
919  "Only preserve wds longer than this");
921  "Apply row rejection to good docs");
923  "rej good doc wd if more than this fraction rejected");
924  BOOL_VAR_H(tessedit_reject_bad_qual_wds, true, "Reject all bad quality wds");
927  "Output data to debug file");
928  BOOL_VAR_H(bland_unrej, false, "unrej potential with no checks");
929  double_VAR_H(quality_rowrej_pc, 1.1, "good_quality_doc gte good char limit");
930  BOOL_VAR_H(unlv_tilde_crunching, false, "Mark v.bad words for tilde crunch");
931  BOOL_VAR_H(hocr_font_info, false, "Add font info to hocr output");
933  "Add coordinates for each character to hocr output");
934  BOOL_VAR_H(crunch_early_merge_tess_fails, true, "Before word crunch?");
935  BOOL_VAR_H(crunch_early_convert_bad_unlv_chs, false, "Take out ~^ early?");
936  double_VAR_H(crunch_terrible_rating, 80.0, "crunch rating lt this");
937  BOOL_VAR_H(crunch_terrible_garbage, true, "As it says");
938  double_VAR_H(crunch_poor_garbage_cert, -9.0, "crunch garbage cert lt this");
939  double_VAR_H(crunch_poor_garbage_rate, 60, "crunch garbage rating lt this");
940  double_VAR_H(crunch_pot_poor_rate, 40, "POTENTIAL crunch rating lt this");
941  double_VAR_H(crunch_pot_poor_cert, -8.0, "POTENTIAL crunch cert lt this");
942  double_VAR_H(crunch_del_rating, 60, "POTENTIAL crunch rating lt this");
943  double_VAR_H(crunch_del_cert, -10.0, "POTENTIAL crunch cert lt this");
944  double_VAR_H(crunch_del_min_ht, 0.7, "Del if word ht lt xht x this");
945  double_VAR_H(crunch_del_max_ht, 3.0, "Del if word ht gt xht x this");
946  double_VAR_H(crunch_del_min_width, 3.0, "Del if word width lt xht x this");
947  double_VAR_H(crunch_del_high_word, 1.5, "Del if word gt xht x this above bl");
948  double_VAR_H(crunch_del_low_word, 0.5, "Del if word gt xht x this below bl");
949  double_VAR_H(crunch_small_outlines_size, 0.6, "Small if lt xht x this");
950  INT_VAR_H(crunch_rating_max, 10, "For adj length in rating per ch");
951  INT_VAR_H(crunch_pot_indicators, 1, "How many potential indicators needed");
952  BOOL_VAR_H(crunch_leave_ok_strings, true, "Don't touch sensible strings");
953  BOOL_VAR_H(crunch_accept_ok, true, "Use acceptability in okstring");
955  "Don't pot crunch sensible strings");
956  BOOL_VAR_H(crunch_include_numerals, false, "Fiddle alpha figures");
958  "Don't crunch words with long lower case strings");
960  "Don't crunch words with long lower case strings");
961  INT_VAR_H(crunch_long_repetitions, 3, "Crunch words with long repetitions");
962  INT_VAR_H(crunch_debug, 0, "As it says");
963  INT_VAR_H(fixsp_non_noise_limit, 1, "How many non-noise blbs either side?");
964  double_VAR_H(fixsp_small_outlines_size, 0.28, "Small if lt xht x this");
965  BOOL_VAR_H(tessedit_prefer_joined_punct, false, "Reward punctuation joins");
966  INT_VAR_H(fixsp_done_mode, 1, "What constitues done for spacing");
967  INT_VAR_H(debug_fix_space_level, 0, "Contextual fixspace debug");
968  STRING_VAR_H(numeric_punctuation, ".,", "Punct. chs expected WITHIN numbers");
970  "Max allowed deviation of blob top outside of font data");
971  INT_VAR_H(x_ht_min_change, 8, "Min change in xht before actually trying it");
972  INT_VAR_H(superscript_debug, 0, "Debug level for sub & superscript fixer");
974  "How many times worse "
975  "certainty does a superscript position glyph need to be for us "
976  "to try classifying it as a char with a different baseline?");
978  "What reduction in "
979  "badness do we think sufficient to choose a superscript over "
980  "what we'd thought. For example, a value of 0.6 means we want "
981  "to reduce badness of certainty by 40%");
983  "A superscript scaled down more than this is unbelievably "
984  "small. For example, 0.3 means we expect the font size to "
985  "be no smaller than 30% of the text line font size.");
987  "Maximum top of a character measured as a multiple of x-height "
988  "above the baseline for us to reconsider whether it's a "
989  "subscript.");
991  "Minimum bottom of a character measured as a multiple of "
992  "x-height above the baseline for us to reconsider whether it's "
993  "a superscript.");
995  "Write block separators in output");
996  BOOL_VAR_H(tessedit_write_rep_codes, false, "Write repetition char code");
997  BOOL_VAR_H(tessedit_write_unlv, false, "Write .unlv output file");
998  BOOL_VAR_H(tessedit_create_txt, false, "Write .txt output file");
999  BOOL_VAR_H(tessedit_create_hocr, false, "Write .html hOCR output file");
1000  BOOL_VAR_H(tessedit_create_alto, false, "Write .xml ALTO output file");
1002  "Write .box file for LSTM training");
1003  BOOL_VAR_H(tessedit_create_tsv, false, "Write .tsv output file");
1005  "Write WordStr format .box output file");
1006  BOOL_VAR_H(tessedit_create_pdf, false, "Write .pdf output file");
1007  BOOL_VAR_H(textonly_pdf, false,
1008  "Create PDF with only one invisible text layer");
1009  INT_VAR_H(jpg_quality, 85, "Set JPEG quality level");
1010  INT_VAR_H(user_defined_dpi, 0, "Specify DPI for input image");
1012  "Specify minimum characters to try during OSD");
1013  STRING_VAR_H(unrecognised_char, "|", "Output char for unidentified blobs");
1014  INT_VAR_H(suspect_level, 99, "Suspect marker level");
1015  INT_VAR_H(suspect_short_words, 2, "Don't Suspect dict wds longer than this");
1016  BOOL_VAR_H(suspect_constrain_1Il, false, "UNLV keep 1Il chars rejected");
1017  double_VAR_H(suspect_rating_per_ch, 999.9, "Don't touch bad rating limit");
1018  double_VAR_H(suspect_accept_rating, -999.9, "Accept good rating limit");
1019  BOOL_VAR_H(tessedit_minimal_rejection, false, "Only reject tess failures");
1020  BOOL_VAR_H(tessedit_zero_rejection, false, "Don't reject ANYTHING");
1022  "Make output have exactly one word per WERD");
1024  "Don't reject ANYTHING AT ALL");
1025  INT_VAR_H(tessedit_reject_mode, 0, "Rejection algorithm");
1026  BOOL_VAR_H(tessedit_rejection_debug, false, "Adaption debug");
1027  BOOL_VAR_H(tessedit_flip_0O, true, "Contextual 0O O0 flips");
1028  double_VAR_H(tessedit_lower_flip_hyphen, 1.5, "Aspect ratio dot/hyphen test");
1029  double_VAR_H(tessedit_upper_flip_hyphen, 1.8, "Aspect ratio dot/hyphen test");
1030  BOOL_VAR_H(rej_trust_doc_dawg, false, "Use DOC dawg in 11l conf. detector");
1031  BOOL_VAR_H(rej_1Il_use_dict_word, false, "Use dictword test");
1032  BOOL_VAR_H(rej_1Il_trust_permuter_type, true, "Don't double check");
1033  BOOL_VAR_H(rej_use_tess_accepted, true, "Individual rejection control");
1034  BOOL_VAR_H(rej_use_tess_blanks, true, "Individual rejection control");
1035  BOOL_VAR_H(rej_use_good_perm, true, "Individual rejection control");
1036  BOOL_VAR_H(rej_use_sensible_wd, false, "Extend permuter check");
1037  BOOL_VAR_H(rej_alphas_in_number_perm, false, "Extend permuter check");
1039  INT_VAR_H(tessedit_image_border, 2, "Rej blbs near image edge limit");
1040  STRING_VAR_H(ok_repeated_ch_non_alphanum_wds, "-?*\075", "Allow NN to unrej");
1041  STRING_VAR_H(conflict_set_I_l_1, "Il1[]", "Il1 conflict set");
1042  INT_VAR_H(min_sane_x_ht_pixels, 8, "Reject any x-ht lt or eq than this");
1043  BOOL_VAR_H(tessedit_create_boxfile, false, "Output text with boxes");
1045  "-1 -> All pages, else specific page to process");
1046  BOOL_VAR_H(tessedit_write_images, false, "Capture the image from the IPE");
1047  BOOL_VAR_H(interactive_display_mode, false, "Run interactively?");
1048  STRING_VAR_H(file_type, ".tif", "Filename extension");
1049  BOOL_VAR_H(tessedit_override_permuter, true, "According to dict_word");
1051  "List of languages to load with this one");
1053  "In multilingual mode use params model of the primary language");
1054  // Min acceptable orientation margin (difference in scores between top and 2nd
1055  // choice in OSResults::orientations) to believe the page orientation.
1057  "Min acceptable orientation margin");
1058  BOOL_VAR_H(textord_tabfind_show_vlines, false, "Debug line finding");
1059  BOOL_VAR_H(textord_use_cjk_fp_model, false, "Use CJK fixed pitch model");
1061  "Allow feature extractors to see the original outline");
1063  "Only initialize with the config file. Useful if the instance is "
1064  "not going to be used for OCR but say only for layout analysis.");
1065  BOOL_VAR_H(textord_equation_detect, false, "Turn on equation detector");
1066  BOOL_VAR_H(textord_tabfind_vertical_text, true, "Enable vertical detection");
1068  "Force using vertical text page mode");
1070  "Fraction of textlines deemed vertical to use vertical page "
1071  "mode");
1073  "Fraction of height used as a minimum gap for aligned blobs.");
1074  INT_VAR_H(tessedit_parallelize, 0, "Run in parallel where possible");
1076  "Preserve multiple interword spaces");
1078  "Page separator (default is form feed control character)");
1080  "Allows to include alternative symbols choices in the hOCR "
1081  "output. "
1082  "Valid input values are 0, 1 and 2. 0 is the default value. "
1083  "With 1 the alternative symbol choices per timestep are included. "
1084  "With 2 the alternative symbol choices are extracted from the CTC "
1085  "process instead of the lattice. The choices are mapped per "
1086  "character.");
1088  "Sets the number of cascading iterations for the Beamsearch in "
1089  "lstm_choice_mode. Note that lstm_choice_mode must be set to "
1090  "a value greater than 0 to produce results.");
1092  "Sets the rating coefficient for the lstm choices. The smaller "
1093  "the coefficient, the better are the ratings for each choice "
1094  "and less information is lost due to the cut off at 0. The "
1095  "standard value is 5.");
1097  "Detect music staff and remove intersecting components");
1098 
1100  FILE* init_recog_training(const STRING& fname);
1101  void recog_training_segmented(const STRING& fname, PAGE_RES* page_res,
1102  volatile ETEXT_DESC* monitor,
1103  FILE* output_file);
1104  void ambigs_classify_and_output(const char* label, PAGE_RES_IT* pr_it,
1105  FILE* output_file);
1106 
1107  private:
1108  // The filename of a backup config file. If not null, then we currently
1109  // have a temporary debug config file loaded, and backup_config_file_
1110  // will be loaded, and set to null when debug is complete.
1111  const char* backup_config_file_;
1112  // The filename of a config file to read when processing a debug word.
1113  STRING word_config_;
1114  // Image used for input to layout analysis and tesseract recognition.
1115  // May be modified by the ShiroRekhaSplitter to eliminate the top-line.
1116  Pix* pix_binary_;
1117  // Grey-level input image if the input was not binary, otherwise nullptr.
1118  Pix* pix_grey_;
1119  // Original input image. Color if the input was color.
1120  Pix* pix_original_;
1121  // Thresholds that were used to generate the thresholded image from grey.
1122  Pix* pix_thresholds_;
1123  // Debug images. If non-empty, will be written on destruction.
1124  DebugPixa pixa_debug_;
1125  // Input image resolution after any scaling. The resolution is not well
1126  // transmitted by operations on Pix, so we keep an independent record here.
1127  int source_resolution_;
1128  // The shiro-rekha splitter object which is used to split top-lines in
1129  // Devanagari words to provide a better word and grapheme segmentation.
1130  ShiroRekhaSplitter splitter_;
1131  // Page segmentation/layout
1132  Textord textord_;
1133  // True if the primary language uses right_to_left reading order.
1134  bool right_to_left_;
1135  Pix* scaled_color_;
1136  int scaled_factor_;
1137  FCOORD deskew_;
1138  FCOORD reskew_;
1139  TesseractStats stats_;
1140  // Sub-languages to be tried in addition to this.
1141  GenericVector<Tesseract*> sub_langs_;
1142  // Most recently used Tesseract out of this and sub_langs_. The default
1143  // language for the next word.
1144  Tesseract* most_recently_used_;
1145  // The size of the font table, ie max possible font id + 1.
1146  int font_table_size_;
1147  // Equation detector. Note: this pointer is NOT owned by the class.
1148  EquationDetect* equ_detect_;
1149  // LSTM recognizer, if available.
1150  LSTMRecognizer* lstm_recognizer_;
1151  // Output "page" number (actually line number) using TrainLineRecognizer.
1152  int train_line_page_num_;
1153 };
1154 
1155 } // namespace tesseract
1156 
1157 #endif // TESSERACT_CCMAIN_TESSERACTCLASS_H_
tesseract::Tesseract::chs_leading_punct
char * chs_leading_punct
Definition: tesseractclass.h:873
tesseract::Tesseract::tessedit_dont_rowrej_good_wds
bool tessedit_dont_rowrej_good_wds
Definition: tesseractclass.h:917
tesseract::Tesseract::superscript_bettered_certainty
double superscript_bettered_certainty
Definition: tesseractclass.h:981
tesseract::Tesseract::ProcessTargetWord
bool ProcessTargetWord(const TBOX &word_box, const TBOX &target_word_box, const char *word_config, int pass)
Definition: control.cpp:120
tesseract::Tesseract::BelievableSuperscript
bool BelievableSuperscript(bool debug, const WERD_RES &word, float certainty_threshold, int *left_ok, int *right_ok) const
Definition: superscript.cpp:520
tesseract::Tesseract::dump_words
void dump_words(WERD_RES_LIST &perm, int16_t score, int16_t mode, bool improved)
Definition: fixspace.cpp:475
tesseract::Tesseract::first_alphanum_index
int16_t first_alphanum_index(const char *word, const char *word_lengths)
Definition: reject.cpp:468
tesseract::Tesseract::SetupPageSegAndDetectOrientation
ColumnFinder * SetupPageSegAndDetectOrientation(PageSegMode pageseg_mode, BLOCK_LIST *blocks, Tesseract *osd_tess, OSResults *osr, TO_BLOCK_LIST *to_blocks, Pix **photo_mask_pix, Pix **music_mask_pix)
Definition: pagesegmain.cpp:284
tesseract::Tesseract::applybox_exposure_pattern
char * applybox_exposure_pattern
Definition: tesseractclass.h:828
tesseract::Tesseract::quality_based_rejection
void quality_based_rejection(PAGE_RES_IT &page_res_it, bool good_quality_doc)
Definition: docqual.cpp:133
strngs.h
tesseract::Tesseract::hocr_font_info
bool hocr_font_info
Definition: tesseractclass.h:931
tesseract::Tesseract::break_noisiest_blob_word
void break_noisiest_blob_word(WERD_RES_LIST &words)
Definition: fixspace.cpp:641
tesseract::Tesseract::poly_allow_detailed_fx
bool poly_allow_detailed_fx
Definition: tesseractclass.h:1061
tesseract::Tesseract::split_and_recog_word
void split_and_recog_word(WERD_RES *word)
Definition: tfacepp.cpp:137
tesseract::Tesseract::init_tesseract
int init_tesseract(const char *arg0, const char *textbase, const char *language, OcrEngineMode oem, char **configs, int configs_size, const GenericVector< STRING > *vars_vec, const GenericVector< STRING > *vars_values, bool set_only_init_params, TessdataManager *mgr)
Definition: tessedit.cpp:302
tesseract::Tesseract::fix_noisy_space_list
void fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *block)
Definition: fixspace.cpp:595
tesseract::Tesseract::PrepareForTessOCR
void PrepareForTessOCR(BLOCK_LIST *block_list, Tesseract *osd_tess, OSResults *osr)
Definition: tesseractclass.cpp:672
tesseract::Tesseract::eval_word_spacing
int16_t eval_word_spacing(WERD_RES_LIST &word_res_list)
Definition: fixspace.cpp:265
tesseract::Tesseract::quality_min_initial_alphas_reqd
int quality_min_initial_alphas_reqd
Definition: tesseractclass.h:881
tesseract::Tesseract::min_sane_x_ht_pixels
int min_sane_x_ht_pixels
Definition: tesseractclass.h:1042
tesseract::Tesseract::crunch_terrible_rating
double crunch_terrible_rating
Definition: tesseractclass.h:936
tesseract::Tesseract::tessedit_use_reject_spaces
bool tessedit_use_reject_spaces
Definition: tesseractclass.h:900
tesseract::Tesseract::output_pass
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)
Definition: output.cpp:35
tesseract::Tesseract::recog_pseudo_word
void recog_pseudo_word(PAGE_RES *page_res, TBOX &selection_box)
Definition: control.cpp:62
tesseract::Tesseract::tessedit_train_from_boxes
bool tessedit_train_from_boxes
Definition: tesseractclass.h:787
tesseract::Tesseract::crunch_del_rating
double crunch_del_rating
Definition: tesseractclass.h:942
tesseract::Tesseract::pix_grey
Pix * pix_grey() const
Definition: tesseractclass.h:203
tesseract::Tesseract::pageseg_devanagari_split_strategy
int pageseg_devanagari_split_strategy
Definition: tesseractclass.h:813
pageres.h
tesseract::TesseractStats::doc_blob_quality
int16_t doc_blob_quality
Definition: tesseractclass.h:128
tesseract::Tesseract::failure_count
int16_t failure_count(WERD_RES *word)
Definition: docqual.cpp:946
tesseract::Tesseract::ResetDocumentDictionary
void ResetDocumentDictionary()
Definition: tesseractclass.cpp:607
tesseract::Tesseract::quality_char_pc
double quality_char_pc
Definition: tesseractclass.h:880
tesseract::Tesseract::tessedit_good_doc_still_rowrej_wd
double tessedit_good_doc_still_rowrej_wd
Definition: tesseractclass.h:923
tesseract::Tesseract::crunch_poor_garbage_cert
double crunch_poor_garbage_cert
Definition: tesseractclass.h:938
tesseract::Tesseract::file_type
char * file_type
Definition: tesseractclass.h:1048
tesseract::Tesseract::tessedit_create_pdf
bool tessedit_create_pdf
Definition: tesseractclass.h:1006
tesseract::Tesseract::crunch_del_cert
double crunch_del_cert
Definition: tesseractclass.h:943
tesseract::Tesseract::crunch_rating_max
int crunch_rating_max
Definition: tesseractclass.h:950
tesseract::Tesseract::set_word_fonts
void set_word_fonts(WERD_RES *word)
Definition: control.cpp:1961
tesseract::Tesseract::superscript_worse_certainty
double superscript_worse_certainty
Definition: tesseractclass.h:976
tesseract::EquationDetect
Definition: equationdetect.h:38
tesseract::Tesseract::x_ht_acceptance_tolerance
int x_ht_acceptance_tolerance
Definition: tesseractclass.h:970
tesseract::Tesseract::lstm_choice_mode
int lstm_choice_mode
Definition: tesseractclass.h:1086
ACCEPTABLE_WERD_TYPE
ACCEPTABLE_WERD_TYPE
Definition: control.h:27
tesseract::Tesseract::tessedit_display_outwords
bool tessedit_display_outwords
Definition: tesseractclass.h:836
tesseract::Tesseract::textord_use_cjk_fp_model
bool textord_use_cjk_fp_model
Definition: tesseractclass.h:1059
tesseract::Tesseract::chs_trailing_punct1
char * chs_trailing_punct1
Definition: tesseractclass.h:874
tesseract::Tesseract::tessedit_create_wordstrbox
bool tessedit_create_wordstrbox
Definition: tesseractclass.h:1005
tesseract::Tesseract::ComputeCompatibleXheight
float ComputeCompatibleXheight(WERD_RES *word_res, float *baseline_shift)
Definition: fixxht.cpp:117
tesseract::TessdataManager
Definition: tessdatamanager.h:126
tesseract::Tesseract::tessedit_create_boxfile
bool tessedit_create_boxfile
Definition: tesseractclass.h:1043
tesseract::Wordrec
Definition: wordrec.h:192
tesseract::Tesseract::noise_outlines
bool noise_outlines(TWERD *word)
Definition: docqual.cpp:958
WERD_CHOICE
Definition: ratngs.h:261
tesseract::Tesseract::recog_training_segmented
void recog_training_segmented(const STRING &fname, PAGE_RES *page_res, volatile ETEXT_DESC *monitor, FILE *output_file)
Definition: recogtraining.cpp:84
TWERD
Definition: blobs.h:416
tesseract::Tesseract::tessedit_do_invert
bool tessedit_do_invert
Definition: tesseractclass.h:795
tesseract::Tesseract::lstm_rating_coefficient
double lstm_rating_coefficient
Definition: tesseractclass.h:1095
tesseract::Tesseract::flip_0O
void flip_0O(WERD_RES *word)
Definition: reject.cpp:671
tesseract::Tesseract::recog_word
void recog_word(WERD_RES *word)
Definition: tfacepp.cpp:41
tesseract::Tesseract::tessedit_debug_quality_metrics
bool tessedit_debug_quality_metrics
Definition: tesseractclass.h:927
tesseract::Tesseract::CountMisfitTops
int CountMisfitTops(WERD_RES *word_res)
Definition: fixxht.cpp:85
tesseract::Tesseract::applybox_debug
int applybox_debug
Definition: tesseractclass.h:823
control.h
tesseract::Tesseract::SearchForText
void SearchForText(const GenericVector< BLOB_CHOICE_LIST * > *choices, int choices_pos, int choices_length, const GenericVector< UNICHAR_ID > &target_text, int text_index, float rating, GenericVector< int > *segmentation, float *best_rating, GenericVector< int > *best_segmentation)
tesseract::Tesseract::tessedit_fix_fuzzy_spaces
bool tessedit_fix_fuzzy_spaces
Definition: tesseractclass.h:839
tesseract::Tesseract::debug_word
void debug_word(PAGE_RES *page_res, const TBOX &selection_box)
Definition: pgedit.cpp:665
tesseract::Tesseract::init_tesseract
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
Definition: tesseractclass.h:510
tesseract::Tesseract::SetEquationDetect
void SetEquationDetect(EquationDetect *detector)
Definition: tesseractclass.cpp:591
tesseract::Tesseract::applybox_learn_ngrams_mode
bool applybox_learn_ngrams_mode
Definition: tesseractclass.h:835
params.h
tesseract::Tesseract::AssignDiacriticsToOverlappingBlobs
void AssignDiacriticsToOverlappingBlobs(const GenericVector< C_OUTLINE * > &outlines, int pass, WERD *real_word, PAGE_RES_IT *pr_it, GenericVector< bool > *word_wanted, GenericVector< bool > *overlapped_any_blob, GenericVector< C_BLOB * > *target_blobs)
Definition: control.cpp:1010
tesseract::Tesseract::recognize_page
void recognize_page(STRING &image_name)
tesseract::Tesseract::tilde_crunch
void tilde_crunch(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:396
tesseract::Tesseract::crunch_terrible_garbage
bool crunch_terrible_garbage
Definition: tesseractclass.h:937
tesseract::Tesseract::tessedit_write_rep_codes
bool tessedit_write_rep_codes
Definition: tesseractclass.h:996
tesseract::Tesseract::RunOldFixXht
bool RunOldFixXht(WERD_RES *word, BLOCK *block, ROW *row)
wordrec.h
tesseract::Tesseract
Definition: tesseractclass.h:172
tesseract::Tesseract::min_orientation_margin
double min_orientation_margin
Definition: tesseractclass.h:1057
tesseract::Tesseract::RetryWithLanguage
int RetryWithLanguage(const WordData &word_data, WordRecognizer recognizer, bool debug, WERD_RES **in_word, PointerVector< WERD_RES > *best_words)
Definition: control.cpp:903
tesseract::Tesseract::ReportXhtFixResult
void ReportXhtFixResult(bool accept_new_word, float new_x_ht, WERD_RES *word, WERD_RES *new_word)
Definition: control.cpp:1461
tesseract::Tesseract::SetupWordScripts
void SetupWordScripts(BLOCK_LIST *blocks)
tesseract::PointerVector< WERD_RES >
tesseract::Tesseract::superscript_min_y_bottom
double superscript_min_y_bottom
Definition: tesseractclass.h:993
OSResults
Definition: osdetect.h:50
tesseract::Tesseract::crunch_leave_lc_strings
int crunch_leave_lc_strings
Definition: tesseractclass.h:958
tesseract::Tesseract::recog_interactive
bool recog_interactive(PAGE_RES_IT *pr_it)
Definition: control.cpp:77
tesseract::Tesseract::set_unlv_suspects
void set_unlv_suspects(WERD_RES *word)
Definition: output.cpp:272
STRING
Definition: strngs.h:45
tesseract::TesseractStats::doc_outline_errs
int16_t doc_outline_errs
Definition: tesseractclass.h:129
tesseract::SetParamConstraint
SetParamConstraint
Definition: params.h:49
tesseract::Tesseract::crunch_include_numerals
bool crunch_include_numerals
Definition: tesseractclass.h:956
tesseract::Tesseract::noise_maxperword
int noise_maxperword
Definition: tesseractclass.h:871
tesseract::Tesseract::ReportFailedBox
void ReportFailedBox(int boxfile_lineno, TBOX box, const char *box_ch, const char *err_msg)
tesseract::Tesseract::rej_1Il_trust_permuter_type
bool rej_1Il_trust_permuter_type
Definition: tesseractclass.h:1032
WERD_RES
Definition: pageres.h:160
tesseract::Tesseract::tessedit_zero_rejection
bool tessedit_zero_rejection
Definition: tesseractclass.h:1020
tesseract::Tesseract::tessedit_train_line_recognizer
bool tessedit_train_line_recognizer
Definition: tesseractclass.h:791
tesseract::OEM_LSTM_ONLY
Definition: publictypes.h:267
tesseract::Tesseract::suspect_rating_per_ch
double suspect_rating_per_ch
Definition: tesseractclass.h:1017
tesseract::Tesseract::read_config_file
void read_config_file(const char *filename, SetParamConstraint constraint)
Definition: tessedit.cpp:64
tesseract::PSM_SINGLE_BLOCK
Assume a single uniform block of text. (Default.)
Definition: publictypes.h:168
tesseract::Tesseract::ambigs_classify_and_output
void ambigs_classify_and_output(const char *label, PAGE_RES_IT *pr_it, FILE *output_file)
Definition: recogtraining.cpp:211
tesseract::Tesseract::classify_word_pass2
void classify_word_pass2(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
Definition: control.cpp:1571
tesseract::TesseractStats::good_char_count
int16_t good_char_count
Definition: tesseractclass.h:131
tesseract::TesseractStats::write_results_empty_block
bool write_results_empty_block
Definition: tesseractclass.h:140
tesseract::Tesseract::quality_rej_pc
double quality_rej_pc
Definition: tesseractclass.h:876
tesseract::Tesseract::tessedit_enable_dict_correction
bool tessedit_enable_dict_correction
Definition: tesseractclass.h:850
tesseract::Tesseract::bland_unrej
bool bland_unrej
Definition: tesseractclass.h:928
tesseract::Tesseract::SetScaledColor
void SetScaledColor(int factor, Pix *color)
Definition: tesseractclass.h:262
tesseract::Tesseract::debug_noise_removal
int debug_noise_removal
Definition: tesseractclass.h:857
tesseract::Tesseract::tessedit_pageseg_mode
int tessedit_pageseg_mode
Definition: tesseractclass.h:799
tesseract::Tesseract::tess_add_doc_word
void tess_add_doc_word(WERD_CHOICE *word_choice)
Definition: tessbox.cpp:71
tesseract::Tesseract::SegmentPage
int SegmentPage(const STRING *input_file, BLOCK_LIST *blocks, Tesseract *osd_tess, OSResults *osr)
Definition: pagesegmain.cpp:113
tesseract::Tesseract::LSTMRecognizeWord
void LSTMRecognizeWord(const BLOCK &block, ROW *row, WERD_RES *word, PointerVector< WERD_RES > *words)
Definition: linerec.cpp:228
tesseract::TesseractStats::tilde_crunch_written
bool tilde_crunch_written
Definition: tesseractclass.h:137
tesseract::Tesseract::count_alphas
int16_t count_alphas(const WERD_CHOICE &word)
Definition: output.cpp:365
tesseract::Tesseract::rej_1Il_use_dict_word
bool rej_1Il_use_dict_word
Definition: tesseractclass.h:1031
tesseract::Tesseract::quality_rowrej_pc
double quality_rowrej_pc
Definition: tesseractclass.h:929
tesseract::Tesseract::reject_I_1_L
void reject_I_1_L(WERD_RES *word)
Definition: reject.cpp:191
tesseract::Tesseract::ConvertStringToUnichars
bool ConvertStringToUnichars(const char *utf8, GenericVector< UNICHAR_ID > *class_ids)
tesseract::Tesseract::tessedit_image_border
int tessedit_image_border
Definition: tesseractclass.h:1039
tesseract::Tesseract::tessedit_flip_0O
bool tessedit_flip_0O
Definition: tesseractclass.h:1027
ETEXT_DESC
Definition: ocrclass.h:95
tesseract::Tesseract::noise_maxperblob
int noise_maxperblob
Definition: tesseractclass.h:870
tesseract::Tesseract::ok_repeated_ch_non_alphanum_wds
char * ok_repeated_ch_non_alphanum_wds
Definition: tesseractclass.h:1040
tesseract::Tesseract::worst_noise_blob
int16_t worst_noise_blob(WERD_RES *word_res, float *worst_noise_score)
Definition: fixspace.cpp:706
FCOORD
Definition: points.h:187
tesseract::ImageData
Definition: imagedata.h:104
tesseract::Tesseract::superscript_scaledown_ratio
double superscript_scaledown_ratio
Definition: tesseractclass.h:985
tesseract::Tesseract::GetSubAndSuperscriptCandidates
void GetSubAndSuperscriptCandidates(const WERD_RES *word, int *num_rebuilt_leading, ScriptPos *leading_pos, float *leading_certainty, int *num_rebuilt_trailing, ScriptPos *trailing_pos, float *trailing_certainty, float *avg_certainty, float *unlikely_threshold)
Definition: superscript.cpp:252
tesseract::Tesseract::crunch_leave_uc_strings
int crunch_leave_uc_strings
Definition: tesseractclass.h:960
tesseract::Tesseract::acceptable_word_string
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
Definition: control.cpp:1744
tesseract::Tesseract::textord_tabfind_force_vertical_text
bool textord_tabfind_force_vertical_text
Definition: tesseractclass.h:1068
tesseract::Tesseract::tessedit_bigram_debug
int tessedit_bigram_debug
Definition: tesseractclass.h:853
tesseract::TesseractStats::word_count
int32_t word_count
Definition: tesseractclass.h:133
tesseract::Tesseract::fixsp_small_outlines_size
double fixsp_small_outlines_size
Definition: tesseractclass.h:964
double_VAR_H
#define double_VAR_H(name, val, comment)
Definition: params.h:298
tesseract::Tesseract::enable_noise_removal
bool enable_noise_removal
Definition: tesseractclass.h:856
tesseract::Tesseract::rejection_passes
void rejection_passes(PAGE_RES *page_res, ETEXT_DESC *monitor, const TBOX *target_word_box, const char *word_config)
Definition: control.cpp:612
tesseract::Tesseract::crunch_pot_poor_cert
double crunch_pot_poor_cert
Definition: tesseractclass.h:941
tesseract::Tesseract::script_pos_pass
void script_pos_pass(PAGE_RES *page_res)
Definition: control.cpp:733
tesseract::Tesseract::get_sub_lang
Tesseract * get_sub_lang(int index) const
Definition: tesseractclass.h:279
tesseract::Tesseract::tessedit_row_rej_good_docs
bool tessedit_row_rej_good_docs
Definition: tesseractclass.h:921
tesseract::WordData
Definition: tesseractclass.h:144
C_BLOB
Definition: stepblob.h:36
tesseract::Tesseract::tessedit_preserve_min_wd_len
int tessedit_preserve_min_wd_len
Definition: tesseractclass.h:919
tesseract::Tesseract::AutoPageSeg
int AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks, BLOBNBOX_LIST *diacritic_blobs, Tesseract *osd_tess, OSResults *osr)
Definition: pagesegmain.cpp:214
tesseract::Tesseract::PreenXHeights
void PreenXHeights(BLOCK_LIST *block_list)
Definition: applybox.cpp:180
tesseract::WordData::row
ROW * row
Definition: tesseractclass.h:156
tesseract::Tesseract::test_pt_x
double test_pt_x
Definition: tesseractclass.h:888
ratngs.h
tesseract::Tesseract::lstm_choice_iterations
int lstm_choice_iterations
Definition: tesseractclass.h:1090
tesseract::Tesseract::tessedit_adaption_debug
bool tessedit_adaption_debug
Definition: tesseractclass.h:821
tesseract::Tesseract::chs_trailing_punct2
char * chs_trailing_punct2
Definition: tesseractclass.h:875
tesseract::Tesseract::BestPix
Pix * BestPix() const
Definition: tesseractclass.h:231
tesseract::Tesseract::nn_recover_rejects
void nn_recover_rejects(WERD_RES *word, ROW *row)
tesseract::Tesseract::pgeditor_main
void pgeditor_main(int width, int height, PAGE_RES *page_res)
Definition: pgedit.cpp:378
tesseract::Tesseract::scaled_factor
int scaled_factor() const
Definition: tesseractclass.h:259
tesseract::WordData::block
BLOCK * block
Definition: tesseractclass.h:157
tesseract::Tesseract::SetupWordPassN
void SetupWordPassN(int pass_n, WordData *word)
Definition: control.cpp:177
tesseract::WordData::word
WERD_RES * word
Definition: tesseractclass.h:155
tesseract::Tesseract::crunch_pot_indicators
int crunch_pot_indicators
Definition: tesseractclass.h:951
tesseract::Tesseract::debug_x_ht_level
int debug_x_ht_level
Definition: tesseractclass.h:872
tesseract::Tesseract::TestNewNormalization
bool TestNewNormalization(int original_misfits, float baseline_shift, float new_x_ht, WERD_RES *word, BLOCK *block, ROW *row)
Definition: control.cpp:1518
tesseract::Tesseract::crunch_early_convert_bad_unlv_chs
bool crunch_early_convert_bad_unlv_chs
Definition: tesseractclass.h:935
tesseract::OcrEngineMode
OcrEngineMode
Definition: publictypes.h:265
tesseract::Tesseract::textord_tabfind_vertical_text
bool textord_tabfind_vertical_text
Definition: tesseractclass.h:1066
tesseract::Tesseract::init_tesseract_lm
int init_tesseract_lm(const char *arg0, const char *textbase, const char *language, TessdataManager *mgr)
Definition: tessedit.cpp:469
tesseract::Tesseract::build_menu_new
SVMenuNode * build_menu_new()
Definition: pgedit.cpp:298
genericvector.h
tesseract::Tesseract::tessedit_resegment_from_line_boxes
bool tessedit_resegment_from_line_boxes
Definition: tesseractclass.h:785
tesseract::Tesseract::crunch_small_outlines_size
double crunch_small_outlines_size
Definition: tesseractclass.h:949
tesseract::Tesseract::tessedit_make_boxes_from_boxes
bool tessedit_make_boxes_from_boxes
Definition: tesseractclass.h:789
tesseract::Tesseract::ApplyBoxTraining
void ApplyBoxTraining(const STRING &fontname, PAGE_RES *page_res)
tesseract::Tesseract::unrecognised_char
char * unrecognised_char
Definition: tesseractclass.h:1013
tesseract::Tesseract::crunch_del_max_ht
double crunch_del_max_ht
Definition: tesseractclass.h:945
tesseract::Tesseract::ResegmentWordBox
bool ResegmentWordBox(BLOCK_LIST *block_list, const TBOX &box, const TBOX *next_box, const char *correct_text)
tesseract::Tesseract::TrainedXheightFix
bool TrainedXheightFix(WERD_RES *word, BLOCK *block, ROW *row)
Definition: control.cpp:1484
tesseract::Tesseract::tessedit_tess_adaption_mode
int tessedit_tess_adaption_mode
Definition: tesseractclass.h:883
tesseract::ScriptPos
ScriptPos
Definition: ratngs.h:250
debugpixa.h
tesseract::Tesseract::crunch_leave_ok_strings
bool crunch_leave_ok_strings
Definition: tesseractclass.h:952
tesseract::Tesseract::set_pix_grey
void set_pix_grey(Pix *grey_pix)
Definition: tesseractclass.h:206
BLOCK
Definition: ocrblock.h:28
tesseract::Tesseract::tessedit_prefer_joined_punct
bool tessedit_prefer_joined_punct
Definition: tesseractclass.h:965
tesseract::Tesseract::debug_fix_space_level
int debug_fix_space_level
Definition: tesseractclass.h:967
tesseract::Tesseract::count_alphanums
int16_t count_alphanums(const WERD_CHOICE &word)
Definition: output.cpp:375
tesseract::Tesseract::fp_eval_word_spacing
int16_t fp_eval_word_spacing(WERD_RES_LIST &word_res_list)
Definition: fixspace.cpp:856
tesseract::Tesseract::pageseg_apply_music_mask
bool pageseg_apply_music_mask
Definition: tesseractclass.h:1097
tesseract::Tesseract::TidyUp
void TidyUp(PAGE_RES *page_res)
tesseract::Tesseract::word_bln_display
bool word_bln_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:717
tesseract::Tesseract::tessedit_enable_doc_dict
bool tessedit_enable_doc_dict
Definition: tesseractclass.h:844
tesseract::Tesseract::interactive_display_mode
bool interactive_display_mode
Definition: tesseractclass.h:1047
tesseract::Tesseract::suspect_constrain_1Il
bool suspect_constrain_1Il
Definition: tesseractclass.h:1016
tesseract::Tesseract::SubAndSuperscriptFix
bool SubAndSuperscriptFix(WERD_RES *word_res)
Definition: superscript.cpp:100
tesseract::Tesseract::rej_use_tess_blanks
bool rej_use_tess_blanks
Definition: tesseractclass.h:1034
tesseract::TesseractStats::last_char_was_newline
bool last_char_was_newline
Definition: tesseractclass.h:138
tesseract::Tesseract::tessedit_debug_fonts
bool tessedit_debug_fonts
Definition: tesseractclass.h:845
tesseract::Tesseract::test_pt_y
double test_pt_y
Definition: tesseractclass.h:889
tesseract::Tesseract::safe_dict_word
int16_t safe_dict_word(const WERD_RES *werd_res)
Definition: reject.cpp:605
tesseract::Tesseract::GetRectImage
ImageData * GetRectImage(const TBOX &box, const BLOCK &block, int padding, TBOX *revised_box) const
Definition: linerec.cpp:169
tesseract::Tesseract::acceptable_number_string
bool acceptable_number_string(const char *s, const char *lengths)
Definition: output.cpp:386
tesseract::Tesseract::tessedit_test_adaption
bool tessedit_test_adaption
Definition: tesseractclass.h:886
tesseract::Tesseract::tessedit_rejection_debug
bool tessedit_rejection_debug
Definition: tesseractclass.h:1026
tesseract::Tesseract::tessedit_resegment_from_boxes
bool tessedit_resegment_from_boxes
Definition: tesseractclass.h:783
tesseract::Tesseract::fix_fuzzy_space_list
void fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *block)
Definition: fixspace.cpp:170
tesseract::Tesseract::tessedit_reject_bad_qual_wds
bool tessedit_reject_bad_qual_wds
Definition: tesseractclass.h:924
tesseract::Tesseract::dont_allow_1Il
void dont_allow_1Il(WERD_RES *word)
Definition: reject.cpp:524
tesseract::Tesseract::fixspace_thinks_word_done
bool fixspace_thinks_word_done(WERD_RES *word)
Definition: fixspace.cpp:529
GARBAGE_LEVEL
GARBAGE_LEVEL
Definition: docqual.h:27
tesseract::Tesseract::ApplyBoxes
PAGE_RES * ApplyBoxes(const STRING &fname, bool find_segmentation, BLOCK_LIST *block_list)
Definition: applybox.cpp:108
tesseract::Tesseract::tessedit_char_whitelist
char * tessedit_char_whitelist
Definition: tesseractclass.h:805
tesseract::WordData::WordData
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
Definition: tesseractclass.h:152
tesseract::Tesseract::non_O_upper
bool non_O_upper(const UNICHARSET &ch_set, UNICHAR_ID unichar_id)
Definition: reject.cpp:783
tesseract::Tesseract::crunch_leave_accept_strings
bool crunch_leave_accept_strings
Definition: tesseractclass.h:955
tesseract::Tesseract::rej_trust_doc_dawg
bool rej_trust_doc_dawg
Definition: tesseractclass.h:1030
tesseract::Tesseract::noise_cert_disjoint
double noise_cert_disjoint
Definition: tesseractclass.h:863
tesseract::Tesseract::tessedit_reject_mode
int tessedit_reject_mode
Definition: tesseractclass.h:1025
tesseract::TesseractStats::last_char_was_tilde
bool last_char_was_tilde
Definition: tesseractclass.h:139
tesseract::Tesseract::PrerecAllWordsPar
void PrerecAllWordsPar(const GenericVector< WordData > &words)
Definition: par_control.cpp:38
tesseract::Tesseract::word_adaptable
bool word_adaptable(WERD_RES *word, uint16_t mode)
Definition: adaptions.cpp:50
tesseract::Tesseract::tessedit_preserve_row_rej_perfect_wds
bool tessedit_preserve_row_rej_perfect_wds
Definition: tesseractclass.h:913
tesseract::Tesseract::end_tesseract
void end_tesseract()
Definition: tessedit.cpp:482
tesseract::Tesseract::tessedit_write_unlv
bool tessedit_write_unlv
Definition: tesseractclass.h:997
tesseract::Tesseract::rej_use_good_perm
bool rej_use_good_perm
Definition: tesseractclass.h:1035
tesseract::Tesseract::tessedit_load_sublangs
char * tessedit_load_sublangs
Definition: tesseractclass.h:1051
devanagari_processing.h
tesseract::Tesseract::tessedit_dump_pageseg_images
bool tessedit_dump_pageseg_images
Definition: tesseractclass.h:793
tesseract::Tesseract::tessedit_zero_kelvin_rejection
bool tessedit_zero_kelvin_rejection
Definition: tesseractclass.h:1024
tesseract::OEM_DEFAULT
Definition: publictypes.h:271
tesseract::TesseractStats::TesseractStats
TesseractStats()
Definition: tesseractclass.h:113
tesseract::Tesseract::word_char_quality
void word_char_quality(WERD_RES *word, int16_t *match_count, int16_t *accepted_match_count)
Definition: docqual.cpp:95
publictypes.h
tesseract::Tesseract::tessedit_override_permuter
bool tessedit_override_permuter
Definition: tesseractclass.h:1049
tesseract::Tesseract::outlines_2
char * outlines_2
Definition: tesseractclass.h:897
tesseract::Tesseract::quality_blob_pc
double quality_blob_pc
Definition: tesseractclass.h:877
tesseract::Tesseract::PrepareForPageseg
void PrepareForPageseg()
Definition: tesseractclass.cpp:641
tesseract::Tesseract::suspect_level
int suspect_level
Definition: tesseractclass.h:1014
tesseract::Tesseract::crunch_del_low_word
double crunch_del_low_word
Definition: tesseractclass.h:948
UNICHARSET
Definition: unicharset.h:145
tesseract::Tesseract::noise_cert_basechar
double noise_cert_basechar
Definition: tesseractclass.h:860
tesseract::ShiroRekhaSplitter
Definition: devanagari_processing.h:71
tesseract::Tesseract::getDict
Dict & getDict() override
Definition: tesseractclass.cpp:564
tesseract::Tesseract::tessedit_ambigs_training
bool tessedit_ambigs_training
Definition: tesseractclass.h:809
tesseract::Tesseract::mutable_textord
Textord * mutable_textord()
Definition: tesseractclass.h:269
tesseract::Tesseract::blob_noise_score
float blob_noise_score(TBLOB *blob)
Definition: fixspace.cpp:786
tesseract::Tesseract::tessedit_whole_wd_rej_row_percent
double tessedit_whole_wd_rej_row_percent
Definition: tesseractclass.h:909
tesseract::Tesseract::RecogAllWordsPassN
bool RecogAllWordsPassN(int pass_n, ETEXT_DESC *monitor, PAGE_RES_IT *pr_it, GenericVector< WordData > *words)
Definition: control.cpp:213
tesseract::Tesseract::init_tesseract_lang_data
bool init_tesseract_lang_data(const char *arg0, const char *textbase, const char *language, OcrEngineMode oem, char **configs, int configs_size, const GenericVector< STRING > *vars_vec, const GenericVector< STRING > *vars_values, bool set_only_init_params, TessdataManager *mgr)
Definition: tessedit.cpp:95
tesseract::Tesseract::AnyTessLang
bool AnyTessLang() const
Definition: tesseractclass.h:283
tesseract::Tesseract::crunch_long_repetitions
int crunch_long_repetitions
Definition: tesseractclass.h:961
tesseract::Tesseract::tessedit_minimal_rej_pass1
bool tessedit_minimal_rej_pass1
Definition: tesseractclass.h:885
textord.h
tesseract::Tesseract::crunch_poor_garbage_rate
double crunch_poor_garbage_rate
Definition: tesseractclass.h:939
tesseract::Tesseract::do_re_display
void do_re_display(bool(tesseract::Tesseract::*word_painter)(PAGE_RES_IT *pr_it))
Definition: pgedit.cpp:349
tesseract::Tesseract::applybox_page
int applybox_page
Definition: tesseractclass.h:824
tesseract::Tesseract::tess_acceptable_word
bool tess_acceptable_word(WERD_RES *word)
Definition: tessbox.cpp:61
tesseract::Tesseract::tessedit_create_alto
bool tessedit_create_alto
Definition: tesseractclass.h:1000
tesseract::Tesseract::tessedit_good_quality_unrej
bool tessedit_good_quality_unrej
Definition: tesseractclass.h:899
tesseract::WordData::WordData
WordData(const PAGE_RES_IT &page_res_it)
Definition: tesseractclass.h:147
tesseract::Tesseract::bidi_debug
int bidi_debug
Definition: tesseractclass.h:822
tesseract::Tesseract::source_resolution
int source_resolution() const
Definition: tesseractclass.h:244
tesseract::Tesseract::ImageHeight
int ImageHeight() const
Definition: tesseractclass.h:253
tesseract::Tesseract::SetBlackAndWhitelist
void SetBlackAndWhitelist()
Definition: tesseractclass.cpp:614
tesseract::Tesseract::rej_whole_of_mostly_reject_word_fract
double rej_whole_of_mostly_reject_word_fract
Definition: tesseractclass.h:1038
tesseract::Tesseract::~Tesseract
~Tesseract() override
Definition: tesseractclass.cpp:553
tesseract::Tesseract::tessedit_dont_blkrej_good_wds
bool tessedit_dont_blkrej_good_wds
Definition: tesseractclass.h:915
tesseract::Tesseract::non_0_digit
bool non_0_digit(const UNICHARSET &ch_set, UNICHAR_ID unichar_id)
Definition: reject.cpp:787
tesseract::Tesseract::bigram_correction_pass
void bigram_correction_pass(PAGE_RES *page_res)
Definition: control.cpp:467
tesseract::Tesseract::garbage_word
GARBAGE_LEVEL garbage_word(WERD_RES *word, bool ok_dict_word)
Definition: docqual.cpp:658
tesseract::Tesseract::classify_word_pass1
void classify_word_pass1(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
Definition: control.cpp:1400
tesseract
Definition: baseapi.h:65
tesseract::TesseractStats::dict_words
int32_t dict_words
Definition: tesseractclass.h:134
tesseract::WordData::lang_words
PointerVector< WERD_RES > lang_words
Definition: tesseractclass.h:159
tesseract::TesseractStats::dump_words_str
STRING dump_words_str
Definition: tesseractclass.h:135
tesseract::Tesseract::textord
const Textord & textord() const
Definition: tesseractclass.h:266
tesseract::Tesseract::process_cmd_win_event
bool process_cmd_win_event(int32_t cmd_event, char *new_value)
Definition: pgedit.cpp:415
tesseract::Tesseract::crunch_early_merge_tess_fails
bool crunch_early_merge_tess_fails
Definition: tesseractclass.h:934
tesseract::Tesseract::AnyLSTMLang
bool AnyLSTMLang() const
Definition: tesseractclass.h:293
tesseract::Tesseract::mutable_pix_binary
Pix ** mutable_pix_binary()
Definition: tesseractclass.h:196
tesseract::Tesseract::tessedit_parallelize
int tessedit_parallelize
Definition: tesseractclass.h:1074
INT_VAR_H
#define INT_VAR_H(name, val, comment)
Definition: params.h:292
tesseract::Tesseract::tessedit_upper_flip_hyphen
double tessedit_upper_flip_hyphen
Definition: tesseractclass.h:1029
tesseract::Tesseract::x_ht_min_change
int x_ht_min_change
Definition: tesseractclass.h:971
tesseract::Tesseract::tessedit_init_config_only
bool tessedit_init_config_only
Definition: tesseractclass.h:1064
tesseract::Tesseract::init_tesseract_internal
int init_tesseract_internal(const char *arg0, const char *textbase, const char *language, OcrEngineMode oem, char **configs, int configs_size, const GenericVector< STRING > *vars_vec, const GenericVector< STRING > *vars_values, bool set_only_init_params, TessdataManager *mgr)
Definition: tessedit.cpp:402
tesseract::Tesseract::ClassifyBlobAsWord
float ClassifyBlobAsWord(int pass_n, PAGE_RES_IT *pr_it, C_BLOB *blob, STRING *best_str, float *c2)
Definition: control.cpp:1269
PAGE_RES
Definition: pageres.h:73
tesseract::Tesseract::MaximallyChopWord
void MaximallyChopWord(const GenericVector< TBOX > &boxes, BLOCK *block, ROW *row, WERD_RES *word_res)
Definition: applybox.cpp:242
tesseract::Tesseract::process_selected_words
void process_selected_words(PAGE_RES *page_res, TBOX &selection_box, bool(tesseract::Tesseract::*word_processor)(PAGE_RES_IT *pr_it))
Definition: pagewalk.cpp:45
tesseract::DebugPixa
Definition: debugpixa.h:10
tesseract::Tesseract::tessedit_lower_flip_hyphen
double tessedit_lower_flip_hyphen
Definition: tesseractclass.h:1028
tesseract::Tesseract::applybox_learn_chars_and_char_frags_mode
bool applybox_learn_chars_and_char_frags_mode
Definition: tesseractclass.h:832
tesseract::Tesseract::word_display
bool word_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:749
tesseract::Tesseract::split_word
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
Definition: tfacepp.cpp:174
tesseract::Tesseract::classify_word_and_language
void classify_word_and_language(int pass_n, PAGE_RES_IT *pr_it, WordData *word_data)
Definition: control.cpp:1318
tesseract::Tesseract::tessedit_page_number
int tessedit_page_number
Definition: tesseractclass.h:1045
tesseract::Tesseract::AssignDiacriticsToNewBlobs
void AssignDiacriticsToNewBlobs(const GenericVector< C_OUTLINE * > &outlines, int pass, WERD *real_word, PAGE_RES_IT *pr_it, GenericVector< bool > *word_wanted, GenericVector< C_BLOB * > *target_blobs)
Definition: control.cpp:1063
tesseract::Tesseract::textord_tabfind_show_vlines
bool textord_tabfind_show_vlines
Definition: tesseractclass.h:1058
tesseract::Tesseract::tessedit_debug_doc_rejection
bool tessedit_debug_doc_rejection
Definition: tesseractclass.h:925
tesseract::Tesseract::blob_feature_display
void blob_feature_display(PAGE_RES *page_res, const TBOX &selection_box)
Definition: pgedit.cpp:952
tesseract::Tesseract::paragraph_text_based
bool paragraph_text_based
Definition: tesseractclass.h:894
tesseract::Tesseract::ocr_devanagari_split_strategy
int ocr_devanagari_split_strategy
Definition: tesseractclass.h:817
UNICHAR_ID
int UNICHAR_ID
Definition: unichar.h:36
tesseract::Tesseract::tessedit_write_images
bool tessedit_write_images
Definition: tesseractclass.h:1046
tesseract::Tesseract::flip_hyphens
void flip_hyphens(WERD_RES *word)
Definition: reject.cpp:614
tesseract::Tesseract::noise_cert_factor
double noise_cert_factor
Definition: tesseractclass.h:869
GenericVector
Definition: baseapi.h:40
tesseract::Tesseract::potential_word_crunch
bool potential_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level, bool ok_dict_word)
Definition: docqual.cpp:520
tesseract::Tesseract::tessedit_char_blacklist
char * tessedit_char_blacklist
Definition: tesseractclass.h:804
tesseract::Tesseract::crunch_del_min_width
double crunch_del_min_width
Definition: tesseractclass.h:946
tesseract::Tesseract::num_sub_langs
int num_sub_langs() const
Definition: tesseractclass.h:276
tesseract::Tesseract::crunch_del_min_ht
double crunch_del_min_ht
Definition: tesseractclass.h:944
tesseract::Tesseract::TrainFromBoxes
void TrainFromBoxes(const GenericVector< TBOX > &boxes, const GenericVector< STRING > &texts, BLOCK_LIST *block_list, DocumentData *training_data)
Definition: linerec.cpp:80
PAGE_RES_IT
Definition: pageres.h:668
tesseract::Tesseract::recog_word_recursive
void recog_word_recursive(WERD_RES *word)
Definition: tfacepp.cpp:104
tesseract::Tesseract::min_characters_to_try
int min_characters_to_try
Definition: tesseractclass.h:1012
tesseract::Tesseract::first_alphanum_offset
int16_t first_alphanum_offset(const char *word, const char *word_lengths)
Definition: reject.cpp:481
tesseract::Tesseract::terrible_word_crunch
bool terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level)
Definition: docqual.cpp:482
tesseract::Tesseract::Clear
void Clear()
Definition: tesseractclass.cpp:574
tesseract::Dict
Definition: dict.h:91
tesseract::Tesseract::textonly_pdf
bool textonly_pdf
Definition: tesseractclass.h:1008
tesseract::Tesseract::suspect_accept_rating
double suspect_accept_rating
Definition: tesseractclass.h:1018
tesseract::Tesseract::hocr_char_boxes
bool hocr_char_boxes
Definition: tesseractclass.h:933
tesseract::Tesseract::Tesseract
Tesseract()
Definition: tesseractclass.cpp:52
tesseract::Tesseract::jpg_quality
int jpg_quality
Definition: tesseractclass.h:1009
tesseract::Tesseract::SetupApplyBoxes
PAGE_RES * SetupApplyBoxes(const GenericVector< TBOX > &boxes, BLOCK_LIST *block_list)
Definition: applybox.cpp:206
tesseract::Tesseract::tessedit_dump_choices
bool tessedit_dump_choices
Definition: tesseractclass.h:837
tesseract::Tesseract::tessedit_create_lstmbox
bool tessedit_create_lstmbox
Definition: tesseractclass.h:1002
tesseract::Tesseract::tessedit_char_unblacklist
char * tessedit_char_unblacklist
Definition: tesseractclass.h:807
tesseract::Tesseract::TrainLineRecognizer
bool TrainLineRecognizer(const STRING &input_imagename, const STRING &output_basename, BLOCK_LIST *block_list)
Definition: linerec.cpp:43
tesseract::Tesseract::tessedit_timing_debug
bool tessedit_timing_debug
Definition: tesseractclass.h:838
tesseract::Tesseract::outlines_odd
char * outlines_odd
Definition: tesseractclass.h:896
tesseract::Tesseract::nn_match_word
void nn_match_word(WERD_RES *word, ROW *row)
tesseract::Tesseract::rej_use_tess_accepted
bool rej_use_tess_accepted
Definition: tesseractclass.h:1033
tesseract::Tesseract::process_image_event
void process_image_event(const SVEvent &event)
Definition: pgedit.cpp:587
tesseract::Tesseract::set_pix_original
void set_pix_original(Pix *original_pix)
Definition: tesseractclass.h:214
tesseract::Tesseract::tessedit_enable_bigram_correction
bool tessedit_enable_bigram_correction
Definition: tesseractclass.h:848
tesseract::Tesseract::count_outline_errs
int16_t count_outline_errs(char c, int16_t outline_count)
Definition: docqual.cpp:121
tesseract::TesseractStats::adaption_word_number
int32_t adaption_word_number
Definition: tesseractclass.h:127
tesseract::Tesseract::SetupUniversalFontIds
void SetupUniversalFontIds()
Definition: tessedit.cpp:447
TBLOB
Definition: blobs.h:282
tesseract::Tesseract::subscript_max_y_top
double subscript_max_y_top
Definition: tesseractclass.h:989
tesseract::Tesseract::match_word_pass_n
void match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK *block)
Definition: control.cpp:1629
tesseract::Tesseract::multilang_debug_level
int multilang_debug_level
Definition: tesseractclass.h:890
BOOL_VAR_H
#define BOOL_VAR_H(name, val, comment)
Definition: params.h:294
SVMenuNode
Definition: svmnode.h:35
tesseract::PageSegMode
PageSegMode
Definition: publictypes.h:159
tesseract::Tesseract::textord_tabfind_vertical_text_ratio
double textord_tabfind_vertical_text_ratio
Definition: tesseractclass.h:1071
tesseract::Tesseract::numeric_punctuation
char * numeric_punctuation
Definition: tesseractclass.h:968
WERD
Definition: werd.h:55
tesseract::Tesseract::font_recognition_pass
void font_recognition_pass(PAGE_RES *page_res)
Definition: control.cpp:2036
tesseract::Tesseract::word_deletable
CRUNCH_MODE word_deletable(WERD_RES *word, int16_t &delete_mode)
Definition: docqual.cpp:875
tesseract::Tesseract::tessedit_reject_row_percent
double tessedit_reject_row_percent
Definition: tesseractclass.h:906
tesseract::Tesseract::pix_binary
Pix * pix_binary() const
Definition: tesseractclass.h:200
tesseract::Tesseract::repeated_nonalphanum_wd
bool repeated_nonalphanum_wd(WERD_RES *word, ROW *row)
Definition: reject.cpp:580
tesseract::Tesseract::reject_mostly_rejects
void reject_mostly_rejects(WERD_RES *word)
Definition: reject.cpp:571
tesseract::Textord
Definition: textord.h:68
unichar.h
tesseract::TesseractStats::doc_good_char_quality
int16_t doc_good_char_quality
Definition: tesseractclass.h:132
ROW
Definition: ocrrow.h:35
tesseract::Tesseract::blamer_pass
void blamer_pass(PAGE_RES *page_res)
Definition: control.cpp:709
tesseract::LSTMRecognizer
Definition: lstmrecognizer.h:53
SVEvent
Definition: scrollview.h:60
tesseract::Tesseract::convert_bad_unlv_chs
void convert_bad_unlv_chs(WERD_RES *word_res)
Definition: docqual.cpp:638
tesseract::Tesseract::ReSegmentByClassification
void ReSegmentByClassification(PAGE_RES *page_res)
tesseract::Tesseract::tessedit_reject_doc_percent
double tessedit_reject_doc_percent
Definition: tesseractclass.h:902
tesseract::Tesseract::textord_tabfind_aligned_gap_fraction
double textord_tabfind_aligned_gap_fraction
Definition: tesseractclass.h:1073
tesseract::Tesseract::dictionary_correction_pass
void dictionary_correction_pass(PAGE_RES *page_res)
Definition: control.cpp:2092
tesseract::Tesseract::one_ell_conflict
bool one_ell_conflict(WERD_RES *word_res, bool update_map)
Definition: reject.cpp:291
tesseract::Tesseract::tilde_delete
void tilde_delete(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:568
tesseract::Tesseract::CorrectClassifyWords
void CorrectClassifyWords(PAGE_RES *page_res)
tesseract::Tesseract::set_done
void set_done(WERD_RES *word, int16_t pass)
tesseract::Tesseract::SetupAllWordsPassN
void SetupAllWordsPassN(int pass_n, const TBOX *target_word_box, const char *word_config, PAGE_RES *page_res, GenericVector< WordData > *words)
Definition: control.cpp:154
tesseract::Tesseract::set_source_resolution
void set_source_resolution(int ppi)
Definition: tesseractclass.h:247
tesseract::Tesseract::crunch_del_high_word
double crunch_del_high_word
Definition: tesseractclass.h:947
tesseract::Tesseract::SelectGoodDiacriticOutlines
bool SelectGoodDiacriticOutlines(int pass, float certainty_threshold, PAGE_RES_IT *pr_it, C_BLOB *blob, const GenericVector< C_OUTLINE * > &outlines, int num_outlines, GenericVector< bool > *ok_outlines)
Definition: control.cpp:1139
tesseract::Tesseract::scaled_color
Pix * scaled_color() const
Definition: tesseractclass.h:256
tesseract::Tesseract::fix_fuzzy_spaces
void fix_fuzzy_spaces(ETEXT_DESC *monitor, int32_t word_count, PAGE_RES *page_res)
Definition: fixspace.cpp:73
tesseract::Tesseract::suspect_short_words
int suspect_short_words
Definition: tesseractclass.h:1015
tesseract::Tesseract::conflict_set_I_l_1
char * conflict_set_I_l_1
Definition: tesseractclass.h:1041
tesseract::TesseractStats::doc_char_quality
int16_t doc_char_quality
Definition: tesseractclass.h:130
tesseract::WordData::WordData
WordData()
Definition: tesseractclass.h:145
CRUNCH_MODE
CRUNCH_MODE
Definition: pageres.h:150
tesseract::Tesseract::tessedit_fix_hyphens
bool tessedit_fix_hyphens
Definition: tesseractclass.h:842
tesseract::Tesseract::set_pix_thresholds
void set_pix_thresholds(Pix *thresholds)
Definition: tesseractclass.h:240
tesseract::Tesseract::recog_all_words
bool recog_all_words(PAGE_RES *page_res, ETEXT_DESC *monitor, const TBOX *target_word_box, const char *word_config, int dopasses)
Definition: control.cpp:302
tesseract::DocumentData
Definition: imagedata.h:208
tesseract::Tesseract::tessedit_word_for_word
bool tessedit_word_for_word
Definition: tesseractclass.h:1022
tesseract::Tesseract::fix_rep_char
void fix_rep_char(PAGE_RES_IT *page_res_it)
Definition: control.cpp:1705
tesseract::Tesseract::SearchWords
void SearchWords(PointerVector< WERD_RES > *words)
Definition: linerec.cpp:259
tesseract::Tesseract::textord_equation_detect
bool textord_equation_detect
Definition: tesseractclass.h:1065
tesseract::Tesseract::paragraph_debug_level
int paragraph_debug_level
Definition: tesseractclass.h:891
tesseract::Tesseract::unrej_good_chs
void unrej_good_chs(WERD_RES *word)
Definition: docqual.cpp:112
tesseract::Tesseract::ImageWidth
int ImageWidth() const
Definition: tesseractclass.h:250
tesseract::Tesseract::tessedit_unrej_any_wd
bool tessedit_unrej_any_wd
Definition: tesseractclass.h:841
tesseract::Tesseract::reject_edge_blobs
void reject_edge_blobs(WERD_RES *word)
Definition: reject.cpp:263
tesseract::Tesseract::superscript_debug
int superscript_debug
Definition: tesseractclass.h:972
tesseract::Tesseract::rej_use_sensible_wd
bool rej_use_sensible_wd
Definition: tesseractclass.h:1036
tesseract::Tesseract::init_recog_training
FILE * init_recog_training(const STRING &fname)
Definition: recogtraining.cpp:36
tesseract::Tesseract::tess_segment_pass_n
void tess_segment_pass_n(int pass_n, WERD_RES *word)
Definition: tessbox.cpp:31
tesseract::Tesseract::tessedit_create_txt
bool tessedit_create_txt
Definition: tesseractclass.h:998
tesseract::Tesseract::get_rep_char
UNICHAR_ID get_rep_char(WERD_RES *word)
Definition: output.cpp:251
tesseract::Tesseract::doc_and_block_rejection
void doc_and_block_rejection(PAGE_RES_IT &page_res_it, bool good_quality_doc)
Definition: docqual.cpp:225
tesseract::Tesseract::digit_or_numeric_punct
bool digit_or_numeric_punct(WERD_RES *word, int char_position)
Definition: fixspace.cpp:369
tesseract::Tesseract::lstm_use_matrix
bool lstm_use_matrix
Definition: tesseractclass.h:895
tesseract::Tesseract::unlv_tilde_crunching
bool unlv_tilde_crunching
Definition: tesseractclass.h:930
tesseract::Tesseract::tessedit_reject_block_percent
double tessedit_reject_block_percent
Definition: tesseractclass.h:904
tesseract::Tesseract::unrej_good_quality_words
void unrej_good_quality_words(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:154
tesseract::Tesseract::word_blank_and_set_display
bool word_blank_and_set_display(PAGE_RES_IT *pr_its)
Definition: pgedit.cpp:705
tesseract::Tesseract::word_set_display
bool word_set_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:937
tesseract::Tesseract::rej_alphas_in_number_perm
bool rej_alphas_in_number_perm
Definition: tesseractclass.h:1037
tesseract::Tesseract::tessedit_preserve_blk_rej_perfect_wds
bool tessedit_preserve_blk_rej_perfect_wds
Definition: tesseractclass.h:911
tesseract::Tesseract::ResetAdaptiveClassifier
void ResetAdaptiveClassifier()
Definition: tesseractclass.cpp:597
tesseract::Tesseract::GetLineData
ImageData * GetLineData(const TBOX &line_box, const GenericVector< TBOX > &boxes, const GenericVector< STRING > &texts, int start_box, int end_box, const BLOCK &block)
Definition: linerec.cpp:135
tesseract::Tesseract::tessedit_debug_block_rejection
bool tessedit_debug_block_rejection
Definition: tesseractclass.h:846
tesseract::Tesseract::TrySuperscriptSplits
WERD_RES * TrySuperscriptSplits(int num_chopped_leading, float leading_certainty, ScriptPos leading_pos, int num_chopped_trailing, float trailing_certainty, ScriptPos trailing_pos, WERD_RES *word, bool *is_good, int *retry_leading, int *retry_trailing)
Definition: superscript.cpp:381
tesseract::Tesseract::tessedit_minimal_rejection
bool tessedit_minimal_rejection
Definition: tesseractclass.h:1019
BlamerBundle
Definition: blamer.h:103
tesseract::Tesseract::word_dumper
bool word_dumper(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:913
tesseract::Tesseract::join_words
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
Definition: tfacepp.cpp:231
tesseract::Tesseract::tessedit_write_block_separators
bool tessedit_write_block_separators
Definition: tesseractclass.h:995
tesseract::Tesseract::tessedit_use_primary_params_model
bool tessedit_use_primary_params_model
Definition: tesseractclass.h:1053
tesseract::Tesseract::reskew
const FCOORD & reskew() const
Definition: tesseractclass.h:192
tesseract::OEM_TESSERACT_ONLY
Definition: publictypes.h:266
tesseract::Tesseract::tessedit_ocr_engine_mode
int tessedit_ocr_engine_mode
Definition: tesseractclass.h:802
tesseract::Tesseract::noise_cert_punc
double noise_cert_punc
Definition: tesseractclass.h:866
tesseract::TesseractStats
Definition: tesseractclass.h:112
tesseract::Tesseract::fixsp_non_noise_limit
int fixsp_non_noise_limit
Definition: tesseractclass.h:963
tesseract::Tesseract::crunch_debug
int crunch_debug
Definition: tesseractclass.h:962
tesseract::ColumnFinder
Definition: colfind.h:50
tesseract::Tesseract::tessedit_create_tsv
bool tessedit_create_tsv
Definition: tesseractclass.h:1003
tesseract::Tesseract::test_pt
bool test_pt
Definition: tesseractclass.h:887
tesseract::Tesseract::crunch_accept_ok
bool crunch_accept_ok
Definition: tesseractclass.h:953
tesseract::Tesseract::preserve_interword_spaces
bool preserve_interword_spaces
Definition: tesseractclass.h:1076
tesseract::Tesseract::ResegmentCharBox
bool ResegmentCharBox(PAGE_RES *page_res, const TBOX *prev_box, const TBOX &box, const TBOX *next_box, const char *correct_text)
Definition: applybox.cpp:328
tessdatamanager.h
tesseract::Tesseract::ClassifyBlobPlusOutlines
float ClassifyBlobPlusOutlines(const GenericVector< bool > &ok_outlines, const GenericVector< C_OUTLINE * > &outlines, int pass_n, PAGE_RES_IT *pr_it, C_BLOB *blob, STRING *best_str)
Definition: control.cpp:1225
tesseract::Tesseract::user_defined_dpi
int user_defined_dpi
Definition: tesseractclass.h:1010
tesseract::Tesseract::fix_sp_fp_word
void fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK *block)
Definition: fixspace.cpp:561
tesseract::Tesseract::match_current_words
void match_current_words(WERD_RES_LIST &words, ROW *row, BLOCK *block)
Definition: fixspace.cpp:222
tesseract::WordRecognizer
void(Tesseract::*)(const WordData &, WERD_RES **, PointerVector< WERD_RES > *) WordRecognizer
Definition: tesseractclass.h:170
tesseract::Tesseract::write_results
void write_results(PAGE_RES_IT &page_res_it, char newline_type, bool force_eol)
Definition: output.cpp:96
tesseract::Tesseract::tessedit_create_hocr
bool tessedit_create_hocr
Definition: tesseractclass.h:999
tesseract::Tesseract::make_reject_map
void make_reject_map(WERD_RES *word, ROW *row, int16_t pass)
STRING_VAR_H
#define STRING_VAR_H(name, val, comment)
Definition: params.h:296
tesseract::Tesseract::tessedit_write_params_to_file
char * tessedit_write_params_to_file
Definition: tesseractclass.h:819
tesseract::Tesseract::word_blob_quality
int16_t word_blob_quality(WERD_RES *word)
Definition: docqual.cpp:64
tesseract::Tesseract::word_contains_non_1_digit
bool word_contains_non_1_digit(const char *word, const char *word_lengths)
Definition: reject.cpp:508
tesseract::Tesseract::pix_original
Pix * pix_original() const
Definition: tesseractclass.h:210
tesseract::Tesseract::FindSegmentation
bool FindSegmentation(const GenericVector< UNICHAR_ID > &target_text, WERD_RES *word_res)
tesseract::Tesseract::crunch_pot_poor_rate
double crunch_pot_poor_rate
Definition: tesseractclass.h:940
tesseract::Tesseract::ParseLanguageString
void ParseLanguageString(const char *lang_str, GenericVector< STRING > *to_load, GenericVector< STRING > *not_to_load)
Definition: tessedit.cpp:270
tesseract::Tesseract::ReassignDiacritics
bool ReassignDiacritics(int pass, PAGE_RES_IT *pr_it, bool *make_next_word_fuzzy)
Definition: control.cpp:944
tesseract::WordData::prev_word
WordData * prev_word
Definition: tesseractclass.h:158
tesseract::Tesseract::page_separator
char * page_separator
Definition: tesseractclass.h:1078
tesseract::Tesseract::fixsp_done_mode
int fixsp_done_mode
Definition: tesseractclass.h:966
tesseract::Tesseract::alpha_count
int16_t alpha_count(const char *word, const char *word_lengths)
Definition: reject.cpp:494
tesseract::Tesseract::word_outline_errs
int16_t word_outline_errs(WERD_RES *word)
Definition: docqual.cpp:76
tesseract::ShiroRekhaSplitter::NO_SPLIT
Definition: devanagari_processing.h:74
tesseract::Tesseract::check_debug_pt
bool check_debug_pt(WERD_RES *word, int location)
Definition: control.cpp:1848
tesseract::Tesseract::right_to_left
bool right_to_left() const
Definition: tesseractclass.h:273
points.h
tesseract::Tesseract::quality_outline_pc
double quality_outline_pc
Definition: tesseractclass.h:879
TBOX
Definition: rect.h:33
docqual.h