151 {
153 if (coord.Valid(*word_res->
ratings) &&
155 return false;
156 }
157 if (debug_level_ > 3) {
158 tprintf(
"Generating pain point for col=%d row=%d type=%s\n",
159 col, row, LMPainPointsTypeName[pp_type]);
160 }
161
162 AssociateStats associate_stats;
164 max_char_wh_ratio, word_res, debug_level_,
165 &associate_stats);
166
167
168
169
170 if (ok_to_extend) {
171 while (associate_stats.bad_fixed_pitch_right_gap &&
173 !associate_stats.bad_fixed_pitch_wh_ratio) {
175 max_char_wh_ratio, word_res, debug_level_,
176 &associate_stats);
177 }
178 }
179 if (associate_stats.bad_shape) {
180 if (debug_level_ > 3) {
181 tprintf(
"Discarded pain point with a bad shape\n");
182 }
183 return false;
184 }
185
186
187 if (pain_points_heaps_[pp_type].size() < max_heap_size_) {
188
189 float priority;
191 priority = special_priority;
192 } else {
193 priority = associate_stats.gap_sum;
194 }
196 pain_points_heaps_[pp_type].
Push(&pain_point);
197 if (debug_level_) {
198 tprintf(
"Added pain point with priority %g\n", priority);
199 }
200 return true;
201 } else {
202 if (debug_level_)
tprintf(
"Pain points heap is full\n");
203 return false;
204 }
205}
static void ComputeStats(int col, int row, const AssociateStats *parent_stats, int parent_path_length, bool fixed_pitch, float max_char_wh_ratio, WERD_RES *word_res, bool debug, AssociateStats *stats)