Helper to insert blob_choice in each location in the leader word if there is no matching BLOB_CHOICE there already, and correct any incorrect results in the best_choice.
| 1602 | // no matching BLOB_CHOICE there already, and correct any incorrect results |
| 1603 | // in the best_choice. |
| 1604 | static void CorrectRepcharChoices(BLOB_CHOICE* blob_choice, |
| 1605 | WERD_RES* word_res) { |
| 1606 | WERD_CHOICE* word = word_res->best_choice; |
| 1607 | for (int i = 0; i < word_res->best_choice->length(); ++i) { |
| 1608 | BLOB_CHOICE* choice = FindMatchingChoice(blob_choice->unichar_id(), |
| 1609 | word_res->GetBlobChoices(i)); |
| 1610 | if (choice == NULL) { |
| 1611 | BLOB_CHOICE_IT choice_it(word_res->GetBlobChoices(i)); |
| 1612 | choice_it.add_before_stay_put(new BLOB_CHOICE(*blob_choice)); |
| 1613 | } |
| 1614 | } |
| 1615 | // Correct any incorrect results in word. |
| 1616 | for (int i = 0; i < word->length(); ++i) { |
| 1617 | if (word->unichar_id(i) != blob_choice->unichar_id()) |
| 1618 | word->set_unichar_id(blob_choice->unichar_id(), i); |
| 1619 | } |
| 1620 | } |
| 1621 | |
| 1622 | /** |
| 1623 | * fix_rep_char() |
no test coverage detected