mosesdecoder/moses/FF/SkeletonStatefulFF.cpp

61 lines
1.7 KiB
C++
Raw Normal View History

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
, ScoreComponentCollection &scoreBreakdown) 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);
int targetLen = cur_hypo.GetCurrTargetPhrase().GetSize();
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
}