This commit is contained in:
Nadir Durrani 2013-07-01 11:06:55 +01:00
parent 8c19c2ba8a
commit 6a915253e1
3 changed files with 6 additions and 12 deletions

View File

@ -23,7 +23,7 @@ void OpSequenceModel :: readLanguageModel(const char *lmFile)
string unkOp = "_TRANS_SLF_";
//*
/*
// Code for SRILM
@ -35,20 +35,14 @@ void OpSequenceModel :: readLanguageModel(const char *lmFile)
numbers.push_back(ptrOp->getLMID(const_cast <char *> (unkOp.c_str())));
unkOpProb = ptrOp->contextProbN(numbers,nonWordFlag);
//*/
*/
// Code to load KenLM
OSM = new Model(m_lmPath.c_str());
/*
State startState = OSM->EmptyContextState();
State startState = OSM->BeginSentenceState();
State endState;
unkOpProb = OSM->Score(startState,OSM->GetVocabulary().Index(unkOp),endState);
*/
}

View File

@ -17,8 +17,7 @@ class OpSequenceModel : public StatefulFeatureFunction
{
public:
//LM *LanguageModel;
lm::ngram::Model * OSM;
Api * ptrOp;

View File

@ -383,9 +383,10 @@ LanguageModel *ConstructKenLM(const std::string &description, const std::string
try {
lm::ngram::ModelType model_type;
if (lm::ngram::RecognizeBinary(file.c_str(), model_type)) {
switch(model_type) {
case lm::ngram::PROBING:
return new LanguageModelKen<lm::ngram::ProbingModel>(description, line, file, factorType, lazy);
return new LanguageModelKen<lm::ngram::ProbingModel>(description, line, file, factorType, lazy);
case lm::ngram::REST_PROBING:
return new LanguageModelKen<lm::ngram::RestProbingModel>(description, line, file, factorType, lazy);
case lm::ngram::TRIE: