{
features->clear();
*agreement = false;
if (cube_alt_list ==
NULL || cube_alt_list->AltCount() <= 0)
return false;
char_32 *cube_best_str32 = cube_alt_list->Alt(0);
return false;
string cube_best_str;
int cube_best_cost = cube_alt_list->AltCost(0);
int cube_best_bigram_cost = 0;
bool cube_best_bigram_cost_valid = true;
cube_best_bigram_cost = cube_cntxt_->
Bigrams()->
else
cube_best_bigram_cost_valid = false;
*agreement = (tess_str.compare(cube_best_str) == 0);
string cube_next_best_str;
if (cube_alt_list->AltCount() > 1) {
cube_next_best_str32 = cube_alt_list->Alt(1);
if (cube_next_best_str32 ==
NULL ||
return false;
}
cube_next_best_cost = cube_alt_list->AltCost(1);
}
int tess_rank = 0;
for (tess_rank = 0; tess_rank < cube_alt_list->AltCount(); tess_rank++) {
string alt_str;
if (alt_str == tess_str)
break;
}
int tess_cost = cube_obj->WordCost(tess_str.c_str());
int tess_bigram_cost = 0;
int tess_bigram_cost_valid = true;
tess_bigram_cost = cube_cntxt_->
Bigrams()->
else
tess_bigram_cost_valid = false;
features->push_back(tess_confidence);
features->push_back(tess_cost);
features->push_back(tess_rank);
features->push_back(tess_str.length());
if (tess_bigram_cost_valid) {
features->push_back(tess_bigram_cost);
}
features->push_back(cube_best_cost);
features->push_back(cube_next_best_cost);
features->push_back(cube_best_str.length());
features->push_back(
ValidWord(cube_best_str));
if (cube_best_bigram_cost_valid) {
features->push_back(cube_best_bigram_cost);
}
int compare_nocase_punc = CompareStrings(cube_best_str.c_str(),
tess_str.c_str(), false, true);
features->push_back(compare_nocase_punc == 0);
int compare_case_nopunc = CompareStrings(cube_best_str.c_str(),
tess_str.c_str(), true, false);
features->push_back(compare_case_nopunc == 0);
int compare_nocase_nopunc = CompareStrings(cube_best_str.c_str(),
tess_str.c_str(), true, true);
features->push_back(compare_nocase_nopunc == 0);
return true;
}