mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
update worse score during pruning
This commit is contained in:
parent
40a2588fd0
commit
a6d226c6b6
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user