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

Method Sort

deps/tesseract/cube/word_altlist.cpp:84–102  ·  view source on GitHub ↗

* sort the alternate in descending order based on the cost */

Source from the content-addressed store, hash-verified

82 * sort the alternate in descending order based on the cost
83 */
84void WordAltList::Sort() {
85 for (int alt_idx = 0; alt_idx < alt_cnt_; alt_idx++) {
86 for (int alt = alt_idx + 1; alt < alt_cnt_; alt++) {
87 if (alt_cost_[alt_idx] > alt_cost_[alt]) {
88 char_32 *pchTemp = word_alt_[alt_idx];
89 word_alt_[alt_idx] = word_alt_[alt];
90 word_alt_[alt] = pchTemp;
91
92 int temp = alt_cost_[alt_idx];
93 alt_cost_[alt_idx] = alt_cost_[alt];
94 alt_cost_[alt] = temp;
95
96 void *tag = alt_tag_[alt_idx];
97 alt_tag_[alt_idx] = alt_tag_[alt];
98 alt_tag_[alt] = tag;
99 }
100 }
101 }
102}
103
104void WordAltList::PrintDebug() {
105 for (int alt_idx = 0; alt_idx < alt_cnt_; alt_idx++) {

Callers 2

CreateWordAltListMethod · 0.45
UnicharClassifySampleMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected