From 023a946a5be0c0259e884380725a7cf86af3e313 Mon Sep 17 00:00:00 2001 From: Hieu Hoang Date: Thu, 16 Feb 2017 11:33:24 +0000 Subject: [PATCH] implement SetParameter for load_method --- moses/TranslationModel/ProbingPT.cpp | 22 ++++++++++++++++++++++ moses/TranslationModel/ProbingPT.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/moses/TranslationModel/ProbingPT.cpp b/moses/TranslationModel/ProbingPT.cpp index 2a7369622..9a8d4c700 100644 --- a/moses/TranslationModel/ProbingPT.cpp +++ b/moses/TranslationModel/ProbingPT.cpp @@ -118,6 +118,28 @@ void ProbingPT::CreateAlignmentMap(const std::string path) } } +void ProbingPT::SetParameter(const std::string& key, const std::string& value) +{ + if (key == "load") { + if (value == "lazy") { + load_method = util::LAZY; + } else if (value == "populate_or_lazy") { + load_method = util::POPULATE_OR_LAZY; + } else if (value == "populate_or_read" || value == "populate") { + load_method = util::POPULATE_OR_READ; + } else if (value == "read") { + load_method = util::READ; + } else if (value == "parallel_read") { + load_method = util::PARALLEL_READ; + } else { + UTIL_THROW2("load method not supported" << value); + } + } else { + PhraseDictionary::SetParameter(key, value); + } + +} + void ProbingPT::InitializeForInput(ttasksptr const& ttask) { diff --git a/moses/TranslationModel/ProbingPT.h b/moses/TranslationModel/ProbingPT.h index bdf5a3bda..1c996f5fa 100644 --- a/moses/TranslationModel/ProbingPT.h +++ b/moses/TranslationModel/ProbingPT.h @@ -30,6 +30,8 @@ public: void InitializeForInput(ttasksptr const& ttask); + void SetParameter(const std::string& key, const std::string& value); + // for phrase-based model void GetTargetPhraseCollectionBatch(const InputPathList &inputPathQueue) const;