mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-19 07:07:24 +03:00
check there are hypos in stack vector before create translation options. constrained decoding works for syntax model
This commit is contained in:
parent
f88908f972
commit
7873dbb77a
@ -60,15 +60,13 @@ ChartHypothesisCollection::~ChartHypothesisCollection()
|
||||
*/
|
||||
bool ChartHypothesisCollection::AddHypothesis(ChartHypothesis *hypo, ChartManager &manager)
|
||||
{
|
||||
/*
|
||||
cerr << *hypo << endl;
|
||||
if (hypo->GetTotalScore() == - std::numeric_limits<float>::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();
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user