tesseract
5.0.0-alpha-619-ge9db
|
Go to the documentation of this file.
28 #define MAX_UNDIVIDED_LENGTH 24
50 tprintf(
"recog_word ASSERT FAIL String:\"%s\"; "
51 "Strlen=%d; #Blobs=%d\n",
59 tprintf(
"Not all words have valid states relative to ratings matrix!!");
79 tprintf(
"Permuter Type Flipped from %d to %d\n",
114 tprintf(
"recog_word: Discarded long string \"%s\""
115 " (%d characters vs %d blobs)\n",
139 int bestgap = -INT32_MAX;
144 int gap = blob_box.
left() - prev_box.
right();
154 split_word(word, split_index, &word2, &orig_bb);
179 ASSERT_HOST(split_pt >0 && split_pt < word->chopped_word->NumBlobs());
190 auto *chopped2 =
new TWERD;
192 for (
int i = split_pt; i < chopped->
NumBlobs(); ++i) {
193 chopped2->blobs.push_back(chopped->
blobs[i]);
197 delete word2->chopped_word;
198 word2->chopped_word =
nullptr;
202 word2->ClearResults();
204 word2->chopped_word = chopped2;
206 word2->SetupBasicsFromChoppedWord(
unicharset);
209 if (orig_bb !=
nullptr) {
215 word2->chopped_word->blobs[0]->bounding_box().left(),
220 *right_piece = word2;
221 *orig_blamer_bundle = orig_bb;
244 split_pt.
x = (prev_box.
right() + blob_box.
left()) / 2;
245 split_pt.
y = (prev_box.
top() + prev_box.
bottom() +
266 const int kAltsPerPiece = 2;
268 const int kTooManyAltChoices = 100;
271 WERD_CHOICE_LIST joined_choices;
272 WERD_CHOICE_IT jc_it(&joined_choices);
276 int total_joined_choices = num_word1_choices;
282 for (bc2_it.forward(); !bc2_it.at_first(); bc2_it.forward(), ++bc2_index) {
283 if (total_joined_choices >= kTooManyAltChoices &&
284 bc2_index > kAltsPerPiece)
287 for (bc1_it.move_to_first(); bc1_index < num_word1_choices;
288 ++bc1_index, bc1_it.forward()) {
289 if (total_joined_choices >= kTooManyAltChoices &&
290 bc1_index > kAltsPerPiece)
293 *wc += *bc2_it.data();
294 jc_it.add_after_then_move(wc);
295 ++total_joined_choices;
300 bc1_it.move_to_first();
301 bc2_it.move_to_first();
302 for (bc1_it.mark_cycle_pt(); !bc1_it.cycled_list(); bc1_it.forward()) {
303 *bc1_it.data() += *bc2_it.data();
305 bc1_it.move_to_last();
306 bc1_it.add_list_after(&joined_choices);
310 if (orig_bb !=
nullptr) {
const STRING & unichar_string() const
void split_and_recog_word(WERD_RES *word)
bool wordrec_skip_no_truth_words
tesseract::BoxWord * box_word
GenericVector< int > blob_widths
void initialise(int16_t length)
void recog_word(WERD_RES *word)
TBOX bounding_box() const
void make_bad()
Set the fields in this choice to be default (bad) values.
void cc_recog(WERD_RES *word)
int dict_word(const WERD_CHOICE &word)
#define MAX_UNDIVIDED_LENGTH
GenericVector< int > best_state
void SetupBasicsFromChoppedWord(const UNICHARSET &unicharset_in)
void JoinBlames(const BlamerBundle &bundle1, const BlamerBundle &bundle2, bool debug)
const UNICHARSET * uch_set
BlamerBundle * blamer_bundle
void DebugWordChoices(bool debug, const char *word_to_debug)
WERD_CHOICE * best_choice
bool tessedit_rejection_debug
const char * c_str() const
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
bool tessedit_override_permuter
GenericVector< TBLOB * > blobs
void AttachOnCorner(BandTriMatrix< T > *array2)
void rej_word_tess_failure()
const STRING debug_string() const
WERD_CHOICE_LIST best_choices
void split_word(WERD_RES *word, int split_pt, WERD_RES **right_piece, BlamerBundle **orig_blamer_bundle) const
GenericVector< SEAM * > seam_array
TBOX bounding_box() const
void recog_word_recursive(WERD_RES *word)
bool wordrec_debug_blamer
DLLSYM void tprintf(const char *format,...)
GenericVector< int > blob_gaps
IncorrectResultReason incorrect_result_reason() const
void join_words(WERD_RES *word, WERD_RES *word2, BlamerBundle *orig_bb) const
void set_permuter(uint8_t perm)
const STRING & unichar_lengths() const
void append_unichar_id(UNICHAR_ID unichar_id, int blob_count, float rating, float certainty)
int16_t alpha_count(const char *word, const char *word_lengths)