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 <hieuhoang@gmail.com>2013-10-05 02:48:58 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-10-05 02:48:58 +0400
commit7d43165793678bc7ed08f70877b37de7fae288a4 (patch)
treee91497d27621a9c6a6e28176c4e9db221ed4de4a /moses/TranslationOptionCollectionLattice.cpp
parent902741681a4979ef4f0d55ee265d1be3fe519ecc (diff)
don't create input paths longer than max phrase length
Diffstat (limited to 'moses/TranslationOptionCollectionLattice.cpp')
-rw-r--r--moses/TranslationOptionCollectionLattice.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/moses/TranslationOptionCollectionLattice.cpp b/moses/TranslationOptionCollectionLattice.cpp
index 878ab7968..a932e2a99 100644
--- a/moses/TranslationOptionCollectionLattice.cpp
+++ b/moses/TranslationOptionCollectionLattice.cpp
@@ -29,6 +29,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
const InputFeature *inputFeature = StaticData::Instance().GetInputFeature();
CHECK(inputFeature);
+ size_t maxPhraseLength = StaticData::Instance().GetMaxPhraseLength();
size_t size = input.GetSize();
// 1-word phrases
@@ -76,6 +77,11 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
}
size_t startPos = prevPath.GetWordsRange().GetStartPos();
+
+ if (endPos - startPos + 1 > maxPhraseLength) {
+ continue;
+ }
+
WordsRange range(startPos, endPos);
const NonTerminalSet &labels = input.GetLabelSet(startPos, endPos);