41 if (pain_points_heaps_[h].empty())
continue;
42 *priority = pain_points_heaps_[h].
PeekTop().
key;
44 pain_points_heaps_[h].
Pop(
nullptr);
53 for (
int col = 0; col < ratings->
dimension(); ++col) {
55 for (
int row = col + 1; row < row_end; ++row) {
57 if (coord.
Valid(*ratings) &&
64 true, max_char_wh_ratio_, word_res);
112 float priority = ol_dif > 0 ? (vse->
ratings_sum-rat_subtr)/ol_dif : 0.0;
114 priority,
true, max_char_wh_ratio_, word_res);
115 }
else if (debug_level_ > 3) {
116 tprintf(
"NO pain point (Classified) for col=%d row=%d type=%s\n",
117 pain_coord.
col, pain_coord.
row,
121 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
127 curr_vse = parent_vse;
128 curr_b = curr_vse->
curr_b;
137 for (
int d = 0; d < fixpt.
size(); ++d) {
150 bool ok_to_extend,
float max_char_wh_ratio,
157 if (debug_level_ > 3) {
158 tprintf(
"Generating pain point for col=%d row=%d type=%s\n",
159 col, row, LMPainPointsTypeName[pp_type]);
164 max_char_wh_ratio, word_res, debug_level_,
175 max_char_wh_ratio, word_res, debug_level_,
180 if (debug_level_ > 3) {
181 tprintf(
"Discarded pain point with a bad shape\n");
187 if (pain_points_heaps_[pp_type].size() < max_heap_size_) {
191 priority = special_priority;
193 priority = associate_stats.
gap_sum;
196 pain_points_heaps_[pp_type].
Push(&pain_point);
198 tprintf(
"Added pain point with priority %g\n", priority);
202 if (debug_level_)
tprintf(
"Pain points heap is full\n");
214 for (
int j = 0; j < heap->
size(); ++j)
215 (*heap)[j].data.MapForSplit(index);
bool GeneratePainPoint(int col, int row, LMPainPointsType pp_type, float special_priority, bool ok_to_extend, float max_char_wh_ratio, WERD_RES *word_res)
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)
UNICHAR_ID WildcardID() const
BLOB_CHOICE * curr_b
Pointers to BLOB_CHOICE and parent ViterbiStateEntry (not owned by this).
GenericVector< Pair > * heap()
bool bad_fixed_pitch_wh_ratio
void RemapForSplit(int index)
bool Valid(const MATRIX &m) const
static const float kDefaultPainPointPriorityAdjustment
static const float kLooseMaxCharWhRatio
LMPainPointsType Deque(MATRIX_COORD *pp, float *priority)
void GenerateInitial(WERD_RES *word_res)
const Pair & PeekTop() const
DLLSYM void tprintf(const char *format,...)
bool bad_fixed_pitch_right_gap
void GenerateFromPath(float rating_cert_scale, ViterbiStateEntry *vse, WERD_RES *word_res)
const MATRIX_COORD & matrix_cell()
static float ComputeOutlineLength(float rating_cert_scale, const BLOB_CHOICE &b)
bool Classified(int col, int row, int wildcard_id) const
ViterbiStateEntry * parent_vse
void GenerateFromAmbigs(const DANGERR &fixpt, ViterbiStateEntry *vse, WERD_RES *word_res)