21 #pragma warning(disable:4244) // Conversion warnings 22 #pragma warning(disable:4305) // int/float warnings 23 #pragma warning(disable:4800) // int/bool warnings 35 #define MAX_UNDIVIDED_LENGTH 24 57 tprintf(
"recog_word ASSERT FAIL String:\"%s\"; " 58 "Strlen=%d; #Blobs=%d\n",
66 tprintf(
"Not all words have valid states relative to ratings matrix!!");
86 tprintf(
"Permuter Type Flipped from %d to %d\n",
121 tprintf(
"recog_word: Discarded long string \"%s\"" 122 " (%d characters vs %d blobs)\n",
151 int gap = blob_box.
left() - prev_box.
right();
161 split_word(word, split_index, &word2, &orig_bb);
186 ASSERT_HOST(split_pt >0 && split_pt < word->chopped_word->NumBlobs());
199 for (
int i = split_pt; i < chopped->
NumBlobs(); ++i) {
216 if (orig_bb != NULL) {
227 *right_piece = word2;
228 *orig_blamer_bundle = orig_bb;
251 split_pt.
x = (prev_box.
right() + blob_box.
left()) / 2;
252 split_pt.
y = (prev_box.
top() + prev_box.
bottom() +
273 const int kAltsPerPiece = 2;
275 const int kTooManyAltChoices = 100;
278 WERD_CHOICE_LIST joined_choices;
279 WERD_CHOICE_IT jc_it(&joined_choices);
283 int total_joined_choices = num_word1_choices;
289 for (bc2_it.forward(); !bc2_it.at_first(); bc2_it.forward(), ++bc2_index) {
290 if (total_joined_choices >= kTooManyAltChoices &&
291 bc2_index > kAltsPerPiece)
294 for (bc1_it.move_to_first(); bc1_index < num_word1_choices;
295 ++bc1_index, bc1_it.forward()) {
296 if (total_joined_choices >= kTooManyAltChoices &&
297 bc1_index > kAltsPerPiece)
300 *wc += *bc2_it.data();
301 jc_it.add_after_then_move(wc);
302 ++total_joined_choices;
307 bc1_it.move_to_first();
308 bc2_it.move_to_first();
309 for (bc1_it.mark_cycle_pt(); !bc1_it.cycled_list(); bc1_it.forward()) {
310 *bc1_it.data() += *bc2_it.data();
312 bc1_it.move_to_last();
313 bc1_it.add_list_after(&joined_choices);
317 if (orig_bb != NULL) {
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
void SetupBasicsFromChoppedWord(const UNICHARSET &unicharset_in)
GenericVector< TBLOB * > blobs
void recog_word_recursive(WERD_RES *word)
const STRING & unichar_string() const
void initialise(inT16 length)
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
bool tessedit_override_permuter
void set_permuter(uinT8 perm)
void DebugWordChoices(bool debug, const char *word_to_debug)
void rej_word_tess_failure()
WERD_CHOICE * best_choice
TBOX bounding_box() const
GenericVector< SEAM * > seam_array
void recog_word(WERD_RES *word)
IncorrectResultReason incorrect_result_reason() const
tesseract::BoxWord * box_word
const char * string() const
void make_bad()
Set the fields in this choice to be default (bad) values.
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
GenericVector< int > blob_gaps
BlamerBundle * blamer_bundle
bool tessedit_rejection_debug
WERD_CHOICE_LIST best_choices
UNICHAR_ID TESS_API unichar_to_id(const char *const unichar_repr) const
#define MAX_UNDIVIDED_LENGTH
bool wordrec_debug_blamer
const UNICHARSET * uch_set
int dict_word(const WERD_CHOICE &word)
void cc_recog(WERD_RES *word)
void split_and_recog_word(WERD_RES *word)
const STRING & unichar_lengths() const
void AttachOnCorner(BandTriMatrix< T > *array2)
bool wordrec_skip_no_truth_words
GenericVector< int > blob_widths
GenericVector< int > best_state
inT16 alpha_count(const char *word, const char *word_lengths)
const STRING debug_string() const
TBOX bounding_box() const
void append_unichar_id(UNICHAR_ID unichar_id, int blob_count, float rating, float certainty)