diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-24 03:36:17 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-10-24 03:36:17 +0300 |
commit | fc6b000e88bd652fc06fbd4218a278861b282261 (patch) | |
tree | 3731b1319329481033de830dbb0a4e35b19d5c5a /moses/TranslationTask.cpp | |
parent | 22365691a918fd9e9079476be5144fd2836471e2 (diff) |
Added parsing of document-leval translation meta-information to setup of TranslationTask.
Diffstat (limited to 'moses/TranslationTask.cpp')
-rw-r--r-- | moses/TranslationTask.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index a29e223f5..f0a7fc7c4 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -165,20 +165,40 @@ options() const return m_options; } +/// parse document-level translation info stored on the input +void +TranslationTask:: +interpret_dlt() +{ + if (m_source->GetType() != SentenceInput) return; + Sentence const& snt = static_cast<Sentence const&>(*m_source); + typedef std::map<std::string,std::string> dltmap_t; + BOOST_FOREACH(dltmap_t const& M, snt.GetDltMeta()) + { + dltmap_t::const_iterator i = M.find("type"); + if (i == M.end() || i->second != "adaptive-lm") continue; + dltmap_t::const_iterator j = M.find("context-weights"); + if (j == M.end()) continue; + SetContextWeights(j->second); + } +} + + void TranslationTask::Run() { UTIL_THROW_IF2(!m_source || !m_ioWrapper, "Base Instances of TranslationTask must be initialized with" << " input and iowrapper."); - - // shorthand for "global data" const size_t translationId = m_source->GetTranslationId(); + // report wall time spent on translation Timer translationTime; translationTime.start(); + interpret_dlt(); // parse document-level translation info stored on the input + // report thread number #if defined(WITH_THREADS) && defined(BOOST_HAS_PTHREADS) VERBOSE(2, "Translating line " << translationId << " in thread id " << pthread_self() << endl); |