2013-09-25 23:19:05 +04:00
|
|
|
#include <vector>
|
2013-09-01 19:58:23 +04:00
|
|
|
#include "SkeletonStatefulFF.h"
|
2013-09-25 23:19:05 +04:00
|
|
|
#include "moses/ScoreComponentCollection.h"
|
|
|
|
#include "moses/Hypothesis.h"
|
|
|
|
|
|
|
|
using namespace std;
|
2013-09-01 19:58:23 +04:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
2013-09-25 23:19:05 +04:00
|
|
|
int SkeletonState::Compare(const FFState& other) const
|
|
|
|
{
|
2013-09-27 12:35:24 +04:00
|
|
|
const SkeletonState &otherState = static_cast<const SkeletonState&>(other);
|
2013-09-25 23:19:05 +04:00
|
|
|
|
2013-09-27 12:35:24 +04:00
|
|
|
if (m_targetLen == otherState.m_targetLen)
|
|
|
|
return 0;
|
|
|
|
return (m_targetLen < otherState.m_targetLen) ? -1 : +1;
|
2013-09-25 23:19:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SkeletonStatefulFF::Evaluate(const Phrase &source
|
2013-09-27 12:35:24 +04:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const
|
2013-09-25 23:19:05 +04:00
|
|
|
{}
|
|
|
|
|
|
|
|
void SkeletonStatefulFF::Evaluate(const InputType &input
|
2013-09-27 12:35:24 +04:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
2014-05-08 20:51:45 +04:00
|
|
|
, const StackVec *stackVec
|
2013-12-03 19:50:41 +04:00
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection *estimatedFutureScore) const
|
2013-09-25 23:19:05 +04:00
|
|
|
{}
|
|
|
|
|
|
|
|
FFState* SkeletonStatefulFF::Evaluate(
|
2013-09-27 12:35:24 +04:00
|
|
|
const Hypothesis& cur_hypo,
|
|
|
|
const FFState* prev_state,
|
|
|
|
ScoreComponentCollection* accumulator) const
|
2013-09-25 23:19:05 +04:00
|
|
|
{
|
2013-09-27 12:35:24 +04:00
|
|
|
// dense scores
|
|
|
|
vector<float> newScores(m_numScoreComponents);
|
|
|
|
newScores[0] = 1.5;
|
|
|
|
newScores[1] = 0.3;
|
|
|
|
newScores[2] = 0.4;
|
|
|
|
accumulator->PlusEquals(this, newScores);
|
|
|
|
|
|
|
|
// sparse scores
|
|
|
|
accumulator->PlusEquals(this, "sparse-name", 2.4);
|
|
|
|
|
2014-05-31 17:33:31 +04:00
|
|
|
// int targetLen = cur_hypo.GetCurrTargetPhrase().GetSize(); // ??? [UG]
|
2013-09-27 12:35:24 +04:00
|
|
|
return new SkeletonState(0);
|
2013-09-25 23:19:05 +04:00
|
|
|
}
|
|
|
|
|
2013-09-27 12:35:24 +04:00
|
|
|
FFState* SkeletonStatefulFF::EvaluateChart(
|
|
|
|
const ChartHypothesis& /* cur_hypo */,
|
|
|
|
int /* featureID - used to index the state in the previous hypotheses */,
|
|
|
|
ScoreComponentCollection* accumulator) const
|
|
|
|
{
|
|
|
|
return new SkeletonState(0);
|
|
|
|
}
|
2013-09-01 19:58:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|