Helper to return the best rated BLOB_CHOICE in the whole word that matches the given char_id, or NULL if none can be found.
| 1584 | // Helper to return the best rated BLOB_CHOICE in the whole word that matches |
| 1585 | // the given char_id, or NULL if none can be found. |
| 1586 | static BLOB_CHOICE* FindBestMatchingChoice(UNICHAR_ID char_id, |
| 1587 | WERD_RES* word_res) { |
| 1588 | // Find the corresponding best BLOB_CHOICE from any position in the word_res. |
| 1589 | BLOB_CHOICE* best_choice = NULL; |
| 1590 | for (int i = 0; i < word_res->best_choice->length(); ++i) { |
| 1591 | BLOB_CHOICE* choice = FindMatchingChoice(char_id, |
| 1592 | word_res->GetBlobChoices(i)); |
| 1593 | if (choice != NULL) { |
| 1594 | if (best_choice == NULL || choice->rating() < best_choice->rating()) |
| 1595 | best_choice = choice; |
| 1596 | } |
| 1597 | } |
| 1598 | return best_choice; |
| 1599 | } |
| 1600 | |
| 1601 | // Helper to insert blob_choice in each location in the leader word if there is |
| 1602 | // no matching BLOB_CHOICE there already, and correct any incorrect results |
no test coverage detected