Functions to setup the blamer. Whole word string, whole word bounding box.
| 64 | // Functions to setup the blamer. |
| 65 | // Whole word string, whole word bounding box. |
| 66 | void 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. |
nothing calls this directly
no test coverage detected