summaryrefslogtreecommitdiff
path: root/klm/lm/fragment.cc
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2013-01-22 21:37:49 +0000
committerKenneth Heafield <github@kheafield.com>2013-01-22 21:37:49 +0000
commitb35a7f3a96ff8ae42e15922dd6949bf9f5d15501 (patch)
tree26edbe78931ffc50864a899c087d851005fe560b /klm/lm/fragment.cc
parent51a412aa7f5f50035cf28a274a70508c839f3d40 (diff)
KenLM 58da338b
Diffstat (limited to 'klm/lm/fragment.cc')
-rw-r--r--klm/lm/fragment.cc37
1 files changed, 0 insertions, 37 deletions
diff --git a/klm/lm/fragment.cc b/klm/lm/fragment.cc
deleted file mode 100644
index 0267cd4e..00000000
--- a/klm/lm/fragment.cc
+++ /dev/null
@@ -1,37 +0,0 @@
-#include "lm/binary_format.hh"
-#include "lm/model.hh"
-#include "lm/left.hh"
-#include "util/tokenize_piece.hh"
-
-template <class Model> void Query(const char *name) {
- Model model(name);
- std::string line;
- lm::ngram::ChartState ignored;
- while (getline(std::cin, line)) {
- lm::ngram::RuleScore<Model> scorer(model, ignored);
- for (util::TokenIter<util::SingleCharacter, true> i(line, ' '); i; ++i) {
- scorer.Terminal(model.GetVocabulary().Index(*i));
- }
- std::cout << scorer.Finish() << '\n';
- }
-}
-
-int main(int argc, char *argv[]) {
- if (argc != 2) {
- std::cerr << "Expected model file name." << std::endl;
- return 1;
- }
- const char *name = argv[1];
- lm::ngram::ModelType model_type = lm::ngram::PROBING;
- lm::ngram::RecognizeBinary(name, model_type);
- switch (model_type) {
- case lm::ngram::PROBING:
- Query<lm::ngram::ProbingModel>(name);
- break;
- case lm::ngram::REST_PROBING:
- Query<lm::ngram::RestProbingModel>(name);
- break;
- default:
- std::cerr << "Model type not supported yet." << std::endl;
- }
-}