diff --git a/moses/ChartHypothesisCollection.cpp b/moses/ChartHypothesisCollection.cpp index 753d9caed..8cccf3083 100644 --- a/moses/ChartHypothesisCollection.cpp +++ b/moses/ChartHypothesisCollection.cpp @@ -60,15 +60,13 @@ ChartHypothesisCollection::~ChartHypothesisCollection() */ bool ChartHypothesisCollection::AddHypothesis(ChartHypothesis *hypo, ChartManager &manager) { - /* - cerr << *hypo << endl; if (hypo->GetTotalScore() == - std::numeric_limits::infinity()) { manager.GetSentenceStats().AddDiscarded(); VERBOSE(3,"discarded, -inf score" << std::endl); ChartHypothesis::Delete(hypo); return false; } - */ + if (hypo->GetTotalScore() < m_bestScore + m_beamWidth) { // really bad score. don't bother adding hypo into collection manager.GetSentenceStats().AddDiscarded(); 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