/********************************************************************** * fill_werd_res * * Fill Tesseract's word result fields with cube's. * **********************************************************************/ void Tesseract::fill_werd_res(const BoxWord& cube_box_word, WERD_CHOICE* cube_werd_choice, const char* cube_best_str, WERD_RES* tess_werd_res) { // Replace tesseract results's best choice with cube's tess_werd_res->best_choice = cube_werd_choice; tess_werd_res->raw_choice = new WERD_CHOICE(*cube_werd_choice); delete tess_werd_res->box_word; tess_werd_res->box_word = new BoxWord(cube_box_word); tess_werd_res->box_word->ClipToOriginalWord(tess_werd_res->denorm.block(), tess_werd_res->word); // Fill text and remaining fields tess_werd_res->word->set_text(cube_best_str); tess_werd_res->tess_failed = FALSE; tess_werd_res->tess_accepted = tess_acceptable_word(tess_werd_res->best_choice, tess_werd_res->raw_choice); // There is no output word, so we can' call AdaptableWord, but then I don't // think we need to. Fudge the result with accepted. tess_werd_res->tess_would_adapt = tess_werd_res->tess_accepted; // Initialize the reject_map and set it to done, i.e., ignore all of // tesseract's tests for rejection tess_werd_res->reject_map.initialise(cube_werd_choice->length()); tess_werd_res->done = tess_werd_res->tess_accepted; // Some sanity checks ASSERT_HOST(tess_werd_res->best_choice->length() == tess_werd_res->best_choice->blob_choices()->length()); ASSERT_HOST(tess_werd_res->best_choice->length() == tess_werd_res->reject_map.length()); }
/********************************************************************** * fill_werd_res * * Fill Tesseract's word result fields with cube's. * **********************************************************************/ void Tesseract::fill_werd_res(const BoxWord& cube_box_word, const char* cube_best_str, WERD_RES* tess_werd_res) { delete tess_werd_res->box_word; tess_werd_res->box_word = new BoxWord(cube_box_word); tess_werd_res->box_word->ClipToOriginalWord(tess_werd_res->denorm.block(), tess_werd_res->word); // Fill text and remaining fields tess_werd_res->word->set_text(cube_best_str); tess_werd_res->tess_failed = FALSE; tess_werd_res->tess_accepted = tess_acceptable_word(tess_werd_res); // There is no output word, so we can' call AdaptableWord, but then I don't // think we need to. Fudge the result with accepted. tess_werd_res->tess_would_adapt = tess_werd_res->tess_accepted; // Set word to done, i.e., ignore all of tesseract's tests for rejection tess_werd_res->done = tess_werd_res->tess_accepted; }