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

Method SetWordTruth

deps/tesseract/ccstruct/blamer.cpp:66–82  ·  view source on GitHub ↗

Functions to setup the blamer. Whole word string, whole word bounding box.

Source from the content-addressed store, hash-verified

64// Functions to setup the blamer.
65// Whole word string, whole word bounding box.
66void BlamerBundle::SetWordTruth(const UNICHARSET& unicharset,
67 const char* truth_str, const TBOX& word_box) {
68 truth_word_.InsertBox(0, word_box);
69 truth_has_char_boxes_ = false;
70 // Encode the string as UNICHAR_IDs.
71 GenericVector<UNICHAR_ID> encoding;
72 GenericVector<char> lengths;
73 unicharset.encode_string(truth_str, false, &encoding, &lengths, NULL);
74 int total_length = 0;
75 for (int i = 0; i < encoding.size(); total_length += lengths[i++]) {
76 STRING uch(truth_str + total_length);
77 uch.truncate_at(lengths[i] - total_length);
78 UNICHAR_ID id = encoding[i];
79 if (id != INVALID_UNICHAR_ID) uch = unicharset.get_normed_unichar(id);
80 truth_text_.push_back(uch);
81 }
82}
83
84// Single "character" string, "character" bounding box.
85// May be called multiple times to indicate the characters in a word.

Callers

nothing calls this directly

Calls 6

encode_stringMethod · 0.80
truncate_atMethod · 0.80
get_normed_unicharMethod · 0.80
InsertBoxMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected