diff options
author | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-12-10 02:05:00 +0300 |
---|---|---|
committer | Ulrich Germann <Ulrich.Germann@gmail.com> | 2015-12-10 02:05:00 +0300 |
commit | 240b88c6834c9c94e8a6448a34dc4ad33bdf3fbd (patch) | |
tree | e9f43dba3717e8a430557c16a1d6543a13628ddf /moses/HypothesisStackNormal.cpp | |
parent | ad5e27ae56298564dfd73637c160a682b5f5f028 (diff) |
Passing around AllOptions or references thereto everywhere,
strong them locally where appropriate, so that compontents can
become independent of StaticData once instantiated.
Diffstat (limited to 'moses/HypothesisStackNormal.cpp')
-rw-r--r-- | moses/HypothesisStackNormal.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/moses/HypothesisStackNormal.cpp b/moses/HypothesisStackNormal.cpp index e07af6189..76ddd3e84 100644 --- a/moses/HypothesisStackNormal.cpp +++ b/moses/HypothesisStackNormal.cpp @@ -35,7 +35,7 @@ namespace Moses HypothesisStackNormal::HypothesisStackNormal(Manager& manager) : HypothesisStack(manager) { - m_nBestIsEnabled = manager.options().nbest.enabled; + m_nBestIsEnabled = manager.options()->nbest.enabled; m_bestScore = -std::numeric_limits<float>::infinity(); m_worstScore = -std::numeric_limits<float>::infinity(); } @@ -75,7 +75,12 @@ pair<HypothesisStackNormal::iterator, bool> HypothesisStackNormal::Add(Hypothesi size_t toleratedSize = 2*m_maxHypoStackSize-1; // add in room for stack diversity if (m_minHypoStackDiversity) - toleratedSize += m_minHypoStackDiversity << m_manager.options().reordering.max_distortion; + { + // so what happens if maxdistortion is negative? + toleratedSize += m_minHypoStackDiversity + << m_manager.options()->reordering.max_distortion; + } + if (m_hypos.size() > toleratedSize) { PruneToSize(m_maxHypoStackSize); } else { @@ -96,7 +101,7 @@ bool HypothesisStackNormal::AddPrune(Hypothesis *hypo) } // too bad for stack. don't bother adding hypo into collection - if (m_manager.options().search.disable_discarding == false + if (m_manager.options()->search.disable_discarding == false && hypo->GetFutureScore() < m_worstScore && ! ( m_minHypoStackDiversity > 0 && hypo->GetFutureScore() >= GetWorstScoreForBitmap( hypo->GetWordsBitmap() ) ) ) { @@ -265,7 +270,7 @@ void HypothesisStackNormal::CleanupArcList() iterator iter; for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) { Hypothesis *mainHypo = *iter; - mainHypo->CleanupArcList(this->m_manager.options().nbest.nbest_size, this->m_manager.options().NBestDistinct()); + mainHypo->CleanupArcList(this->m_manager.options()->nbest.nbest_size, this->m_manager.options()->NBestDistinct()); } } |