diff --git a/contrib/other-builds/moses2/Hypothesis.cpp b/contrib/other-builds/moses2/Hypothesis.cpp index e483ea479..334e6a74f 100644 --- a/contrib/other-builds/moses2/Hypothesis.cpp +++ b/contrib/other-builds/moses2/Hypothesis.cpp @@ -123,4 +123,16 @@ void Hypothesis::EmptyHypothesisState(const Phrase &input) } } +void Hypothesis::EvaluateWhenApplied() +{ + const std::vector &sfffs = m_mgr.GetSystem().GetFeatureFunctions().GetStatefulFeatureFunctions(); + BOOST_FOREACH(const StatefulFeatureFunction *sfff, sfffs) { + size_t statefulInd = sfff->GetStatefulInd(); + const Moses::FFState *prevState = m_prevHypo->GetState(statefulInd); + assert(prevState); + const Moses::FFState *state = sfff->EvaluateWhenApplied(m_mgr, *this, *prevState, *m_scores); + m_ffStates[statefulInd] = state; + } + +} diff --git a/contrib/other-builds/moses2/Hypothesis.h b/contrib/other-builds/moses2/Hypothesis.h index 7d30c1f35..5d582f090 100644 --- a/contrib/other-builds/moses2/Hypothesis.h +++ b/contrib/other-builds/moses2/Hypothesis.h @@ -44,10 +44,15 @@ public: const Scores &GetScores() const { return *m_scores; } + const Moses::FFState *GetState(size_t ind) const + { return m_ffStates[ind]; } + void OutputToStream(std::ostream &out) const; void EmptyHypothesisState(const Phrase &input); + void EvaluateWhenApplied(); + protected: Manager &m_mgr; const TargetPhrase &m_targetPhrase; diff --git a/contrib/other-builds/moses2/SearchNormal.cpp b/contrib/other-builds/moses2/SearchNormal.cpp index 2857f92ac..29e31c980 100644 --- a/contrib/other-builds/moses2/SearchNormal.cpp +++ b/contrib/other-builds/moses2/SearchNormal.cpp @@ -89,6 +89,7 @@ void SearchNormal::Extend(const Hypothesis &hypo, const Moses::Bitmap &newBitmap) { Hypothesis *newHypo = new (m_mgr.GetPool().Allocate()) Hypothesis(hypo, tp, pathRange, newBitmap); + newHypo->EvaluateWhenApplied(); size_t numWordsCovered = newBitmap.GetNumWordsCovered(); StackAdd stackAdded = m_stacks[numWordsCovered].Add(newHypo);