summaryrefslogtreecommitdiff
path: root/klm/lm/model.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-06-19 15:06:34 +0100
committerPaul Baltescu <pauldb89@gmail.com>2013-06-19 15:06:34 +0100
commit34d8d1a1df61a1f9409e6d205ecfa1b7cfb70562 (patch)
tree8b9d8072cae6ac024b46196c4712a5f02afc33c0 /klm/lm/model.cc
parenta3243017d6b8c46cc3e41f4243311dc3dbc80ab4 (diff)
parentf1ce46ec9b1b8efcc4a91a149454acf03c01db02 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'klm/lm/model.cc')
-rw-r--r--klm/lm/model.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/klm/lm/model.cc b/klm/lm/model.cc
index a40fd2fb..a26654a6 100644
--- a/klm/lm/model.cc
+++ b/klm/lm/model.cc
@@ -304,5 +304,26 @@ template class GenericModel<trie::TrieSearch<SeparatelyQuantize, trie::DontBhiks
template class GenericModel<trie::TrieSearch<SeparatelyQuantize, trie::ArrayBhiksha>, SortedVocabulary>;
} // namespace detail
+
+base::Model *LoadVirtual(const char *file_name, const Config &config, ModelType model_type) {
+ RecognizeBinary(file_name, model_type);
+ switch (model_type) {
+ case PROBING:
+ return new ProbingModel(file_name, config);
+ case REST_PROBING:
+ return new RestProbingModel(file_name, config);
+ case TRIE:
+ return new TrieModel(file_name, config);
+ case QUANT_TRIE:
+ return new QuantTrieModel(file_name, config);
+ case ARRAY_TRIE:
+ return new ArrayTrieModel(file_name, config);
+ case QUANT_ARRAY_TRIE:
+ return new QuantArrayTrieModel(file_name, config);
+ default:
+ UTIL_THROW(FormatLoadException, "Confused by model type " << model_type);
+ }
+}
+
} // namespace ngram
} // namespace lm