Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXapaJIaMnu <nheart@gmail.com>2015-06-23 17:02:15 +0300
committerXapaJIaMnu <nheart@gmail.com>2015-06-23 17:02:15 +0300
commit69c1308f01b0a0b51fb2ee1c38c04b175f96f631 (patch)
tree4c37d613eeaed66feb602f352c1546a6a9b84359 /moses/TranslationTask.cpp
parentaaf8397d6f11c4039f06b3f6089c402e0cbea54b (diff)
Add context_weights parameter to command line
Diffstat (limited to 'moses/TranslationTask.cpp')
-rw-r--r--moses/TranslationTask.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp
index 61cdfc162..dd9fcbc52 100644
--- a/moses/TranslationTask.cpp
+++ b/moses/TranslationTask.cpp
@@ -30,6 +30,12 @@ TranslationTask
return m_context_string;
}
+std::map<std::string, float> const&
+TranslationTask::GetContextWeights() const
+{
+ return m_context_weights;
+}
+
void
TranslationTask
::SetContextString(std::string const& context)
@@ -37,6 +43,16 @@ TranslationTask
m_context_string = context;
}
+void
+TranslationTask
+::SetContextWeights(std::string const& context_weights)
+{
+ std::vector<std::string> tokens = Tokenize(context_weights,":");
+ for (std::vector<std::string>::iterator it = tokens.begin(); it != tokens.end(); it++) {
+ std::vector<std::string> key_and_value = Tokenize(*it, ",");
+ m_context_weights.insert(std::pair<std::string, float>(key_and_value[0], atof(key_and_value[1].c_str())));
+ }
+}
boost::shared_ptr<TranslationTask>