diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-10-07 19:44:26 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-10-07 19:44:26 +0400 |
commit | 8b9d4d1c7dac2f2a53e9a4d5949e10a4511aeb0c (patch) | |
tree | ab4c3af87d8e5ded4644f78c4cf06dc92742e6f7 /moses/DecodeStepTranslation.cpp | |
parent | 67c294a7d8b621955c295dc838f9bf0086f62e98 (diff) |
limit size of input path for confusion networks and lattices. Prevent memory blowup. /Yulia Tsvetkov
Diffstat (limited to 'moses/DecodeStepTranslation.cpp')
-rw-r--r-- | moses/DecodeStepTranslation.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/moses/DecodeStepTranslation.cpp b/moses/DecodeStepTranslation.cpp index 1d5b4bb4c..a77cee769 100644 --- a/moses/DecodeStepTranslation.cpp +++ b/moses/DecodeStepTranslation.cpp @@ -195,11 +195,19 @@ const InputPath &DecodeStepTranslation::GetInputPathLEGACY( for (iter = inputPathList.begin(); iter != inputPathList.end(); ++iter) { const InputPath &inputPath = **iter; const Phrase &phraseFromIP = inputPath.GetPhrase(); - const Word &wordIP = phraseFromIP.GetWord(0); + + const Word *wordIP = NULL; + for (size_t i = 0; i < phraseFromIP.GetSize(); ++i) { + const Word &tempWord = phraseFromIP.GetWord(i); + if (!tempWord.IsEpsilon()) { + wordIP = &tempWord; + break; + } + } // const WordsRange &range = inputPath.GetWordsRange(); - if (wordFromPt == wordIP) { + if (wordIP && *wordIP == wordFromPt) { return inputPath; } } |