29 #define MAX_UNDIVIDED_LENGTH 24 51 tprintf(
"recog_word ASSERT FAIL String:\"%s\"; " 52 "Strlen=%d; #Blobs=%d\n",
60 tprintf(
"Not all words have valid states relative to ratings matrix!!");
80 tprintf(
"Permuter Type Flipped from %d to %d\n",
115 tprintf(
"recog_word: Discarded long string \"%s\"" 116 " (%d characters vs %d blobs)\n",
140 int bestgap = -INT32_MAX;
145 int gap = blob_box.
left() - prev_box.
right();
155 split_word(word, split_index, &word2, &orig_bb);
180 ASSERT_HOST(split_pt >0 && split_pt < word->chopped_word->NumBlobs());
193 for (
int i = split_pt; i < chopped->
NumBlobs(); ++i) {
210 if (orig_bb !=
nullptr) {
221 *right_piece = word2;
222 *orig_blamer_bundle = orig_bb;
245 split_pt.
x = (prev_box.
right() + blob_box.
left()) / 2;
246 split_pt.
y = (prev_box.
top() + prev_box.
bottom() +
267 const int kAltsPerPiece = 2;
269 const int kTooManyAltChoices = 100;
272 WERD_CHOICE_LIST joined_choices;
273 WERD_CHOICE_IT jc_it(&joined_choices);
277 int total_joined_choices = num_word1_choices;
283 for (bc2_it.forward(); !bc2_it.at_first(); bc2_it.forward(), ++bc2_index) {
284 if (total_joined_choices >= kTooManyAltChoices &&
285 bc2_index > kAltsPerPiece)
288 for (bc1_it.move_to_first(); bc1_index < num_word1_choices;
289 ++bc1_index, bc1_it.forward()) {
290 if (total_joined_choices >= kTooManyAltChoices &&
291 bc1_index > kAltsPerPiece)
294 *wc += *bc2_it.data();
295 jc_it.add_after_then_move(wc);
296 ++total_joined_choices;
301 bc1_it.move_to_first();
302 bc2_it.move_to_first();
303 for (bc1_it.mark_cycle_pt(); !bc1_it.cycled_list(); bc1_it.forward()) {
304 *bc1_it.data() += *bc2_it.data();
306 bc1_it.move_to_last();
307 bc1_it.add_list_after(&joined_choices);
311 if (orig_bb !=
nullptr) {
#define MAX_UNDIVIDED_LENGTH
int16_t alpha_count(const char *word, const char *word_lengths)
WERD_CHOICE_LIST best_choices
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
int dict_word(const WERD_CHOICE &word)
bool tessedit_rejection_debug
GenericVector< int > blob_widths
const char * string() const
bool wordrec_skip_no_truth_words
TBOX bounding_box() const
void append_unichar_id(UNICHAR_ID unichar_id, int blob_count, float rating, float certainty)
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
void make_bad()
Set the fields in this choice to be default (bad) values.
bool tessedit_override_permuter
void recog_word(WERD_RES *word)
const STRING & unichar_lengths() const
void cc_recog(WERD_RES *word)
void DebugWordChoices(bool debug, const char *word_to_debug)
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
void split_and_recog_word(WERD_RES *word)
IncorrectResultReason incorrect_result_reason() const
GenericVector< int > best_state
DLLSYM void tprintf(const char *format,...)
TBOX bounding_box() const
GenericVector< SEAM * > seam_array
GenericVector< int > blob_gaps
GenericVector< TBLOB * > blobs
void SetupBasicsFromChoppedWord(const UNICHARSET &unicharset_in)
const STRING debug_string() const
const UNICHARSET * uch_set
BlamerBundle * blamer_bundle
void recog_word_recursive(WERD_RES *word)
const STRING & unichar_string() const
void rej_word_tess_failure()
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
bool wordrec_debug_blamer
void AttachOnCorner(BandTriMatrix< T > *array2)
WERD_CHOICE * best_choice
tesseract::BoxWord * box_word
void initialise(int16_t length)
void set_permuter(uint8_t perm)