All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 // Created: Fri Mar 07 08:17:01 PST 2008
12 //
13 // (C) Copyright 2008, Google Inc.
14 // Licensed under the Apache License, Version 2.0 (the "License");
15 // you may not use this file except in compliance with the License.
16 // You may obtain a copy of the License at
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the License is distributed on an "AS IS" BASIS,
20 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 // See the License for the specific language governing permissions and
22 // limitations under the License.
23 //
29 #include "allheaders.h"
30 #include "control.h"
31 #include "docqual.h"
32 #include "devanagari_processing.h"
33 #include "genericvector.h"
34 #include "params.h"
35 #include "ocrclass.h"
36 #include "textord.h"
37 #include "wordrec.h"
40 class BLOCK_LIST;
41 class CharSamp;
42 struct OSResults;
43 class PAGE_RES;
44 class PAGE_RES_IT;
45 struct Pix;
46 class ROW;
47 class SVMenuNode;
48 class TBOX;
49 class TO_BLOCK_LIST;
50 class WERD;
51 class WERD_CHOICE;
52 class WERD_RES;
55 // Top-level class for all tesseract global instance data.
56 // This class either holds or points to all data used by an instance
57 // of Tesseract, including the memory allocator. When this is
58 // complete, Tesseract will be thread-safe. UNTIL THEN, IT IS NOT!
59 //
60 // NOTE to developers: Do not create cyclic dependencies through this class!
61 // The directory dependency tree must remain a tree! The keep this clean,
62 // lower-level code (eg in ccutil, the bottom level) must never need to
63 // know about the content of a higher-level directory.
64 // The following scheme will grant the easiest access to lower-level
65 // global members without creating a cyclic dependency:
66 //
67 // Class Hierarchy (^ = inheritance):
68 //
69 // CCUtil (ccutil/ccutil.h)
70 // ^ Members include: UNICHARSET
71 // CUtil (cutil/cutil_class.h)
72 // ^ Members include: TBLOB*, TEXTBLOCK*
73 // CCStruct (ccstruct/ccstruct.h)
74 // ^ Members include: Image
75 // Classify (classify/classify.h)
76 // ^ Members include: Dict
77 // WordRec (wordrec/wordrec.h)
78 // ^ Members include: WERD*, DENORM*
79 // Tesseract (ccmain/tesseractclass.h)
80 // Members include: Pix*, CubeRecoContext*,
81 // TesseractCubeCombiner*
82 //
83 // Other important classes:
84 //
85 // TessBaseAPI (api/baseapi.h)
86 // Members include: BLOCK_LIST*, PAGE_RES*,
87 // Tesseract*, ImageThresholder*
88 // Dict (dict/dict.h)
89 // Members include: Image* (private)
90 //
91 // NOTE: that each level contains members that correspond to global
92 // data that is defined (and used) at that level, not necessarily where
93 // the type is defined so for instance:
94 // BOOL_VAR_H(textord_show_blobs, false, "Display unsorted blobs");
95 // goes inside the Textord class, not the cc_util class.
97 namespace tesseract {
99 class ColumnFinder;
100 #ifndef ANDROID_BUILD
101 class CubeLineObject;
102 class CubeObject;
103 class CubeRecoContext;
104 #endif
105 class EquationDetect;
106 class Tesseract;
107 #ifndef ANDROID_BUILD
108 class TesseractCubeCombiner;
109 #endif
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),
133  inT32 word_count; // count of word in the document
134  inT32 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 };
143 // Struct to hold all the pointers to relevant data for processing a word.
144 struct WordData {
146  explicit WordData(const PAGE_RES_IT& page_res_it)
147  : word(page_res_it.word()), row(page_res_it.row()->row),
148  block(page_res_it.block()->block), prev_word(NULL) {}
149  WordData(BLOCK* block_in, ROW* row_in, WERD_RES* word_res)
150  : word(word_res), row(row_in), block(block_in), prev_word(NULL) {}
157 };
159 // Definition of a Tesseract WordRecognizer. The WordData provides the context
160 // of row/block, in_word holds an initialized, possibly pre-classified word,
161 // that the recognizer may or may not consume (but if so it sets *in_word=NULL)
162 // and produces one or more output words in out_words, which may be the
163 // consumed in_word, or may be generated independently.
164 // This api allows both a conventional tesseract classifier to work, or a
165 // line-level classifier that generates multiple words from a merged input.
166 typedef void (Tesseract::*WordRecognizer)(const WordData& word_data,
167  WERD_RES** in_word,
168  PointerVector<WERD_RES>* out_words);
170 class Tesseract : public Wordrec {
171  public:
172  Tesseract();
173  ~Tesseract();
175  // Clear as much used memory as possible without resetting the adaptive
176  // classifier or losing any other classifier data.
177  void Clear();
178  // Clear all memory of adaption for this and all subclassifiers.
180  // Clear the document dictionary for this and all subclassifiers.
183  // Set the equation detector.
184  void SetEquationDetect(EquationDetect* detector);
186  // Simple accessors.
187  const FCOORD& reskew() const {
188  return reskew_;
189  }
190  // Destroy any existing pix and return a pointer to the pointer.
192  Clear();
193  return &pix_binary_;
194  }
195  Pix* pix_binary() const {
196  return pix_binary_;
197  }
198  Pix* pix_grey() const {
199  return pix_grey_;
200  }
201  void set_pix_grey(Pix* grey_pix) {
202  pixDestroy(&pix_grey_);
203  pix_grey_ = grey_pix;
204  }
205  // Returns a pointer to a Pix representing the best available image of the
206  // page. The image will be 8-bit grey if the input was grey or color. Note
207  // that in grey 0 is black and 255 is white. If the input was binary, then
208  // the returned Pix will be binary. Note that here black is 1 and white is 0.
209  // To tell the difference pixGetDepth() will return 8 or 1.
210  // In either case, the return value is a borrowed Pix, and should not be
211  // deleted or pixDestroyed.
212  Pix* BestPix() const {
213  return pix_grey_ != NULL ? pix_grey_ : pix_binary_;
214  }
215  void set_pix_thresholds(Pix* thresholds) {
216  pixDestroy(&pix_thresholds_);
217  pix_thresholds_ = thresholds;
218  }
219  int source_resolution() const {
220  return source_resolution_;
221  }
222  void set_source_resolution(int ppi) {
223  source_resolution_ = ppi;
224  }
225  int ImageWidth() const {
226  return pixGetWidth(pix_binary_);
227  }
228  int ImageHeight() const {
229  return pixGetHeight(pix_binary_);
230  }
231  Pix* scaled_color() const {
232  return scaled_color_;
233  }
234  int scaled_factor() const {
235  return scaled_factor_;
236  }
237  void SetScaledColor(int factor, Pix* color) {
238  scaled_factor_ = factor;
239  scaled_color_ = color;
240  }
241  const Textord& textord() const {
242  return textord_;
243  }
245  return &textord_;
246  }
248  bool right_to_left() const {
249  return right_to_left_;
250  }
251  int num_sub_langs() const {
252  return sub_langs_.size();
253  }
254  Tesseract* get_sub_lang(int index) const {
255  return sub_langs_[index];
256  }
257  // Returns true if any language uses Tesseract (as opposed to cube).
258  bool AnyTessLang() const {
259  if (tessedit_ocr_engine_mode != OEM_CUBE_ONLY) return true;
260  for (int i = 0; i < sub_langs_.size(); ++i) {
261  if (sub_langs_[i]->tessedit_ocr_engine_mode != OEM_CUBE_ONLY)
262  return true;
263  }
264  return false;
265  }
267  void SetBlackAndWhitelist();
269  // Perform steps to prepare underlying binary image/other data structures for
270  // page segmentation. Uses the strategy specified in the global variable
271  // pageseg_devanagari_split_strategy for perform splitting while preparing for
272  // page segmentation.
273  void PrepareForPageseg();
275  // Perform steps to prepare underlying binary image/other data structures for
276  // Tesseract OCR. The current segmentation is required by this method.
277  // Uses the strategy specified in the global variable
278  // ocr_devanagari_split_strategy for performing splitting while preparing for
279  // Tesseract ocr.
280  void PrepareForTessOCR(BLOCK_LIST* block_list,
281  Tesseract* osd_tess, OSResults* osr);
283  int SegmentPage(const STRING* input_file, BLOCK_LIST* blocks,
284  Tesseract* osd_tess, OSResults* osr);
285  void SetupWordScripts(BLOCK_LIST* blocks);
286  int AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST* blocks,
287  TO_BLOCK_LIST* to_blocks, BLOBNBOX_LIST* diacritic_blobs,
288  Tesseract* osd_tess, OSResults* osr);
290  PageSegMode pageseg_mode, BLOCK_LIST* blocks, Tesseract* osd_tess,
291  OSResults* osr, TO_BLOCK_LIST* to_blocks, Pix** photo_mask_pix,
292  Pix** music_mask_pix);
293  // par_control.cpp
294  void PrerecAllWordsPar(const GenericVector<WordData>& words);
297  bool ProcessTargetWord(const TBOX& word_box, const TBOX& target_word_box,
298  const char* word_config, int pass);
299  // Sets up the words ready for whichever engine is to be run
300  void SetupAllWordsPassN(int pass_n,
301  const TBOX* target_word_box,
302  const char* word_config,
303  PAGE_RES* page_res,
304  GenericVector<WordData>* words);
305  // Sets up the single word ready for whichever engine is to be run.
306  void SetupWordPassN(int pass_n, WordData* word);
307  // Runs word recognition on all the words.
308  bool RecogAllWordsPassN(int pass_n, ETEXT_DESC* monitor,
309  PAGE_RES_IT* pr_it,
310  GenericVector<WordData>* words);
311  bool recog_all_words(PAGE_RES* page_res,
312  ETEXT_DESC* monitor,
313  const TBOX* target_word_box,
314  const char* word_config,
315  int dopasses);
316  void rejection_passes(PAGE_RES* page_res,
317  ETEXT_DESC* monitor,
318  const TBOX* target_word_box,
319  const char* word_config);
320  void bigram_correction_pass(PAGE_RES *page_res);
321  void blamer_pass(PAGE_RES* page_res);
322  // Sets script positions and detects smallcaps on all output words.
323  void script_pos_pass(PAGE_RES* page_res);
324  // Helper to recognize the word using the given (language-specific) tesseract.
325  // Returns positive if this recognizer found more new best words than the
326  // number kept from best_words.
327  int RetryWithLanguage(const WordData& word_data,
328  WordRecognizer recognizer,
329  WERD_RES** in_word,
330  PointerVector<WERD_RES>* best_words);
331  // Moves good-looking "noise"/diacritics from the reject list to the main
332  // blob list on the current word. Returns true if anything was done, and
333  // sets make_next_word_fuzzy if blob(s) were added to the end of the word.
334  bool ReassignDiacritics(int pass, PAGE_RES_IT* pr_it,
335  bool* make_next_word_fuzzy);
336  // Attempts to put noise/diacritic outlines into the blobs that they overlap.
337  // Input: a set of noisy outlines that probably belong to the real_word.
338  // Output: outlines that overlapped blobs are set to NULL and put back into
339  // the word, either in the blobs or in the reject list.
341  const GenericVector<C_OUTLINE*>& outlines, int pass, WERD* real_word,
342  PAGE_RES_IT* pr_it, GenericVector<bool>* word_wanted,
343  GenericVector<bool>* overlapped_any_blob,
344  GenericVector<C_BLOB*>* target_blobs);
345  // Attempts to assign non-overlapping outlines to their nearest blobs or
346  // make new blobs out of them.
348  int pass, WERD* real_word, PAGE_RES_IT* pr_it,
349  GenericVector<bool>* word_wanted,
350  GenericVector<C_BLOB*>* target_blobs);
351  // Starting with ok_outlines set to indicate which outlines overlap the blob,
352  // chooses the optimal set (approximately) and returns true if any outlines
353  // are desired, in which case ok_outlines indicates which ones.
354  bool SelectGoodDiacriticOutlines(int pass, float certainty_threshold,
355  PAGE_RES_IT* pr_it, C_BLOB* blob,
356  const GenericVector<C_OUTLINE*>& outlines,
357  int num_outlines,
358  GenericVector<bool>* ok_outlines);
359  // Classifies the given blob plus the outlines flagged by ok_outlines, undoes
360  // the inclusion of the outlines, and returns the certainty of the raw choice.
361  float ClassifyBlobPlusOutlines(const GenericVector<bool>& ok_outlines,
362  const GenericVector<C_OUTLINE*>& outlines,
363  int pass_n, PAGE_RES_IT* pr_it, C_BLOB* blob,
364  STRING* best_str);
365  // Classifies the given blob (part of word_data->word->word) as an individual
366  // word, using languages, chopper etc, returning only the certainty of the
367  // best raw choice, and undoing all the work done to fake out the word.
368  float ClassifyBlobAsWord(int pass_n, PAGE_RES_IT* pr_it, C_BLOB* blob,
369  STRING* best_str, float* c2);
370  void classify_word_and_language(int pass_n, PAGE_RES_IT* pr_it,
371  WordData* word_data);
372  void classify_word_pass1(const WordData& word_data,
373  WERD_RES** in_word,
374  PointerVector<WERD_RES>* out_words);
375  void recog_pseudo_word(PAGE_RES* page_res, // blocks to check
376  TBOX &selection_box);
378  void fix_rep_char(PAGE_RES_IT* page_res_it);
381  const char *s,
382  const char *lengths);
383  void match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK* block);
384  void classify_word_pass2(const WordData& word_data,
385  WERD_RES** in_word,
386  PointerVector<WERD_RES>* out_words);
387  void ReportXhtFixResult(bool accept_new_word, float new_x_ht,
388  WERD_RES* word, WERD_RES* new_word);
389  bool RunOldFixXht(WERD_RES *word, BLOCK* block, ROW *row);
390  bool TrainedXheightFix(WERD_RES *word, BLOCK* block, ROW *row);
391  // Runs recognition with the test baseline shift and x-height and returns true
392  // if there was an improvement in recognition result.
393  bool TestNewNormalization(int original_misfits, float baseline_shift,
394  float new_x_ht, WERD_RES *word, BLOCK* block,
395  ROW *row);
398  // Set fonts of this word.
399  void set_word_fonts(WERD_RES *word);
400  void font_recognition_pass(PAGE_RES* page_res);
401  void dictionary_correction_pass(PAGE_RES* page_res);
402  BOOL8 check_debug_pt(WERD_RES *word, int location);
405  bool SubAndSuperscriptFix(WERD_RES *word_res);
406  void GetSubAndSuperscriptCandidates(const WERD_RES *word,
407  int *num_rebuilt_leading,
408  ScriptPos *leading_pos,
409  float *leading_certainty,
410  int *num_rebuilt_trailing,
411  ScriptPos *trailing_pos,
412  float *trailing_certainty,
413  float *avg_certainty,
414  float *unlikely_threshold);
415  WERD_RES *TrySuperscriptSplits(int num_chopped_leading,
416  float leading_certainty,
417  ScriptPos leading_pos,
418  int num_chopped_trailing,
419  float trailing_certainty,
420  ScriptPos trailing_pos,
421  WERD_RES *word,
422  bool *is_good,
423  int *retry_leading,
424  int *retry_trailing);
425  bool BelievableSuperscript(bool debug,
426  const WERD_RES &word,
427  float certainty_threshold,
428  int *left_ok,
429  int *right_ok) const;
432 #ifndef ANDROID_BUILD
433  bool init_cube_objects(bool load_combiner,
435  // Iterates through tesseract's results and calls cube on each word,
436  // combining the results with the existing tesseract result.
437  void run_cube_combiner(PAGE_RES *page_res);
438  // Recognizes a single word using (only) cube. Compatible with
439  // Tesseract's classify_word_pass1/classify_word_pass2.
440  void cube_word_pass1(BLOCK* block, ROW *row, WERD_RES *word);
441  // Cube recognizer to recognize a single word as with classify_word_pass1
442  // but also returns the cube object in case the combiner is needed.
444  // Combines the cube and tesseract results for a single word, leaving the
445  // result in tess_word.
446  void cube_combine_word(CubeObject* cube_obj, WERD_RES* cube_word,
447  WERD_RES* tess_word);
448  // Call cube on the current word, and write the result to word.
449  // Sets up a fake result and returns false if something goes wrong.
450  bool cube_recognize(CubeObject *cube_obj, BLOCK* block, WERD_RES *word);
451  void fill_werd_res(const BoxWord& cube_box_word,
452  const char* cube_best_str,
453  WERD_RES* tess_werd_res);
454  bool extract_cube_state(CubeObject* cube_obj, int* num_chars,
455  Boxa** char_boxes, CharSamp*** char_samples);
456  bool create_cube_box_word(Boxa *char_boxes, int num_chars,
457  TBOX word_box, BoxWord* box_word);
458 #endif
461  void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box);
462  void write_results(PAGE_RES_IT &page_res_it, // full info
463  char newline_type, // type of newline
464  BOOL8 force_eol // override tilde crunch?
465  );
466  void set_unlv_suspects(WERD_RES *word);
467  UNICHAR_ID get_rep_char(WERD_RES *word); // what char is repeated?
468  BOOL8 acceptable_number_string(const char *s,
469  const char *lengths);
470  inT16 count_alphanums(const WERD_CHOICE &word);
471  inT16 count_alphas(const WERD_CHOICE &word);
473  void read_config_file(const char *filename, SetParamConstraint constraint);
474  // Initialize for potentially a set of languages defined by the language
475  // string and recursively any additional languages required by any language
476  // traineddata file (via tessedit_load_sublangs in its config) that is loaded.
477  // See init_tesseract_internal for args.
478  int init_tesseract(const char *arg0,
479  const char *textbase,
480  const char *language,
481  OcrEngineMode oem,
482  char **configs,
483  int configs_size,
484  const GenericVector<STRING> *vars_vec,
485  const GenericVector<STRING> *vars_values,
486  bool set_only_init_params);
487  int init_tesseract(const char *datapath,
488  const char *language,
489  OcrEngineMode oem) {
490  return init_tesseract(datapath, NULL, language, oem,
491  NULL, 0, NULL, NULL, false);
492  }
493  // Common initialization for a single language.
494  // arg0 is the datapath for the tessdata directory, which could be the
495  // path of the tessdata directory with no trailing /, or (if tessdata
496  // lives in the same directory as the executable, the path of the executable,
497  // hence the name arg0.
498  // textbase is an optional output file basename (used only for training)
499  // language is the language code to load.
500  // oem controls which engine(s) will operate on the image
501  // configs (argv) is an array of config filenames to load variables from.
502  // May be NULL.
503  // configs_size (argc) is the number of elements in configs.
504  // vars_vec is an optional vector of variables to set.
505  // vars_values is an optional corresponding vector of values for the variables
506  // in vars_vec.
507  // If set_only_init_params is true, then only the initialization variables
508  // will be set.
509  int init_tesseract_internal(const char *arg0,
510  const char *textbase,
511  const char *language,
512  OcrEngineMode oem,
513  char **configs,
514  int configs_size,
515  const GenericVector<STRING> *vars_vec,
516  const GenericVector<STRING> *vars_values,
517  bool set_only_init_params);
519  // Set the universal_id member of each font to be unique among all
520  // instances of the same font loaded.
521  void SetupUniversalFontIds();
523  int init_tesseract_lm(const char *arg0,
524  const char *textbase,
525  const char *language);
527  void recognize_page(STRING& image_name);
528  void end_tesseract();
530  bool init_tesseract_lang_data(const char *arg0,
531  const char *textbase,
532  const char *language,
533  OcrEngineMode oem,
534  char **configs,
535  int configs_size,
536  const GenericVector<STRING> *vars_vec,
537  const GenericVector<STRING> *vars_values,
538  bool set_only_init_params);
540  void ParseLanguageString(const char* lang_str,
541  GenericVector<STRING>* to_load,
542  GenericVector<STRING>* not_to_load);
547  void pgeditor_main(int width, int height, PAGE_RES* page_res);
548  #endif // GRAPHICS_DISABLED
549  void process_image_event( // action in image win
550  const SVEvent &event);
551  BOOL8 process_cmd_win_event( // UI command semantics
552  inT32 cmd_event, // which menu item?
553  char *new_value // any prompt data
554  );
555  void debug_word(PAGE_RES* page_res, const TBOX &selection_box);
556  void do_re_display(
557  BOOL8 (tesseract::Tesseract::*word_painter)(PAGE_RES_IT* pr_it));
562  // #ifndef GRAPHICS_DISABLED
563  BOOL8 word_dumper(PAGE_RES_IT* pr_it);
564  // #endif // GRAPHICS_DISABLED
565  void blob_feature_display(PAGE_RES* page_res, const TBOX& selection_box);
567  // make rej map for word
568  void make_reject_map(WERD_RES *word, ROW *row, inT16 pass);
569  BOOL8 one_ell_conflict(WERD_RES *word_res, BOOL8 update_map);
570  inT16 first_alphanum_index(const char *word,
571  const char *word_lengths);
572  inT16 first_alphanum_offset(const char *word,
573  const char *word_lengths);
574  inT16 alpha_count(const char *word,
575  const char *word_lengths);
576  BOOL8 word_contains_non_1_digit(const char *word,
577  const char *word_lengths);
578  void dont_allow_1Il(WERD_RES *word);
579  inT16 count_alphanums( //how many alphanums
580  WERD_RES *word);
581  void flip_0O(WERD_RES *word);
582  BOOL8 non_0_digit(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
583  BOOL8 non_O_upper(const UNICHARSET& ch_set, UNICHAR_ID unichar_id);
585  void nn_match_word( //Match a word
586  WERD_RES *word,
587  ROW *row);
588  void nn_recover_rejects(WERD_RES *word, ROW *row);
589  void set_done( //set done flag
590  WERD_RES *word,
591  inT16 pass);
592  inT16 safe_dict_word(const WERD_RES *werd_res); // is best_choice in dict?
593  void flip_hyphens(WERD_RES *word);
594  void reject_I_1_L(WERD_RES *word);
595  void reject_edge_blobs(WERD_RES *word);
596  void reject_mostly_rejects(WERD_RES *word);
598  BOOL8 word_adaptable( //should we adapt?
599  WERD_RES *word,
600  uinT16 mode);
603  void recog_word_recursive(WERD_RES* word);
604  void recog_word(WERD_RES *word);
605  void split_and_recog_word(WERD_RES* word);
606  void split_word(WERD_RES *word,
607  int split_pt,
608  WERD_RES **right_piece,
609  BlamerBundle **orig_blamer_bundle) const;
610  void join_words(WERD_RES *word,
611  WERD_RES *word2,
612  BlamerBundle *orig_bb) const;
614  BOOL8 digit_or_numeric_punct(WERD_RES *word, int char_position);
615  inT16 eval_word_spacing(WERD_RES_LIST &word_res_list);
616  void match_current_words(WERD_RES_LIST &words, ROW *row, BLOCK* block);
617  inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list);
618  void fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK* block);
619  void fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK* block);
620  void fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK* block);
621  void fix_fuzzy_spaces( //find fuzzy words
622  ETEXT_DESC *monitor, //progress monitor
623  inT32 word_count, //count of words in doc
624  PAGE_RES *page_res);
625  void dump_words(WERD_RES_LIST &perm, inT16 score,
626  inT16 mode, BOOL8 improved);
628  inT16 worst_noise_blob(WERD_RES *word_res, float *worst_noise_score);
629  float blob_noise_score(TBLOB *blob);
630  void break_noisiest_blob_word(WERD_RES_LIST &words);
632  GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word);
634  GARBAGE_LEVEL garbage_level,
635  BOOL8 ok_dict_word);
636  void tilde_crunch(PAGE_RES_IT &page_res_it);
637  void unrej_good_quality_words( //unreject potential
638  PAGE_RES_IT &page_res_it);
639  void doc_and_block_rejection( //reject big chunks
640  PAGE_RES_IT &page_res_it,
641  BOOL8 good_quality_doc);
642  void quality_based_rejection(PAGE_RES_IT &page_res_it,
643  BOOL8 good_quality_doc);
644  void convert_bad_unlv_chs(WERD_RES *word_res);
645  void tilde_delete(PAGE_RES_IT &page_res_it);
646  inT16 word_blob_quality(WERD_RES *word, ROW *row);
647  void word_char_quality(WERD_RES *word, ROW *row, inT16 *match_count,
648  inT16 *accepted_match_count);
649  void unrej_good_chs(WERD_RES *word, ROW *row);
650  inT16 count_outline_errs(char c, inT16 outline_count);
652  BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level);
653  CRUNCH_MODE word_deletable(WERD_RES *word, inT16 &delete_mode);
655  BOOL8 noise_outlines(TWERD *word);
657  void
659  PAGE_RES* page_res, // blocks to check
660  //function to call
661  TBOX & selection_box,
662  BOOL8 (tesseract::Tesseract::*word_processor)(PAGE_RES_IT* pr_it));
664  void tess_add_doc_word( //test acceptability
665  WERD_CHOICE *word_choice //after context
666  );
667  void tess_segment_pass_n(int pass_n, WERD_RES *word);
668  bool tess_acceptable_word(WERD_RES *word);
671  // Applies the box file based on the image name fname, and resegments
672  // the words in the block_list (page), with:
673  // blob-mode: one blob per line in the box file, words as input.
674  // word/line-mode: one blob per space-delimited unit after the #, and one word
675  // per line in the box file. (See comment above for box file format.)
676  // If find_segmentation is true, (word/line mode) then the classifier is used
677  // to re-segment words/lines to match the space-delimited truth string for
678  // each box. In this case, the input box may be for a word or even a whole
679  // text line, and the output words will contain multiple blobs corresponding
680  // to the space-delimited input string.
681  // With find_segmentation false, no classifier is needed, but the chopper
682  // can still be used to correctly segment touching characters with the help
683  // of the input boxes.
684  // In the returned PAGE_RES, the WERD_RES are setup as they would be returned
685  // from normal classification, ie. with a word, chopped_word, rebuild_word,
686  // seam_array, denorm, box_word, and best_state, but NO best_choice or
687  // raw_choice, as they would require a UNICHARSET, which we aim to avoid.
688  // Instead, the correct_text member of WERD_RES is set, and this may be later
689  // converted to a best_choice using CorrectClassifyWords. CorrectClassifyWords
690  // is not required before calling ApplyBoxTraining.
691  PAGE_RES* ApplyBoxes(const STRING& fname, bool find_segmentation,
692  BLOCK_LIST *block_list);
694  // Any row xheight that is significantly different from the median is set
695  // to the median.
696  void PreenXHeights(BLOCK_LIST *block_list);
698  // Builds a PAGE_RES from the block_list in the way required for ApplyBoxes:
699  // All fuzzy spaces are removed, and all the words are maximally chopped.
701  BLOCK_LIST *block_list);
702  // Tests the chopper by exhaustively running chop_one_blob.
703  // The word_res will contain filled chopped_word, seam_array, denorm,
704  // box_word and best_state for the maximally chopped word.
705  void MaximallyChopWord(const GenericVector<TBOX>& boxes,
706  BLOCK* block, ROW* row, WERD_RES* word_res);
707  // Gather consecutive blobs that match the given box into the best_state
708  // and corresponding correct_text.
709  // Fights over which box owns which blobs are settled by pre-chopping and
710  // applying the blobs to box or next_box with the least non-overlap.
711  // Returns false if the box was in error, which can only be caused by
712  // failing to find an appropriate blob for a box.
713  // This means that occasionally, blobs may be incorrectly segmented if the
714  // chopper fails to find a suitable chop point.
715  bool ResegmentCharBox(PAGE_RES* page_res, const TBOX *prev_box,
716  const TBOX& box, const TBOX& next_box,
717  const char* correct_text);
718  // Consume all source blobs that strongly overlap the given box,
719  // putting them into a new word, with the correct_text label.
720  // Fights over which box owns which blobs are settled by
721  // applying the blobs to box or next_box with the least non-overlap.
722  // Returns false if the box was in error, which can only be caused by
723  // failing to find an overlapping blob for a box.
724  bool ResegmentWordBox(BLOCK_LIST *block_list,
725  const TBOX& box, const TBOX& next_box,
726  const char* correct_text);
727  // Resegments the words by running the classifier in an attempt to find the
728  // correct segmentation that produces the required string.
729  void ReSegmentByClassification(PAGE_RES* page_res);
730  // Converts the space-delimited string of utf8 text to a vector of UNICHAR_ID.
731  // Returns false if an invalid UNICHAR_ID is encountered.
732  bool ConvertStringToUnichars(const char* utf8,
733  GenericVector<UNICHAR_ID>* class_ids);
734  // Resegments the word to achieve the target_text from the classifier.
735  // Returns false if the re-segmentation fails.
736  // Uses brute-force combination of upto kMaxGroupSize adjacent blobs, and
737  // applies a full search on the classifier results to find the best classified
738  // segmentation. As a compromise to obtain better recall, 1-1 ambigiguity
739  // substitutions ARE used.
740  bool FindSegmentation(const GenericVector<UNICHAR_ID>& target_text,
741  WERD_RES* word_res);
742  // Recursive helper to find a match to the target_text (from text_index
743  // position) in the choices (from choices_pos position).
744  // Choices is an array of GenericVectors, of length choices_length, with each
745  // element representing a starting position in the word, and the
746  // GenericVector holding classification results for a sequence of consecutive
747  // blobs, with index 0 being a single blob, index 1 being 2 blobs etc.
749  int choices_pos, int choices_length,
750  const GenericVector<UNICHAR_ID>& target_text,
751  int text_index,
752  float rating, GenericVector<int>* segmentation,
753  float* best_rating, GenericVector<int>* best_segmentation);
754  // Counts up the labelled words and the blobs within.
755  // Deletes all unused or emptied words, counting the unused ones.
756  // Resets W_BOL and W_EOL flags correctly.
757  // Builds the rebuild_word and rebuilds the box_word.
758  void TidyUp(PAGE_RES* page_res);
759  // Logs a bad box by line in the box file and box coords.
760  void ReportFailedBox(int boxfile_lineno, TBOX box, const char *box_ch,
761  const char *err_msg);
762  // Creates a fake best_choice entry in each WERD_RES with the correct text.
763  void CorrectClassifyWords(PAGE_RES* page_res);
764  // Call LearnWord to extract features for labelled blobs within each word.
765  // Features are stored in an internal buffer.
766  void ApplyBoxTraining(const STRING& fontname, PAGE_RES* page_res);
769  // Returns the number of misfit blob tops in this word.
770  int CountMisfitTops(WERD_RES *word_res);
771  // Returns a new x-height in pixels (original image coords) that is
772  // maximally compatible with the result in word_res.
773  // Returns 0.0f if no x-height is found that is better than the current
774  // estimate.
775  float ComputeCompatibleXheight(WERD_RES *word_res, float* baseline_shift);
777  // TODO(ocr-team): Find and remove obsolete parameters.
779  "Take segmentation and labeling from box file");
781  "Conversion of word/line box file to char box file");
783  "Generate training data from boxed chars");
785  "Generate more boxes from boxed chars");
787  "Dump intermediate images made during page segmentation");
789  "Page seg mode: 0=osd only, 1=auto+osd, 2=auto, 3=col, 4=block,"
790  " 5=line, 6=word, 7=char"
791  " (Values from PageSegMode enum in publictypes.h)");
793  "Which OCR engine(s) to run (Tesseract, Cube, both). Defaults"
794  " to loading and running only Tesseract (no Cube, no combiner)."
795  " (Values from OcrEngineMode enum in tesseractclass.h)");
797  "Blacklist of chars not to recognize");
799  "Whitelist of chars to recognize");
801  "List of chars to override tessedit_char_blacklist");
803  "Perform training for ambiguities");
806  "Whether to use the top-line splitting process for Devanagari "
807  "documents while performing page-segmentation.");
810  "Whether to use the top-line splitting process for Devanagari "
811  "documents while performing ocr.");
813  "Write all parameters to the given file.");
815  "Generate and print debug information for adaption");
816  INT_VAR_H(bidi_debug, 0, "Debug level for BiDi");
817  INT_VAR_H(applybox_debug, 1, "Debug level");
818  INT_VAR_H(applybox_page, 0, "Page number to apply boxes from");
820  "Exposure value follows this pattern in the image"
821  " filename. The name of the image files are expected"
822  " to be in the form [lang].[fontname].exp[num].tif");
824  "Learn both character fragments (as is done in the"
825  " special low exposure mode) as well as unfragmented"
826  " characters.");
828  "Each bounding box is assumed to contain ngrams. Only"
829  " learn the ngrams whose outlines overlap horizontally.");
830  BOOL_VAR_H(tessedit_display_outwords, false, "Draw output words");
831  BOOL_VAR_H(tessedit_dump_choices, false, "Dump char choices");
832  BOOL_VAR_H(tessedit_timing_debug, false, "Print timing stats");
834  "Try to improve fuzzy spaces");
836  "Dont bother with word plausibility");
837  BOOL_VAR_H(tessedit_fix_hyphens, true, "Crunch double hyphens?");
838  BOOL_VAR_H(tessedit_redo_xheight, true, "Check/Correct x-height");
840  "Add words to the document dictionary");
841  BOOL_VAR_H(tessedit_debug_fonts, false, "Output font info per char");
842  BOOL_VAR_H(tessedit_debug_block_rejection, false, "Block and Row stats");
844  "Enable correction based on the word bigram dictionary.");
846  "Enable single word correction based on the dictionary.");
847  INT_VAR_H(tessedit_bigram_debug, 0, "Amount of debug output for bigram "
848  "correction.");
850  "Remove and conditionally reassign small outlines when they"
851  " confuse layout analysis, determining diacritics vs noise");
852  INT_VAR_H(debug_noise_removal, 0, "Debug reassignment of small outlines");
853  // Worst (min) certainty, for which a diacritic is allowed to make the base
854  // character worse and still be included.
855  double_VAR_H(noise_cert_basechar, -8.0, "Hingepoint for base char certainty");
856  // Worst (min) certainty, for which a non-overlapping diacritic is allowed to
857  // make the base character worse and still be included.
858  double_VAR_H(noise_cert_disjoint, -2.5, "Hingepoint for disjoint certainty");
859  // Worst (min) certainty, for which a diacritic is allowed to make a new
860  // stand-alone blob.
861  double_VAR_H(noise_cert_punc, -2.5, "Threshold for new punc char certainty");
862  // Factor of certainty margin for adding diacritics to not count as worse.
864  "Scaling on certainty diff from Hingepoint");
865  INT_VAR_H(noise_maxperblob, 8, "Max diacritics to apply to a blob");
866  INT_VAR_H(noise_maxperword, 16, "Max diacritics to apply to a word");
867  INT_VAR_H(debug_x_ht_level, 0, "Reestimate debug");
868  BOOL_VAR_H(debug_acceptable_wds, false, "Dump word pass/fail chk");
869  STRING_VAR_H(chs_leading_punct, "('`\"", "Leading punctuation");
870  STRING_VAR_H(chs_trailing_punct1, ").,;:?!", "1st Trailing punctuation");
871  STRING_VAR_H(chs_trailing_punct2, ")'`\"", "2nd Trailing punctuation");
872  double_VAR_H(quality_rej_pc, 0.08, "good_quality_doc lte rejection limit");
873  double_VAR_H(quality_blob_pc, 0.0, "good_quality_doc gte good blobs limit");
875  "good_quality_doc lte outline error limit");
876  double_VAR_H(quality_char_pc, 0.95, "good_quality_doc gte good char limit");
877  INT_VAR_H(quality_min_initial_alphas_reqd, 2, "alphas in a good word");
879  "Adaptation decision algorithm for tess");
881  "Do minimal rejection on pass 1 output");
882  BOOL_VAR_H(tessedit_test_adaption, false, "Test adaption criteria");
883  BOOL_VAR_H(tessedit_matcher_log, false, "Log matcher activity");
885  "Adaptation decision algorithm for tess");
886  BOOL_VAR_H(test_pt, false, "Test for point");
887  double_VAR_H(test_pt_x, 99999.99, "xcoord");
888  double_VAR_H(test_pt_y, 99999.99, "ycoord");
889  INT_VAR_H(paragraph_debug_level, 0, "Print paragraph debug info.");
891  "Run paragraph detection on the post-text-recognition "
892  "(more accurate)");
893  INT_VAR_H(cube_debug_level, 1, "Print cube debug info.");
894  STRING_VAR_H(outlines_odd, "%| ", "Non standard number of outlines");
895  STRING_VAR_H(outlines_2, "ij!?%\":;", "Non standard number of outlines");
897  "Allow outline errs in unrejection?");
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");
925  "Reject all bad quality wds");
928  "Output data to debug file");
929  BOOL_VAR_H(bland_unrej, false, "unrej potential with no chekcs");
931  "good_quality_doc gte good char limit");
933  "Mark v.bad words for tilde crunch");
934  BOOL_VAR_H(hocr_font_info, false,
935  "Add font info to hocr output");
936  BOOL_VAR_H(crunch_early_merge_tess_fails, true, "Before word crunch?");
937  BOOL_VAR_H(crunch_early_convert_bad_unlv_chs, false, "Take out ~^ early?");
938  double_VAR_H(crunch_terrible_rating, 80.0, "crunch rating lt this");
939  BOOL_VAR_H(crunch_terrible_garbage, true, "As it says");
941  "crunch garbage cert lt this");
942  double_VAR_H(crunch_poor_garbage_rate, 60, "crunch garbage rating lt this");
943  double_VAR_H(crunch_pot_poor_rate, 40, "POTENTIAL crunch rating lt this");
944  double_VAR_H(crunch_pot_poor_cert, -8.0, "POTENTIAL crunch cert lt this");
945  BOOL_VAR_H(crunch_pot_garbage, true, "POTENTIAL crunch garbage");
946  double_VAR_H(crunch_del_rating, 60, "POTENTIAL crunch rating lt this");
947  double_VAR_H(crunch_del_cert, -10.0, "POTENTIAL crunch cert lt this");
948  double_VAR_H(crunch_del_min_ht, 0.7, "Del if word ht lt xht x this");
949  double_VAR_H(crunch_del_max_ht, 3.0, "Del if word ht gt xht x this");
950  double_VAR_H(crunch_del_min_width, 3.0, "Del if word width lt xht x this");
952  "Del if word gt xht x this above bl");
953  double_VAR_H(crunch_del_low_word, 0.5, "Del if word gt xht x this below bl");
954  double_VAR_H(crunch_small_outlines_size, 0.6, "Small if lt xht x this");
955  INT_VAR_H(crunch_rating_max, 10, "For adj length in rating per ch");
956  INT_VAR_H(crunch_pot_indicators, 1, "How many potential indicators needed");
957  BOOL_VAR_H(crunch_leave_ok_strings, true, "Dont touch sensible strings");
958  BOOL_VAR_H(crunch_accept_ok, true, "Use acceptability in okstring");
960  "Dont pot crunch sensible strings");
961  BOOL_VAR_H(crunch_include_numerals, false, "Fiddle alpha figures");
963  "Dont crunch words with long lower case strings");
965  "Dont crunch words with long lower case strings");
966  INT_VAR_H(crunch_long_repetitions, 3, "Crunch words with long repetitions");
967  INT_VAR_H(crunch_debug, 0, "As it says");
969  "How many non-noise blbs either side?");
970  double_VAR_H(fixsp_small_outlines_size, 0.28, "Small if lt xht x this");
971  BOOL_VAR_H(tessedit_prefer_joined_punct, false, "Reward punctation joins");
972  INT_VAR_H(fixsp_done_mode, 1, "What constitues done for spacing");
973  INT_VAR_H(debug_fix_space_level, 0, "Contextual fixspace debug");
975  "Punct. chs expected WITHIN numbers");
977  "Max allowed deviation of blob top outside of font data");
978  INT_VAR_H(x_ht_min_change, 8, "Min change in xht before actually trying it");
979  INT_VAR_H(superscript_debug, 0, "Debug level for sub & superscript fixer");
980  double_VAR_H(superscript_worse_certainty, 2.0, "How many times worse "
981  "certainty does a superscript position glyph need to be for us "
982  "to try classifying it as a char with a different baseline?");
983  double_VAR_H(superscript_bettered_certainty, 0.97, "What reduction in "
984  "badness do we think sufficient to choose a superscript over "
985  "what we'd thought. For example, a value of 0.6 means we want "
986  "to reduce badness of certainty by 40%");
988  "A superscript scaled down more than this is unbelievably "
989  "small. For example, 0.3 means we expect the font size to "
990  "be no smaller than 30% of the text line font size.");
992  "Maximum top of a character measured as a multiple of x-height "
993  "above the baseline for us to reconsider whether it's a "
994  "subscript.");
996  "Minimum bottom of a character measured as a multiple of "
997  "x-height above the baseline for us to reconsider whether it's "
998  "a superscript.");
1000  "Write block separators in output");
1002  "Write repetition char code");
1003  BOOL_VAR_H(tessedit_write_unlv, false, "Write .unlv output file");
1004  BOOL_VAR_H(tessedit_create_txt, true, "Write .txt output file");
1005  BOOL_VAR_H(tessedit_create_hocr, false, "Write .html hOCR output file");
1006  BOOL_VAR_H(tessedit_create_pdf, false, "Write .pdf output file");
1008  "Output char for unidentified blobs");
1009  INT_VAR_H(suspect_level, 99, "Suspect marker level");
1011  "Min suspect level for rejecting spaces");
1013  "Dont Suspect dict wds longer than this");
1014  BOOL_VAR_H(suspect_constrain_1Il, false, "UNLV keep 1Il chars rejected");
1015  double_VAR_H(suspect_rating_per_ch, 999.9, "Dont touch bad rating limit");
1016  double_VAR_H(suspect_accept_rating, -999.9, "Accept good rating limit");
1017  BOOL_VAR_H(tessedit_minimal_rejection, false, "Only reject tess failures");
1018  BOOL_VAR_H(tessedit_zero_rejection, false, "Dont reject ANYTHING");
1020  "Make output have exactly one word per WERD");
1022  "Dont reject ANYTHING AT ALL");
1023  BOOL_VAR_H(tessedit_consistent_reps, true, "Force all rep chars the same");
1024  INT_VAR_H(tessedit_reject_mode, 0, "Rejection algorithm");
1025  BOOL_VAR_H(tessedit_rejection_debug, false, "Adaption debug");
1026  BOOL_VAR_H(tessedit_flip_0O, true, "Contextual 0O O0 flips");
1028  "Aspect ratio dot/hyphen test");
1030  "Aspect ratio dot/hyphen test");
1031  BOOL_VAR_H(rej_trust_doc_dawg, false, "Use DOC dawg in 11l conf. detector");
1032  BOOL_VAR_H(rej_1Il_use_dict_word, false, "Use dictword test");
1033  BOOL_VAR_H(rej_1Il_trust_permuter_type, true, "Dont double check");
1034  BOOL_VAR_H(rej_use_tess_accepted, true, "Individual rejection control");
1035  BOOL_VAR_H(rej_use_tess_blanks, true, "Individual rejection control");
1036  BOOL_VAR_H(rej_use_good_perm, true, "Individual rejection control");
1037  BOOL_VAR_H(rej_use_sensible_wd, false, "Extend permuter check");
1038  BOOL_VAR_H(rej_alphas_in_number_perm, false, "Extend permuter check");
1040  INT_VAR_H(tessedit_image_border, 2, "Rej blbs near image edge limit");
1042  "Allow NN to unrej");
1043  STRING_VAR_H(conflict_set_I_l_1, "Il1[]", "Il1 conflict set");
1044  INT_VAR_H(min_sane_x_ht_pixels, 8, "Reject any x-ht lt or eq than this");
1045  BOOL_VAR_H(tessedit_create_boxfile, false, "Output text with boxes");
1047  "-1 -> All pages, else specifc page to process");
1048  BOOL_VAR_H(tessedit_write_images, false, "Capture the image from the IPE");
1049  BOOL_VAR_H(interactive_display_mode, false, "Run interactively?");
1050  STRING_VAR_H(file_type, ".tif", "Filename extension");
1051  BOOL_VAR_H(tessedit_override_permuter, true, "According to dict_word");
1053  "Debug level for TessdataManager functions.");
1055  "List of languages to load with this one");
1057  "In multilingual mode use params model of the primary language");
1058  // Min acceptable orientation margin (difference in scores between top and 2nd
1059  // choice in OSResults::orientations) to believe the page orientation.
1061  "Min acceptable orientation margin");
1062  BOOL_VAR_H(textord_tabfind_show_vlines, false, "Debug line finding");
1063  BOOL_VAR_H(textord_use_cjk_fp_model, FALSE, "Use CJK fixed pitch model");
1065  "Allow feature extractors to see the original outline");
1067  "Only initialize with the config file. Useful if the instance is "
1068  "not going to be used for OCR but say only for layout analysis.");
1069  BOOL_VAR_H(textord_equation_detect, false, "Turn on equation detector");
1070  BOOL_VAR_H(textord_tabfind_vertical_text, true, "Enable vertical detection");
1072  "Force using vertical text page mode");
1074  "Fraction of textlines deemed vertical to use vertical page "
1075  "mode");
1077  "Fraction of height used as a minimum gap for aligned blobs.");
1078  INT_VAR_H(tessedit_parallelize, 0, "Run in parallel where possible");
1080  "Preserve multiple interword spaces");
1082  "Include page separator string in output text after each "
1083  "image/page.");
1085  "Page separator (default is form feed control character)");
1087  // The following parameters were deprecated and removed from their original
1088  // locations. The parameters are temporarily kept here to give Tesseract
1089  // users a chance to updated their [lang].traineddata and config files
1090  // without introducing failures during Tesseract initialization.
1091  // TODO(ocr-team): remove these parameters from the code once we are
1092  // reasonably sure that Tesseract users have updated their data files.
1093  //
1096  "find horizontal lines such as headers in vertical page mode");
1097  INT_VAR_H(tessedit_ok_mode, 5, "Acceptance decision algorithm");
1098  BOOL_VAR_H(load_fixed_length_dawgs, true, "Load fixed length"
1099  " dawgs (e.g. for non-space delimited languages)");
1100  INT_VAR_H(segment_debug, 0, "Debug the whole segmentation process");
1101  BOOL_VAR_H(permute_debug, 0, "char permutation debug");
1102  double_VAR_H(bestrate_pruning_factor, 2.0, "Multiplying factor of"
1103  " current best rate to prune other hypotheses");
1105  "Turn on word script consistency permuter");
1107  "incorporate segmentation cost in word rating?");
1109  "Score multipler for script consistency within a word. "
1110  "Being a 'reward' factor, it should be <= 1. "
1111  "Smaller value implies bigger reward.");
1113  "Turn on fixed-length phrasebook search permuter");
1115  "Turn on character type (property) consistency permuter");
1117  "Score multipler for char type consistency within a word. ");
1119  "Score multipler for ngram permuter's best choice"
1120  " (only used in the Han script path).");
1122  "Activate character-level n-gram-based permuter");
1123  BOOL_VAR_H(permute_only_top, false, "Run only the top choice permuter");
1125  "Depth of blob choice lists to explore"
1126  " when fixed length dawgs are on");
1128  "use new state cost heuristics for segmentation state evaluation");
1130  "base factor for adding segmentation cost into word rating."
1131  "It's a multiplying factor, the larger the value above 1, "
1132  "the bigger the effect of segmentation cost.");
1134  "weight associated with char rating in combined cost of state");
1136  "weight associated with width evidence in combined cost of"
1137  " state");
1139  "weight associated with seam cut in combined cost of state");
1141  "max char width-to-height ratio allowed in segmentation");
1143  "Enable new segmentation search path.");
1145  "Maximum character width-to-height ratio for"
1146  "fixed pitch fonts");
1150  FILE *init_recog_training(const STRING &fname);
1151  void recog_training_segmented(const STRING &fname,
1152  PAGE_RES *page_res,
1153  volatile ETEXT_DESC *monitor,
1154  FILE *output_file);
1155  void ambigs_classify_and_output(const char *label,
1156  PAGE_RES_IT* pr_it,
1157  FILE *output_file);
1159 #ifndef ANDROID_BUILD
1160  inline CubeRecoContext *GetCubeRecoContext() { return cube_cntxt_; }
1161 #endif
1163  private:
1164  // The filename of a backup config file. If not null, then we currently
1165  // have a temporary debug config file loaded, and backup_config_file_
1166  // will be loaded, and set to null when debug is complete.
1167  const char* backup_config_file_;
1168  // The filename of a config file to read when processing a debug word.
1169  STRING word_config_;
1170  // Image used for input to layout analysis and tesseract recognition.
1171  // May be modified by the ShiroRekhaSplitter to eliminate the top-line.
1172  Pix* pix_binary_;
1173  // Unmodified image used for input to cube. Always valid.
1174  Pix* cube_binary_;
1175  // Grey-level input image if the input was not binary, otherwise NULL.
1176  Pix* pix_grey_;
1177  // Thresholds that were used to generate the thresholded image from grey.
1178  Pix* pix_thresholds_;
1179  // Input image resolution after any scaling. The resolution is not well
1180  // transmitted by operations on Pix, so we keep an independent record here.
1181  int source_resolution_;
1182  // The shiro-rekha splitter object which is used to split top-lines in
1183  // Devanagari words to provide a better word and grapheme segmentation.
1184  ShiroRekhaSplitter splitter_;
1185  // Page segmentation/layout
1186  Textord textord_;
1187  // True if the primary language uses right_to_left reading order.
1188  bool right_to_left_;
1189  Pix* scaled_color_;
1190  int scaled_factor_;
1191  FCOORD deskew_;
1192  FCOORD reskew_;
1193  TesseractStats stats_;
1194  // Sub-languages to be tried in addition to this.
1195  GenericVector<Tesseract*> sub_langs_;
1196  // Most recently used Tesseract out of this and sub_langs_. The default
1197  // language for the next word.
1198  Tesseract* most_recently_used_;
1199  // The size of the font table, ie max possible font id + 1.
1200  int font_table_size_;
1201 #ifndef ANDROID_BUILD
1202  // Cube objects.
1203  CubeRecoContext* cube_cntxt_;
1204  TesseractCubeCombiner *tess_cube_combiner_;
1205 #endif
1206  // Equation detector. Note: this pointer is NOT owned by the class.
1207  EquationDetect* equ_detect_;
1208 };
1210 } // namespace tesseract
double superscript_scaledown_ratio
Definition: blobs.h:261
bool ResegmentCharBox(PAGE_RES *page_res, const TBOX *prev_box, const TBOX &box, const TBOX &next_box, const char *correct_text)
Definition: applybox.cpp:340
void convert_bad_unlv_chs(WERD_RES *word_res)
Definition: docqual.cpp:663
void run_cube_combiner(PAGE_RES *page_res)
bool TrainedXheightFix(WERD_RES *word, BLOCK *block, ROW *row)
Definition: control.cpp:1402
inT16 count_alphas(const WERD_CHOICE &word)
Definition: output.cpp:400
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:1029
inT16 first_alphanum_offset(const char *word, const char *word_lengths)
Definition: reject.cpp:482
void CorrectClassifyWords(PAGE_RES *page_res)
Definition: applybox.cpp:772
BOOL8 word_dumper(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:922
void break_noisiest_blob_word(WERD_RES_LIST &words)
Definition: fixspace.cpp:616
bool right_to_left() const
void match_word_pass_n(int pass_n, WERD_RES *word, ROW *row, BLOCK *block)
Definition: control.cpp:1549
void reject_mostly_rejects(WERD_RES *word)
Definition: reject.cpp:573
BOOL8 recog_interactive(PAGE_RES_IT *pr_it)
Definition: control.cpp:84
Textord * mutable_textord()
inT16 word_outline_errs(WERD_RES *word)
Definition: docqual.cpp:77
int RetryWithLanguage(const WordData &word_data, WordRecognizer recognizer, WERD_RES **in_word, PointerVector< WERD_RES > *best_words)
Definition: control.cpp:869
inT16 worst_noise_blob(WERD_RES *word_res, float *worst_noise_score)
Definition: fixspace.cpp:681
BOOL8 word_adaptable(WERD_RES *word, uinT16 mode)
Definition: adaptions.cpp:45
void classify_word_pass2(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
Definition: control.cpp:1488
void recog_training_segmented(const STRING &fname, PAGE_RES *page_res, volatile ETEXT_DESC *monitor, FILE *output_file)
void make_reject_map(WERD_RES *word, ROW *row, inT16 pass)
void fill_werd_res(const BoxWord &cube_box_word, const char *cube_best_str, WERD_RES *tess_werd_res)
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:1190
BOOL8 potential_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level, BOOL8 ok_dict_word)
Definition: docqual.cpp:545
BOOL8 one_ell_conflict(WERD_RES *word_res, BOOL8 update_map)
Definition: reject.cpp:292
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:1105
Definition: params.h:36
void set_pix_thresholds(Pix *thresholds)
void debug_word(PAGE_RES *page_res, const TBOX &selection_box)
Definition: pgedit.cpp:641
void rejection_passes(PAGE_RES *page_res, ETEXT_DESC *monitor, const TBOX *target_word_box, const char *word_config)
Definition: control.cpp:590
void dont_allow_1Il(WERD_RES *word)
Definition: reject.cpp:526
bool create_cube_box_word(Boxa *char_boxes, int num_chars, TBOX word_box, BoxWord *box_word)
bool SubAndSuperscriptFix(WERD_RES *word_res)
#define INT_VAR_H(name, val, comment)
Definition: params.h:265
int ImageHeight() const
double segment_reward_ngram_best_choice
char * ok_repeated_ch_non_alphanum_wds
float ClassifyBlobAsWord(int pass_n, PAGE_RES_IT *pr_it, C_BLOB *blob, STRING *best_str, float *c2)
Definition: control.cpp:1232
BOOL8 word_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:761
PointerVector< WERD_RES > lang_words
bool ReassignDiacritics(int pass, PAGE_RES_IT *pr_it, bool *make_next_word_fuzzy)
Definition: control.cpp:910
char * tessedit_write_params_to_file
void blamer_pass(PAGE_RES *page_res)
Definition: control.cpp:686
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)
Definition: output.cpp:68
void recognize_page(STRING &image_name)
void recog_word(WERD_RES *word)
Definition: tfacepp.cpp:46
unsigned char BOOL8
Definition: host.h:113
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
Definition: tfacepp.cpp:182
void set_pix_grey(Pix *grey_pix)
float ComputeCompatibleXheight(WERD_RES *word_res, float *baseline_shift)
Definition: fixxht.cpp:101
void set_source_resolution(int ppi)
TessdataManager tessdata_manager
Definition: ccutil.h:71
void ReportXhtFixResult(bool accept_new_word, float new_x_ht, WERD_RES *word, WERD_RES *new_word)
Definition: control.cpp:1381
void tilde_crunch(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:421
Definition: pgedit.cpp:116
Tesseract * get_sub_lang(int index) const
int source_resolution() const
FILE * init_recog_training(const STRING &fname)
WordData(const PAGE_RES_IT &page_res_it)
PAGE_RES * ApplyBoxes(const STRING &fname, bool find_segmentation, BLOCK_LIST *block_list)
Definition: applybox.cpp:117
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:976
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)
void ParseLanguageString(const char *lang_str, GenericVector< STRING > *to_load, GenericVector< STRING > *not_to_load)
Definition: tessedit.cpp:249
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:287
int SegmentPage(const STRING *input_file, BLOCK_LIST *blocks, Tesseract *osd_tess, OSResults *osr)
inT16 safe_dict_word(const WERD_RES *werd_res)
Definition: reject.cpp:607
int CountMisfitTops(WERD_RES *word_res)
Definition: fixxht.cpp:69
inT16 eval_word_spacing(WERD_RES_LIST &word_res_list)
Definition: fixspace.cpp:240
void SetScaledColor(int factor, Pix *color)
#define STRING_VAR_H(name, val, comment)
Definition: params.h:271
void split_and_recog_word(WERD_RES *word)
Definition: tfacepp.cpp:144
void write_results(PAGE_RES_IT &page_res_it, char newline_type, BOOL8 force_eol)
Definition: output.cpp:132
Definition: ocrrow.h:32
void script_pos_pass(PAGE_RES *page_res)
Definition: control.cpp:710
inT16 count_alphanums(const WERD_CHOICE &word)
Definition: output.cpp:410
Pix * scaled_color() const
void unrej_good_quality_words(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:163
double tessedit_whole_wd_rej_row_percent
CRUNCH_MODE word_deletable(WERD_RES *word, inT16 &delete_mode)
Definition: docqual.cpp:898
void process_selected_words(PAGE_RES *page_res, TBOX &selection_box, BOOL8(tesseract::Tesseract::*word_processor)(PAGE_RES_IT *pr_it))
Definition: pagewalk.cpp:30
int ImageWidth() const
double tessedit_reject_block_percent
double textord_tabfind_vertical_text_ratio
bool FindSegmentation(const GenericVector< UNICHAR_ID > &target_text, WERD_RES *word_res)
Definition: applybox.cpp:559
inT16 alpha_count(const char *word, const char *word_lengths)
Definition: reject.cpp:495
void quality_based_rejection(PAGE_RES_IT &page_res_it, BOOL8 good_quality_doc)
Definition: docqual.cpp:140
void TidyUp(PAGE_RES *page_res)
Definition: applybox.cpp:706
void fix_fuzzy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *block)
Definition: fixspace.cpp:145
bool crunch_early_convert_bad_unlv_chs
int scaled_factor() const
CubeRecoContext * GetCubeRecoContext()
inT16 first_alphanum_index(const char *word, const char *word_lengths)
Definition: reject.cpp:469
BOOL8 acceptable_number_string(const char *s, const char *lengths)
Definition: output.cpp:421
void reject_edge_blobs(WERD_RES *word)
Definition: reject.cpp:263
bool textord_tabfind_vertical_horizontal_mix
inT16 failure_count(WERD_RES *word)
Definition: docqual.cpp:969
inT16 count_outline_errs(char c, inT16 outline_count)
Definition: docqual.cpp:128
BOOL8 word_set_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:946
BOOL8 check_debug_pt(WERD_RES *word, int location)
Definition: control.cpp:1767
void word_char_quality(WERD_RES *word, ROW *row, inT16 *match_count, inT16 *accepted_match_count)
Definition: docqual.cpp:97
bool ProcessTargetWord(const TBOX &word_box, const TBOX &target_word_box, const char *word_config, int pass)
Definition: control.cpp:118
Definition: pageres.h:145
void PrepareForTessOCR(BLOCK_LIST *block_list, Tesseract *osd_tess, OSResults *osr)
void process_image_event(const SVEvent &event)
Definition: pgedit.cpp:565
void ReportFailedBox(int boxfile_lineno, TBOX box, const char *box_ch, const char *err_msg)
Definition: applybox.cpp:764
bool tessedit_enable_bigram_correction
int num_sub_langs() const
bool tessedit_resegment_from_line_boxes
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
Definition: tfacepp.cpp:240
Definition: ocrblock.h:30
bool extract_cube_state(CubeObject *cube_obj, int *num_chars, Boxa **char_boxes, CharSamp ***char_samples)
void nn_match_word(WERD_RES *word, ROW *row)
BOOL8 word_blank_and_set_display(PAGE_RES_IT *pr_its)
Definition: pgedit.cpp:717
Definition: control.h:34
void read_config_file(const char *filename, SetParamConstraint constraint)
Definition: tessedit.cpp:52
const Textord & textord() const
bool RunOldFixXht(WERD_RES *word, BLOCK *block, ROW *row)
BOOL8 process_cmd_win_event(inT32 cmd_event, char *new_value)
Definition: pgedit.cpp:397
bool init_cube_objects(bool load_combiner, TessdataManager *tessdata_manager)
void classify_word_pass1(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
Definition: control.cpp:1344
BOOL8 word_contains_non_1_digit(const char *word, const char *word_lengths)
Definition: reject.cpp:509
bool RecogAllWordsPassN(int pass_n, ETEXT_DESC *monitor, PAGE_RES_IT *pr_it, GenericVector< WordData > *words)
Definition: control.cpp:207
void dictionary_correction_pass(PAGE_RES *page_res)
Definition: control.cpp:2015
void pgeditor_main(int width, int height, PAGE_RES *page_res)
Definition: pgedit.cpp:337
Pix * pix_grey() const
void font_recognition_pass(PAGE_RES *page_res)
Definition: control.cpp:1958
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)
Definition: applybox.cpp:629
UNICHAR_ID get_rep_char(WERD_RES *word)
Definition: output.cpp:285
#define double_VAR_H(name, val, comment)
Definition: params.h:274
GARBAGE_LEVEL garbage_word(WERD_RES *word, BOOL8 ok_dict_word)
Definition: docqual.cpp:683
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
Definition: control.cpp:1663
BOOL8 word_bln_display(PAGE_RES_IT *pr_it)
Definition: pgedit.cpp:729
Definition: unichar.h:33
void fix_noisy_space_list(WERD_RES_LIST &best_perm, ROW *row, BLOCK *block)
Definition: fixspace.cpp:570
void bigram_correction_pass(PAGE_RES *page_res)
Definition: control.cpp:442
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)
Definition: tessedit.cpp:389
Definition: werd.h:60
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)
Definition: tessedit.cpp:83
void SetupWordPassN(int pass_n, WordData *word)
Definition: control.cpp:171
Pix * BestPix() const
void tess_segment_pass_n(int pass_n, WERD_RES *word)
Definition: tessbox.cpp:39
double tessedit_reject_row_percent
void cube_word_pass1(BLOCK *block, ROW *row, WERD_RES *word)
inT16 word_blob_quality(WERD_RES *word, ROW *row)
Definition: docqual.cpp:65
Assume a single uniform block of text. (Default.)
Definition: publictypes.h:160
void doc_and_block_rejection(PAGE_RES_IT &page_res_it, BOOL8 good_quality_doc)
Definition: docqual.cpp:235
WordData(BLOCK *block_in, ROW *row_in, WERD_RES *word_res)
int init_tesseract(const char *datapath, const char *language, OcrEngineMode oem)
double heuristic_segcost_rating_base
void set_unlv_suspects(WERD_RES *word)
Definition: output.cpp:307
BOOL8 terrible_word_crunch(WERD_RES *word, GARBAGE_LEVEL garbage_level)
Definition: docqual.cpp:507
void match_current_words(WERD_RES_LIST &words, ROW *row, BLOCK *block)
Definition: fixspace.cpp:196
void SetupAllWordsPassN(int pass_n, const TBOX *target_word_box, const char *word_config, PAGE_RES *page_res, GenericVector< WordData > *words)
Definition: control.cpp:148
double rej_whole_of_mostly_reject_word_fract
bool AnyTessLang() const
void fix_rep_char(PAGE_RES_IT *page_res_it)
Definition: control.cpp:1624
float blob_noise_score(TBLOB *blob)
Definition: fixspace.cpp:761
bool ResegmentWordBox(BLOCK_LIST *block_list, const TBOX &box, const TBOX &next_box, const char *correct_text)
Definition: applybox.cpp:438
int AutoPageSeg(PageSegMode pageseg_mode, BLOCK_LIST *blocks, TO_BLOCK_LIST *to_blocks, BLOBNBOX_LIST *diacritic_blobs, Tesseract *osd_tess, OSResults *osr)
void classify_word_and_language(int pass_n, PAGE_RES_IT *pr_it, WordData *word_data)
Definition: control.cpp:1268
void recog_pseudo_word(PAGE_RES *page_res, TBOX &selection_box)
Definition: control.cpp:68
void ApplyBoxTraining(const STRING &fontname, PAGE_RES *page_res)
Definition: applybox.cpp:796
void blob_feature_display(PAGE_RES *page_res, const TBOX &selection_box)
Definition: pgedit.cpp:960
bool tessedit_preserve_row_rej_perfect_wds
BOOL8 fixspace_thinks_word_done(WERD_RES *word)
Definition: fixspace.cpp:504
inT16 fp_eval_word_spacing(WERD_RES_LIST &word_res_list)
Definition: fixspace.cpp:831
void set_word_fonts(WERD_RES *word)
Definition: control.cpp:1880
#define FALSE
Definition: capi.h:29
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)
Definition: tessedit.cpp:285
double tessedit_good_doc_still_rowrej_wd
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)
BOOL8 non_O_upper(const UNICHARSET &ch_set, UNICHAR_ID unichar_id)
Definition: reject.cpp:785
Definition: docqual.h:25
bool TestNewNormalization(int original_misfits, float baseline_shift, float new_x_ht, WERD_RES *word, BLOCK *block, ROW *row)
Definition: control.cpp:1437
void unrej_good_chs(WERD_RES *word, ROW *row)
Definition: docqual.cpp:117
void SetEquationDetect(EquationDetect *detector)
void nn_recover_rejects(WERD_RES *word, ROW *row)
void flip_hyphens(WERD_RES *word)
Definition: reject.cpp:616
BOOL8 noise_outlines(TWERD *word)
Definition: docqual.cpp:981
Definition: rect.h:30
void do_re_display(BOOL8(tesseract::Tesseract::*word_painter)(PAGE_RES_IT *pr_it))
Definition: pgedit.cpp:308
void recog_word_recursive(WERD_RES *word)
Definition: tfacepp.cpp:110
void(Tesseract::* WordRecognizer)(const WordData &word_data, WERD_RES **in_word, PointerVector< WERD_RES > *out_words)
bool tess_acceptable_word(WERD_RES *word)
Definition: tessbox.cpp:69
void MaximallyChopWord(const GenericVector< TBOX > &boxes, BLOCK *block, ROW *row, WERD_RES *word_res)
Definition: applybox.cpp:253
void SetupUniversalFontIds()
Definition: tessedit.cpp:439
bool cube_recognize(CubeObject *cube_obj, BLOCK *block, WERD_RES *word)
double tessedit_reject_doc_percent
void SetupWordScripts(BLOCK_LIST *blocks)
const FCOORD & reskew() const
void PrerecAllWordsPar(const GenericVector< WordData > &words)
Definition: par_control.cpp:36
void cube_combine_word(CubeObject *cube_obj, WERD_RES *cube_word, WERD_RES *tess_word)
Definition: strngs.h:44
#define NULL
Definition: host.h:144
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)
void fix_sp_fp_word(WERD_RES_IT &word_res_it, ROW *row, BLOCK *block)
Definition: fixspace.cpp:536
double superscript_worse_certainty
Pix * pix_binary() const
Definition: blobs.h:395
PAGE_RES * SetupApplyBoxes(const GenericVector< TBOX > &boxes, BLOCK_LIST *block_list)
Definition: applybox.cpp:217
void reject_I_1_L(WERD_RES *word)
Definition: reject.cpp:191
void set_done(WERD_RES *word, inT16 pass)
void PreenXHeights(BLOCK_LIST *block_list)
Definition: applybox.cpp:193
bool ConvertStringToUnichars(const char *utf8, GenericVector< UNICHAR_ID > *class_ids)
Definition: applybox.cpp:535
BOOL8 repeated_nonalphanum_wd(WERD_RES *word, ROW *row)
Definition: reject.cpp:582
SVMenuNode * build_menu_new()
Definition: pgedit.cpp:257
void tilde_delete(PAGE_RES_IT &page_res_it)
Definition: docqual.cpp:593
bool textord_tabfind_force_vertical_text
double segsearch_max_fixed_pitch_char_wh_ratio
bool BelievableSuperscript(bool debug, const WERD_RES &word, float certainty_threshold, int *left_ok, int *right_ok) const
CubeObject * cube_recognize_word(BLOCK *block, WERD_RES *word)
bool applybox_learn_chars_and_char_frags_mode
#define BOOL_VAR_H(name, val, comment)
Definition: params.h:268
Definition: points.h:189
void ambigs_classify_and_output(const char *label, PAGE_RES_IT *pr_it, FILE *output_file)
bool tessedit_preserve_blk_rej_perfect_wds
void fix_fuzzy_spaces(ETEXT_DESC *monitor, inT32 word_count, PAGE_RES *page_res)
Definition: fixspace.cpp:48
double textord_tabfind_aligned_gap_fraction
BOOL8 digit_or_numeric_punct(WERD_RES *word, int char_position)
Definition: fixspace.cpp:344
int init_tesseract_lm(const char *arg0, const char *textbase, const char *language)
Definition: tessedit.cpp:460
void flip_0O(WERD_RES *word)
Definition: reject.cpp:673
void dump_words(WERD_RES_LIST &perm, inT16 score, inT16 mode, BOOL8 improved)
Definition: fixspace.cpp:450
void ReSegmentByClassification(PAGE_RES *page_res)
Definition: applybox.cpp:509
unsigned short uinT16
Definition: host.h:101
double superscript_bettered_certainty
BOOL8 non_0_digit(const UNICHARSET &ch_set, UNICHAR_ID unichar_id)
Definition: reject.cpp:789
short inT16
Definition: host.h:100
int language_model_fixed_length_choices_depth
int inT32
Definition: host.h:102
void tess_add_doc_word(WERD_CHOICE *word_choice)
Definition: tessbox.cpp:79