diff options
author | Ulrich Germann <ulrich.germann@gmail.com> | 2015-05-21 19:36:51 +0300 |
---|---|---|
committer | Ulrich Germann <ulrich.germann@gmail.com> | 2015-05-21 19:36:51 +0300 |
commit | 33eee96f35b07168d5912b35baed7df74d4cea23 (patch) | |
tree | e4f29707410b87192f56aa0da808917e5f7c8821 /moses/IOWrapper.cpp | |
parent | 5807ca47144b9689d1ab6cc77300a4bebe81517e (diff) |
Bug fix related to context-sensitive decoding: --context-string had no effect, even when --context-window was not specified.
Diffstat (limited to 'moses/IOWrapper.cpp')
-rw-r--r-- | moses/IOWrapper.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/moses/IOWrapper.cpp b/moses/IOWrapper.cpp index 29769f180..8cbf4f091 100644 --- a/moses/IOWrapper.cpp +++ b/moses/IOWrapper.cpp @@ -296,16 +296,19 @@ GetBufferedInput() } boost::shared_ptr<InputType> -IOWrapper::ReadInput() +IOWrapper:: +ReadInput() { #ifdef WITH_THREADS boost::lock_guard<boost::mutex> lock(m_lock); #endif boost::shared_ptr<InputType> source = GetBufferedInput(); - if (source) { - source->SetTranslationId(m_currentLine++); - this->set_context_for(*source); - } + if (source) + { + source->SetTranslationId(m_currentLine++); + if (m_look_ahead || m_look_back) + this->set_context_for(*source); + } m_past_input.push_back(source); return source; } @@ -344,7 +347,7 @@ set_context_for(InputType& source) } } // cerr << string(80,'=') << endl; - source.SetContext(context); + if (context->size()) source.SetContext(context); } |