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:
authorHieu Hoang <hieu@hoang.co.uk>2014-05-01 19:47:17 +0400
committerHieu Hoang <hieu@hoang.co.uk>2014-05-01 19:47:17 +0400
commit2beed771d2d23ca9150f6877a353647b9789a223 (patch)
tree32c43a1acd6ebb28ea5aaf5089688407cf7ea4e0 /moses/TranslationOptionCollectionLattice.cpp
parentd4b270e7963d87e8133e66c4d52c9697121cd3d8 (diff)
minor error. Segfault if phrase length is bigger than max-phrase-length
Diffstat (limited to 'moses/TranslationOptionCollectionLattice.cpp')
-rw-r--r--moses/TranslationOptionCollectionLattice.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/moses/TranslationOptionCollectionLattice.cpp b/moses/TranslationOptionCollectionLattice.cpp
index fb264f8fe..fd29466ef 100644
--- a/moses/TranslationOptionCollectionLattice.cpp
+++ b/moses/TranslationOptionCollectionLattice.cpp
@@ -46,6 +46,11 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
size_t endPos = startPos + nextNode - 1;
WordsRange range(startPos, endPos);
+
+ if (range.GetNumWordsCovered() > maxPhraseLength) {
+ continue;
+ }
+
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
Phrase subphrase;
@@ -91,6 +96,12 @@ void TranslationOptionCollectionLattice::Extend(const InputPath &prevPath, const
size_t endPos = nextPos + nextNode - 1;
WordsRange range(startPos, endPos);
+
+ size_t maxPhraseLength = StaticData::Instance().GetMaxPhraseLength();
+ if (range.GetNumWordsCovered() > maxPhraseLength) {
+ continue;
+ }
+
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);
Phrase subphrase(prevPhrase);