2014-06-04 19:52:57 +04:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "StatelessFeatureFunction.h"
|
|
|
|
|
|
|
|
namespace Moses
|
|
|
|
{
|
|
|
|
|
|
|
|
// Rule Scope - not quite completely implemented yet
|
|
|
|
class SpanLength : public StatelessFeatureFunction
|
|
|
|
{
|
|
|
|
public:
|
2015-01-14 14:07:42 +03:00
|
|
|
SpanLength(const std::string &line);
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
virtual bool IsUseable(const FactorMask &mask) const {
|
|
|
|
return true;
|
|
|
|
}
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
virtual void EvaluateInIsolation(const Phrase &source
|
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
2015-11-04 18:10:45 +03:00
|
|
|
, ScoreComponentCollection &estimatedScores) const;
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
virtual void EvaluateWithSourceContext(const InputType &input
|
|
|
|
, const InputPath &inputPath
|
|
|
|
, const TargetPhrase &targetPhrase
|
|
|
|
, const StackVec *stackVec
|
|
|
|
, ScoreComponentCollection &scoreBreakdown
|
2015-11-04 18:10:45 +03:00
|
|
|
, ScoreComponentCollection *estimatedScores = NULL) const;
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-06 15:56:13 +03:00
|
|
|
void EvaluateTranslationOptionListWithSourceContext(const InputType &input
|
2015-01-14 14:07:42 +03:00
|
|
|
, const TranslationOptionList &translationOptionList) const {
|
|
|
|
}
|
2015-01-06 12:46:31 +03:00
|
|
|
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
virtual void EvaluateWhenApplied(const Hypothesis& hypo,
|
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
virtual void EvaluateWhenApplied(const ChartHypothesis &hypo,
|
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
2014-06-04 19:52:57 +04:00
|
|
|
|
2015-01-14 14:07:42 +03:00
|
|
|
void SetParameter(const std::string& key, const std::string& value);
|
2014-06-04 19:52:57 +04:00
|
|
|
|
|
|
|
protected:
|
2015-01-14 14:07:42 +03:00
|
|
|
enum SmoothingMethod {
|
|
|
|
None,
|
|
|
|
PlusConst,
|
|
|
|
};
|
|
|
|
SmoothingMethod m_smoothingMethod;
|
|
|
|
|
|
|
|
float m_const;
|
2014-06-04 19:52:57 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|