21 #pragma warning(disable:4244) // Conversion warnings
22 #pragma warning(disable:4305) // int/float warnings
23 #pragma warning(disable:4800) // int/bool warnings
43 #define MAX_UNDIVIDED_LENGTH 24
55 BLOB_CHOICE_LIST_CLIST *blob_choices) {
61 tprintf(
"recog_word ASSERT FAIL String:\"%s\"; "
62 "Strlen=%d; #Blobs=%d; #Choices=%d\n",
65 blob_choices->length());
72 if ((perm_type != SYSTEM_DAWG_PERM) &&
73 (perm_type != FREQ_DAWG_PERM) && (perm_type != USER_DAWG_PERM)) {
75 if (((real_dict_perm_type == SYSTEM_DAWG_PERM) ||
76 (real_dict_perm_type == FREQ_DAWG_PERM) ||
77 (real_dict_perm_type == USER_DAWG_PERM)) &&
85 tprintf(
"Permuter Type Flipped from %d to %d\n",
110 BLOB_CHOICE_LIST_CLIST *blob_choices) {
115 int initial_blob_choice_len = blob_choices->length();
119 BLOB_CHOICE_LIST_C_IT blob_choices_it(blob_choices);
120 for (
int i = 0; i < tess_ratings->
length(); ++i) {
121 blob_choices_it.add_to_end(tess_ratings->
get(i));
138 tprintf(
"recog_word: Discarded long string \"%s\""
139 " (%d characters vs %d blobs)\n",
145 if (blob_choices->length() - initial_blob_choice_len != word_length) {
147 tprintf(
"recog_word: Choices list len:%d; blob lists len:%d\n",
148 blob_choices->length(), word_length);
149 blob_choices_it.set_to_list(blob_choices);
150 while (blob_choices->length() - initial_blob_choice_len < word_length) {
151 blob_choices_it.add_to_end(
new BLOB_CHOICE_LIST());
152 tprintf(
"recog_word: Added dummy choice list\n");
154 while (blob_choices->length() - initial_blob_choice_len > word_length) {
155 blob_choices_it.move_to_last();
156 delete blob_choices_it.extract();
157 tprintf(
"recog_word: Deleted choice list\n");
178 BLOB_CHOICE_LIST_CLIST *blob_choices) {
186 if (prev_blob !=
NULL) {
188 TBOX blob_box = blob->bounding_box();
189 int gap = blob_box.
left() - prev_box.
right();
192 best_end = prev_blob;
193 best_split_pt.
x = (prev_box.
right() + blob_box.
left()) / 2;
194 best_split_pt.
y = (prev_box.
top() + prev_box.
bottom() +
218 if (orig_bb !=
NULL) {
221 int begin2_truth_index = -1;
226 blamer_debug =
"Looking for truth split at";
229 blamer_debug +=
"\nnorm_truth_word boxes:\n";
238 begin2_truth_index = b;
239 blamer_debug +=
"Split found\n";
249 if (begin2_truth_index > 0) {
266 blamer_debug +=
"Truth split not found";
268 "\n" :
" (no truth char boxes)\n";
283 best_end = best_end->
next);
306 const int kAltsPerPiece = 2;
308 const int kTooManyAltChoices = 100;
320 for (
int i = 0; i < num_first_alt_choices &&
321 (i <= kAltsPerPiece ||
336 for (
int i = 0; i < num_first_alt_choices; i++) {
344 if (orig_bb !=
NULL) {
350 blamer_debug +=
"Blame from part 1: ";
357 blamer_debug +=
"Blame from part 2: ";