mosesdecoder/contrib/other-builds/moses2/FF/Distortion.h
2016-01-18 15:37:04 +00:00

66 lines
1.4 KiB
C++

/*
* Distortion.h
*
* Created on: 28 Oct 2015
* Author: hieu
*/
#ifndef DISTORTION_H_
#define DISTORTION_H_
#include "StatefulFeatureFunction.h"
#include "../legacy/Range.h"
#include "../TypeDef.h"
namespace Moses2
{
class Distortion : public StatefulFeatureFunction
{
public:
Distortion(size_t startInd, const std::string &line);
virtual ~Distortion();
virtual FFState* BlankState(MemPool &pool) const;
virtual void EmptyHypothesisState(FFState &state,
const Manager &mgr,
const InputType &input,
const Hypothesis &hypo) const;
virtual void
EvaluateInIsolation(MemPool &pool,
const System &system,
const Phrase &source,
const TargetPhrase &targetPhrase,
Scores &scores,
SCORE *estimatedScore) const;
virtual void EvaluateWhenApplied(const std::deque<Hypothesis*> &hypos) const
{}
virtual void EvaluateWhenApplied(const Manager &mgr,
const Hypothesis &hypo,
const FFState &prevState,
Scores &scores,
FFState &state) const;
virtual void EvaluateWhenAppliedNonBatch(const Manager &mgr,
const Hypothesis &hypo,
const FFState &prevState,
Scores &scores,
FFState &state) const
{
EvaluateWhenApplied(mgr, hypo, prevState, scores, state);
}
protected:
SCORE CalculateDistortionScore(const Range &prev, const Range &curr, const int FirstGap) const;
int ComputeDistortionDistance(const Range& prev, const Range& current) const;
};
}
#endif /* DISTORTION_H_ */