39 if (pain_points_heaps_[h].empty())
continue;
40 *priority = pain_points_heaps_[h].
PeekTop().
key;
42 pain_points_heaps_[h].
Pop(NULL);
51 for (
int col = 0; col < ratings->
dimension(); ++col) {
53 for (
int row = col + 1; row < row_end; ++row) {
55 if (coord.
Valid(*ratings) &&
62 true, max_char_wh_ratio_, word_res);
110 float priority = ol_dif > 0 ? (vse->
ratings_sum-rat_subtr)/ol_dif : 0.0;
112 priority,
true, max_char_wh_ratio_, word_res);
113 }
else if (debug_level_ > 3) {
114 tprintf(
"NO pain point (Classified) for col=%d row=%d type=%s\n",
115 pain_coord.
col, pain_coord.
row,
119 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
125 curr_vse = parent_vse;
126 curr_b = curr_vse->
curr_b;
135 for (
int d = 0; d < fixpt.
size(); ++d) {
148 bool ok_to_extend,
float max_char_wh_ratio,
155 if (debug_level_ > 3) {
156 tprintf(
"Generating pain point for col=%d row=%d type=%s\n",
157 col, row, LMPainPointsTypeName[pp_type]);
162 max_char_wh_ratio, word_res, debug_level_,
173 max_char_wh_ratio, word_res, debug_level_,
178 if (debug_level_ > 3) {
179 tprintf(
"Discarded pain point with a bad shape\n");
185 if (pain_points_heaps_[pp_type].size() < max_heap_size_) {
189 priority = special_priority;
191 priority = associate_stats.
gap_sum;
194 pain_points_heaps_[pp_type].
Push(&pain_point);
196 tprintf(
"Added pain point with priority %g\n", priority);
200 if (debug_level_)
tprintf(
"Pain points heap is full\n");
212 for (
int j = 0; j < heap->
size(); ++j)
213 (*heap)[j].data.MapForSplit(index);
void RemapForSplit(int index)
static const float kDefaultPainPointPriorityAdjustment
bool Classified(int col, int row, int wildcard_id) const
GenericVector< Pair > * heap()
bool bad_fixed_pitch_wh_ratio
bool Valid(const MATRIX &m) const
static float ComputeOutlineLength(float rating_cert_scale, const BLOB_CHOICE &b)
LMPainPointsType Deque(MATRIX_COORD *pp, float *priority)
void GenerateFromAmbigs(const DANGERR &fixpt, ViterbiStateEntry *vse, WERD_RES *word_res)
const Pair & PeekTop() const
UNICHAR_ID WildcardID() const
ViterbiStateEntry * parent_vse
void GenerateFromPath(float rating_cert_scale, ViterbiStateEntry *vse, WERD_RES *word_res)
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 const float kLooseMaxCharWhRatio
void GenerateInitial(WERD_RES *word_res)
const MATRIX_COORD & matrix_cell()
bool bad_fixed_pitch_right_gap
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)
BLOB_CHOICE * curr_b
Pointers to BLOB_CHOICE and parent ViterbiStateEntry (not owned by this).