This commit is contained in:
Jim O'Regan 2014-09-12 21:41:19 +01:00
parent c4b39bd89e
commit 631730599d
2 changed files with 22 additions and 10 deletions

View File

@ -99,10 +99,12 @@ CubeObject::~CubeObject() {
Cleanup();
}
// Actually do the recognition using the specified language mode. If none
// is specified, the default language model in the CubeRecoContext is used.
// Returns the sorted list of alternate answers
// The Word mode determines whether recognition is done as a word or a phrase
/**
* Actually do the recognition using the specified language mode. If none
* is specified, the default language model in the CubeRecoContext is used.
* @return the sorted list of alternate answers
* @param word_mode determines whether recognition is done as a word or a phrase
*/
WordAltList *CubeObject::Recognize(LangModel *lang_mod, bool word_mode) {
if (char_samp_ == NULL) {
return NULL;
@ -197,18 +199,24 @@ WordAltList *CubeObject::Recognize(LangModel *lang_mod, bool word_mode) {
return alt_list_;
}
// Recognize the member char sample as a word
/**
* Recognize the member char sample as a word
*/
WordAltList *CubeObject::RecognizeWord(LangModel *lang_mod) {
return Recognize(lang_mod, true);
}
// Recognize the member char sample as a word
/**
* Recognize the member char sample as a phrase
*/
WordAltList *CubeObject::RecognizePhrase(LangModel *lang_mod) {
return Recognize(lang_mod, false);
}
// Computes the cost of a specific string. This is done by performing
// recognition of a language model that allows only the specified word
/**
* Computes the cost of a specific string. This is done by performing
* recognition of a language model that allows only the specified word
*/
int CubeObject::WordCost(const char *str) {
WordListLangModel *lang_mod = new WordListLangModel(cntxt_);
if (lang_mod == NULL) {

View File

@ -37,7 +37,9 @@ TessLangModEdge::TessLangModEdge(CubeRecoContext *cntxt, int class_id) {
path_cost_ = Cost();
}
// leading, trailing punc constructor and single byte UTF char
/**
* leading, trailing punc constructor and single byte UTF char
*/
TessLangModEdge::TessLangModEdge(CubeRecoContext *cntxt,
const Dawg *dawg, EDGE_REF edge_idx, int class_id) {
root_ = false;
@ -51,7 +53,9 @@ TessLangModEdge::TessLangModEdge(CubeRecoContext *cntxt,
path_cost_ = Cost();
}
// dict constructor: multi byte UTF char
/**
* dict constructor: multi byte UTF char
*/
TessLangModEdge::TessLangModEdge(CubeRecoContext *cntxt, const Dawg *dawg,
EDGE_REF start_edge_idx, EDGE_REF end_edge_idx,
int class_id) {