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

Function FindBestMatchingChoice

deps/tesseract/ccmain/control.cpp:1586–1599  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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.
1586static 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

Callers 1

fix_rep_charMethod · 0.85

Calls 4

FindMatchingChoiceFunction · 0.85
GetBlobChoicesMethod · 0.80
ratingMethod · 0.80
lengthMethod · 0.45

Tested by

no test coverage detected