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: ";
bool tessedit_override_permuter
const STRING & unichar_string() const
SEAMS start_seam_list(TBLOB *blobs)
IncorrectResultReason incorrect_result_reason
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
const STRING debug_string() const
bool tessedit_rejection_debug
BLOB_CHOICE_LIST_VECTOR * cc_recog(WERD_RES *word)
void append_unichar_id(UNICHAR_ID unichar_id, char fragment_length, float rating, float certainty)
GenericVector< WERD_CHOICE * > alt_choices
void make_bad()
Set the fields in this choice to be default (bad) values.
GenericVector< int > best_state
void append_debug(STRING *str) const
GenericVector< GenericVector< int > > alt_states
tesseract::BoxWord truth_word
void add_str_int(const char *str, int number)
tesseract::BoxWord norm_truth_word
void rej_word_tess_failure()
GenericVector< STRING > truth_text
const char * string() const
void SetBlame(IncorrectResultReason irr, const STRING &msg, const WERD_CHOICE *choice, bool debug)
int dict_word(const WERD_CHOICE &word)
#define MAX_UNDIVIDED_LENGTH
void free_seam_list(SEAMS seam_list)
DLLSYM void tprintf(const char *format,...)
bool wordrec_debug_blamer
TBOX bounding_box() const
inT16 alpha_count(const char *word, const char *word_lengths)
const STRING & unichar_lengths() const
void InsertBox(int index, const TBOX &box)
bool truth_has_char_boxes
tesseract::BoxWord * box_word
const TBOX & BlobBox(int index) const
SEAM * new_seam(PRIORITY priority, const TPOINT &location, SPLIT *split1, SPLIT *split2, SPLIT *split3)
SEAMS add_seam(SEAMS seam_list, SEAM *seam)
#define array_value(a, i)
void recog_word_recursive(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
void recog_word(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
void split_and_recog_word(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
BlamerBundle * blamer_bundle
void initialise(inT16 length)
WERD_CHOICE * best_choice
void set_permuter(uinT8 perm)