tesseract  4.00.00dev
wordrec.cpp
Go to the documentation of this file.
1 // File: wordrec.cpp
3 // Description: wordrec class.
4 // Author: Samuel Charron
5 //
6 // (C) Copyright 2006, Google Inc.
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
18 
19 #include "wordrec.h"
20 
21 #include "language_model.h"
22 #include "params.h"
23 
24 
25 namespace tesseract {
27  // control parameters
28  BOOL_MEMBER(merge_fragments_in_matrix, TRUE,
29  "Merge the fragments in the ratings matrix and delete them"
30  " after merging", params()),
31  BOOL_MEMBER(wordrec_no_block, FALSE, "Don't output block information",
32  params()),
33  BOOL_MEMBER(wordrec_enable_assoc, TRUE, "Associator Enable",
34  params()),
35  BOOL_MEMBER(force_word_assoc, FALSE,
36  "force associator to run regardless of what enable_assoc is."
37  "This is used for CJK where component grouping is necessary.",
38  CCUtil::params()),
39  double_MEMBER(wordrec_worst_state, 1.0, "Worst segmentation state",
40  params()),
41  BOOL_MEMBER(fragments_guide_chopper, FALSE,
42  "Use information from fragments to guide chopping process",
43  params()),
44  INT_MEMBER(repair_unchopped_blobs, 1, "Fix blobs that aren't chopped",
45  params()),
46  double_MEMBER(tessedit_certainty_threshold, -2.25, "Good blob limit",
47  params()),
48  INT_MEMBER(chop_debug, 0, "Chop debug",
49  params()),
50  BOOL_MEMBER(chop_enable, 1, "Chop enable",
51  params()),
52  BOOL_MEMBER(chop_vertical_creep, 0, "Vertical creep",
53  params()),
54  INT_MEMBER(chop_split_length, 10000, "Split Length",
55  params()),
56  INT_MEMBER(chop_same_distance, 2, "Same distance",
57  params()),
58  INT_MEMBER(chop_min_outline_points, 6, "Min Number of Points on Outline",
59  params()),
60  INT_MEMBER(chop_seam_pile_size, 150, "Max number of seams in seam_pile",
61  params()),
62  BOOL_MEMBER(chop_new_seam_pile, 1, "Use new seam_pile", params()),
63  INT_MEMBER(chop_inside_angle, -50, "Min Inside Angle Bend",
64  params()),
65  INT_MEMBER(chop_min_outline_area, 2000, "Min Outline Area",
66  params()),
67  double_MEMBER(chop_split_dist_knob, 0.5, "Split length adjustment",
68  params()),
69  double_MEMBER(chop_overlap_knob, 0.9, "Split overlap adjustment",
70  params()),
71  double_MEMBER(chop_center_knob, 0.15, "Split center adjustment",
72  params()),
73  INT_MEMBER(chop_centered_maxwidth, 90, "Width of (smaller) chopped blobs "
74  "above which we don't care that a chop is not near the center.",
75  params()),
76  double_MEMBER(chop_sharpness_knob, 0.06, "Split sharpness adjustment",
77  params()),
78  double_MEMBER(chop_width_change_knob, 5.0, "Width change adjustment",
79  params()),
80  double_MEMBER(chop_ok_split, 100.0, "OK split limit",
81  params()),
82  double_MEMBER(chop_good_split, 50.0, "Good split limit",
83  params()),
84  INT_MEMBER(chop_x_y_weight, 3, "X / Y length weight",
85  params()),
86  INT_MEMBER(segment_adjust_debug, 0, "Segmentation adjustment debug",
87  params()),
88  BOOL_MEMBER(assume_fixed_pitch_char_segment, FALSE,
89  "include fixed-pitch heuristics in char segmentation",
90  params()),
91  INT_MEMBER(wordrec_debug_level, 0,
92  "Debug level for wordrec", params()),
93  INT_MEMBER(wordrec_max_join_chunks, 4,
94  "Max number of broken pieces to associate", params()),
95  BOOL_MEMBER(wordrec_skip_no_truth_words, false,
96  "Only run OCR for words that had truth recorded in BlamerBundle",
97  params()),
98  BOOL_MEMBER(wordrec_debug_blamer, false,
99  "Print blamer debug messages", params()),
100  BOOL_MEMBER(wordrec_run_blamer, false,
101  "Try to set the blame for errors", params()),
102  INT_MEMBER(segsearch_debug_level, 0,
103  "SegSearch debug level", params()),
104  INT_MEMBER(segsearch_max_pain_points, 2000,
105  "Maximum number of pain points stored in the queue",
106  params()),
107  INT_MEMBER(segsearch_max_futile_classifications, 20,
108  "Maximum number of pain point classifications per chunk that"
109  "did not result in finding a better word choice.",
110  params()),
111  double_MEMBER(segsearch_max_char_wh_ratio, 2.0,
112  "Maximum character width-to-height ratio", params()),
113  BOOL_MEMBER(save_alt_choices, true,
114  "Save alternative paths found during chopping"
115  " and segmentation search",
116  params()) {
117  prev_word_best_choice_ = NULL;
119  &(getDict()));
120  fill_lattice_ = NULL;
121 }
122 
124  delete language_model_;
125 }
126 
127 } // namespace tesseract
#define TRUE
Definition: capi.h:45
Dict & getDict()
Definition: classify.h:65
#define double_MEMBER(name, val, comment, vec)
Definition: params.h:309
UnicityTable< FontInfo > & get_fontinfo_table()
Definition: classify.h:344
virtual ~Wordrec()
Definition: wordrec.cpp:123
#define FALSE
Definition: capi.h:46
void(Wordrec::* fill_lattice_)(const MATRIX &ratings, const WERD_CHOICE_LIST &best_choices, const UNICHARSET &unicharset, BlamerBundle *blamer_bundle)
Definition: wordrec.h:419
LanguageModel * language_model_
Definition: wordrec.h:410
#define BOOL_MEMBER(name, val, comment, vec)
Definition: params.h:303
#define INT_MEMBER(name, val, comment, vec)
Definition: params.h:300
WERD_CHOICE * prev_word_best_choice_
Definition: wordrec.h:415