update worse score during pruning

This commit is contained in:
Hieu Hoang 2016-12-06 14:00:04 +00:00
parent 40a2588fd0
commit a6d226c6b6

View File

@ -250,10 +250,19 @@ void HypothesisColl::PruneHypos(const ManagerBase &mgr, ArcLists &arcLists)
std::partial_sort(sortedHypos.begin(), iterMiddle, sortedHypos.end(),
HypothesisFutureScoreOrderer());
// update worse score
m_worseScore = std::numeric_limits<float>::infinity();
for (size_t i = 0; i < maxStackSize; ++i) {
HypothesisBase *hypo = const_cast<HypothesisBase*>(sortedHypos[i]);
if (hypo->GetFutureScore() < m_worseScore) {
m_worseScore = hypo->GetFutureScore();
}
}
// prune
if (maxStackSize && sortedHypos.size() > maxStackSize) {
for (size_t i = maxStackSize; i < sortedHypos.size(); ++i) {
HypothesisBase *hypo = const_cast<HypothesisBase*>((sortedHypos)[i]);
HypothesisBase *hypo = const_cast<HypothesisBase*>(sortedHypos[i]);
// delete from arclist
if (mgr.system.options.nbest.nbest_size) {