MCPcopy Create free account
hub / github.com/creatale/node-dv / CorrectClassifyWords

Method CorrectClassifyWords

deps/tesseract/ccmain/applybox.cpp:772–792  ·  view source on GitHub ↗

Creates a fake best_choice entry in each WERD_RES with the correct text.*/

Source from the content-addressed store, hash-verified

770
771/** Creates a fake best_choice entry in each WERD_RES with the correct text.*/
772void Tesseract::CorrectClassifyWords(PAGE_RES* page_res) {
773 PAGE_RES_IT pr_it(page_res);
774 for (WERD_RES *word_res = pr_it.word(); word_res != NULL;
775 word_res = pr_it.forward()) {
776 WERD_CHOICE* choice = new WERD_CHOICE(word_res->uch_set,
777 word_res->correct_text.size());
778 for (int i = 0; i < word_res->correct_text.size(); ++i) {
779 // The part before the first space is the real ground truth, and the
780 // rest is the bounding box location and page number.
781 GenericVector<STRING> tokens;
782 word_res->correct_text[i].split(' ', &tokens);
783 UNICHAR_ID char_id = unicharset.unichar_to_id(tokens[0].string());
784 choice->append_unichar_id_space_allocated(char_id,
785 word_res->best_state[i],
786 0.0f, 0.0f);
787 }
788 word_res->ClearWordChoices();
789 word_res->LogNewRawChoice(choice);
790 word_res->LogNewCookedChoice(1, false, choice);
791 }
792}
793
794/// Calls #LearnWord to extract features for labelled blobs within each word.
795/// Features are stored in an internal buffer.

Callers 1

RecognizeMethod · 0.80

Calls 9

ClearWordChoicesMethod · 0.80
LogNewRawChoiceMethod · 0.80
LogNewCookedChoiceMethod · 0.80
wordMethod · 0.45
forwardMethod · 0.45
sizeMethod · 0.45
splitMethod · 0.45
unichar_to_idMethod · 0.45
stringMethod · 0.45

Tested by

no test coverage detected