diff options
author | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2015-05-15 10:12:51 +0300 |
---|---|---|
committer | Marcin Junczys-Dowmunt <junczys@amu.edu.pl> | 2015-05-15 10:12:51 +0300 |
commit | 7652ab9118656bf6101d7f7954b939088eabd661 (patch) | |
tree | 37f27b76a55dc041fb1e26c713e233a97993900c | |
parent | 630ffe9316a4997b5a7b337bae12aa604e216b15 (diff) |
quick fix for out-of-bound alignment points
-rw-r--r-- | moses/TranslationModel/CompactPT/PhraseDecoder.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/moses/TranslationModel/CompactPT/PhraseDecoder.cpp b/moses/TranslationModel/CompactPT/PhraseDecoder.cpp index ec3efdbb4..3cf2f010e 100644 --- a/moses/TranslationModel/CompactPT/PhraseDecoder.cpp +++ b/moses/TranslationModel/CompactPT/PhraseDecoder.cpp @@ -414,6 +414,12 @@ TargetPhraseVectorPtr PhraseDecoder::DecodeCollection( if(state == Add) { if(m_phraseDictionary.m_useAlignmentInfo) { + size_t sourceSize = sourcePhrase.GetSize(); + size_t targetSize = targetPhrase->GetSize(); + for(std::set<AlignPointSizeT>::iterator it = alignment.begin(); it != alignment.end(); it++) { + if(it->first >= sourceSize || it->second >= targetSize) + return TargetPhraseVectorPtr(); + } targetPhrase->SetAlignTerm(alignment); } |