get ready for evaluation

This commit is contained in:
Hieu Hoang 2016-04-18 08:55:13 +04:00
parent d667f57342
commit 63b72425fa
5 changed files with 18 additions and 7 deletions

View File

@ -176,8 +176,8 @@ void Hypothesis::EvaluateWhenApplied()
const std::vector<const StatefulFeatureFunction*> &sfffs =
GetManager().system.featureFunctions.GetStatefulFeatureFunctions();
BOOST_FOREACH(const StatefulFeatureFunction *sfff, sfffs){
EvaluateWhenApplied(*sfff);
}
EvaluateWhenApplied(*sfff);
}
//cerr << *this << endl;
}

View File

@ -1,5 +1,9 @@
#include <boost/foreach.hpp>
#include "Hypothesis.h"
#include "Manager.h"
#include "../System.h"
#include "../Scores.h"
#include "../FF/StatefulFeatureFunction.h"
namespace Moses2
{
@ -19,11 +23,17 @@ void Hypothesis::Init(SCFG::Manager &mgr, const InputPathBase &path, const SCFG:
SCORE Hypothesis::GetFutureScore() const
{
return GetScores().GetTotalScore();
}
void Hypothesis::EvaluateWhenApplied()
{
const std::vector<const StatefulFeatureFunction*> &sfffs =
GetManager().system.featureFunctions.GetStatefulFeatureFunctions();
BOOST_FOREACH(const StatefulFeatureFunction *sfff, sfffs){
//EvaluateWhenApplied(*sfff);
}
//cerr << *this << endl;
}

View File

@ -113,7 +113,8 @@ void Manager::Decode(size_t startPos, size_t size)
SCFG::Hypothesis *hypo = new SCFG::Hypothesis(GetPool(), system);
hypo->Init(*this, path, tp);
stack.Add(hypo, hypoRecycler, arcLists);
StackAdd added = stack.Add(hypo, hypoRecycler, arcLists);
cerr << "added=" << added.added << " " << (const Phrase&) tp << endl;
}
}

View File

@ -15,14 +15,14 @@ Stack::Stack(const Manager &mgr)
{
}
void Stack::Add(SCFG::Hypothesis *hypo, Recycler<HypothesisBase*> &hypoRecycle,
StackAdd Stack::Add(SCFG::Hypothesis *hypo, Recycler<HypothesisBase*> &hypoRecycle,
ArcLists &arcLists)
{
const SCFG::TargetPhraseImpl &tp = hypo->GetTargetPhrase();
const SCFG::Word &lhs = tp.lhs;
HypothesisColl &coll = GetMiniStack(lhs);
StackAdd added = coll.Add(hypo);
return added;
}
Moses2::HypothesisColl &Stack::GetMiniStack(const SCFG::Word &key)

View File

@ -32,7 +32,7 @@ public:
size_t GetSize() const;
void Add(SCFG::Hypothesis *hypo, Recycler<HypothesisBase*> &hypoRecycle,
StackAdd Add(SCFG::Hypothesis *hypo, Recycler<HypothesisBase*> &hypoRecycle,
ArcLists &arcLists);
protected: