2014-05-08 19:34:04 +04:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "StatelessFeatureFunction.h"
|
2014-05-12 22:44:31 +04:00
|
|
|
#include "moses/Word.h"
|
2014-05-08 19:34:04 +04:00
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
2014-05-16 13:39:26 +04:00
|
|
|
// -inf if left-most or right-most non-term is over a set span
|
2014-05-08 19:34:04 +04:00
|
|
|
class MaxSpanFreeNonTermSource : public StatelessFeatureFunction
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
MaxSpanFreeNonTermSource(const std::string &line);
|
|
|
|
|
|
|
|
virtual bool IsUseable(const FactorMask &mask) const
|
|
|
|
{ return true; }
|
|
|
|
|
2014-07-10 01:35:59 +04:00
|
|
|
virtual void EvaluateInIsolation(const Phrase &source
|
2014-05-08 19:34:04 +04:00
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection &estimatedFutureScore) const;
|
|
|
|
|
2014-07-10 02:06:54 +04:00
|
|
|
virtual void EvaluateWithSourceContext(const InputType &input
|
2014-05-08 19:34:04 +04:00
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
2014-05-08 20:51:45 +04:00
|
|
|
, const StackVec *stackVec
|
2014-05-08 19:34:04 +04:00
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
|
|
|
, ScoreComponentCollection *estimatedFutureScore = NULL) const;
|
|
|
|
|
2015-01-06 15:56:13 +03:00
|
|
|
void EvaluateTranslationOptionListWithSourceContext(const InputType &input
|
|
|
|
, const TranslationOptionList &translationOptionList) const
|
2015-01-06 12:46:31 +03:00
|
|
|
{}
|
|
|
|
|
2014-07-10 02:41:08 +04:00
|
|
|
virtual void EvaluateWhenApplied(const Hypothesis& hypo,
|
2014-05-08 19:34:04 +04:00
|
|
|
ScoreComponentCollection* accumulator) const
|
|
|
|
{}
|
|
|
|
|
2014-07-10 02:54:16 +04:00
|
|
|
virtual void EvaluateWhenApplied(const ChartHypothesis &hypo,
|
2014-05-08 19:34:04 +04:00
|
|
|
ScoreComponentCollection* accumulator) const
|
|
|
|
{}
|
|
|
|
|
|
|
|
void SetParameter(const std::string& key, const std::string& value);
|
|
|
|
std::vector<float> DefaultWeights() const;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int m_maxSpan;
|
2014-05-12 22:44:31 +04:00
|
|
|
std::string m_glueTargetLHSStr;
|
|
|
|
Word m_glueTargetLHS;
|
2014-05-08 19:34:04 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|