Go to the documentation of this file.
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());
191 auto *chopped2 =
new TWERD;
193 for (
int i = split_pt; i < chopped->
NumBlobs(); ++i) {
194 chopped2->blobs.push_back(chopped->
blobs[i]);
198 delete word2->chopped_word;
199 word2->chopped_word =
nullptr;
203 word2->ClearResults();
205 word2->chopped_word = chopped2;
207 word2->SetupBasicsFromChoppedWord(
unicharset);
210 if (orig_bb !=
nullptr) {
216 word2->chopped_word->blobs[0]->bounding_box().left(),
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
void cc_recog(WERD_RES *word)
const char * string() const
const STRING debug_string() const
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
WERD_CHOICE * best_choice
GenericVector< SEAM * > seam_array
BlamerBundle * blamer_bundle
const STRING & unichar_string() const
const UNICHARSET * uch_set
void SetupBasicsFromChoppedWord(const UNICHARSET &unicharset_in)
void SplitBundle(int word1_right, int word2_left, bool debug, BlamerBundle *bundle1, BlamerBundle *bundle2) const
void AttachOnCorner(BandTriMatrix< T > *array2)
GenericVector< TBLOB * > blobs
bool wordrec_debug_blamer
void recog_word_recursive(WERD_RES *word)
DLLSYM void tprintf(const char *format,...)
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
void DebugWordChoices(bool debug, const char *word_to_debug)
bool tessedit_rejection_debug
WERD_CHOICE_LIST best_choices
const STRING & unichar_lengths() const
void append_unichar_id(UNICHAR_ID unichar_id, int blob_count, float rating, float certainty)
GenericVector< int > blob_gaps
bool tessedit_override_permuter
TBOX bounding_box() const
int dict_word(const WERD_CHOICE &word)
void set_permuter(uint8_t perm)
void recog_word(WERD_RES *word)
void split_and_recog_word(WERD_RES *word)
bool wordrec_skip_no_truth_words
void initialise(int16_t length)
int16_t alpha_count(const char *word, const char *word_lengths)
void make_bad()
Set the fields in this choice to be default (bad) values.
IncorrectResultReason incorrect_result_reason() const
tesseract::BoxWord * box_word
GenericVector< int > blob_widths
TBOX bounding_box() const
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
void rej_word_tess_failure()
GenericVector< int > best_state