diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-18 06:45:19 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2013-09-18 06:45:19 +0400 |
commit | 7873dbb77a78baea9d0ccd568a9626472bddb587 (patch) | |
tree | 32fbffdd02c586e647e02edf89958ba031740f89 /moses/ChartTranslationOptionList.cpp | |
parent | f88908f972e638e1303c6fc98903c34f8330ed80 (diff) |
check there are hypos in stack vector before create translation options. constrained decoding works for syntax model
Diffstat (limited to 'moses/ChartTranslationOptionList.cpp')
-rw-r--r-- | moses/ChartTranslationOptionList.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/moses/ChartTranslationOptionList.cpp b/moses/ChartTranslationOptionList.cpp index 757afd31b..52169c935 100644 --- a/moses/ChartTranslationOptionList.cpp +++ b/moses/ChartTranslationOptionList.cpp @@ -67,6 +67,14 @@ void ChartTranslationOptionList::Add(const TargetPhraseCollection &tpc, return; } + for (size_t i = 0; i < stackVec.size(); ++i) { + const ChartCellLabel &chartCellLabel = *stackVec[i]; + size_t numHypos = chartCellLabel.GetStack().cube->size(); + if (numHypos == 0) { + return; // empty stack. These rules can't be used + } + } + float score = ChartTranslationOptions::CalcEstimateOfBestScore(tpc, stackVec); // If the rule limit has already been reached then don't add the option |