5 #ifndef KENLM_MAX_ORDER 9 #include <lm/binary_format.hh> 10 #include <lm/model.hh> 12 #include <lm/wrappers/nplm.hh> 28 inline int detectkenlm (std::string
const& kenlmfile) {
29 lm::ngram::ModelType model_type;
30 if (kenlmfile ==
"" ) {
31 FORCELINFO(
"Empty language model file name. Sets to Probing.");
32 return lm::ngram::PROBING;
34 if (lm::ngram::RecognizeBinary (kenlmfile.c_str(), model_type) ) {
36 case lm::ngram::PROBING:
37 case lm::ngram::REST_PROBING:
39 case lm::ngram::QUANT_TRIE:
40 case lm::ngram::ARRAY_TRIE:
41 case lm::ngram::QUANT_ARRAY_TRIE:
44 LERROR (
"Unrecognized kenlm model type " << model_type );
48 }
else if (lm::np::Model::Recognize(kenlmfile)) {
52 return lm::ngram::PROBING;