mosesdecoder/moses/FF/StatelessFeatureFunction.h

44 lines
1.1 KiB
C
Raw Normal View History

2013-05-24 21:34:47 +04:00
#pragma once
2013-05-24 22:11:15 +04:00
#include "FeatureFunction.h"
2013-05-24 21:34:47 +04:00
namespace Moses
{
2013-05-24 22:11:15 +04:00
/** base class for all stateless feature functions.
* eg. phrase table, word penalty, phrase penalty
*/
class StatelessFeatureFunction: public FeatureFunction
{
//All stateless FFs, except those that cache scores in T-Option
static std::vector<const StatelessFeatureFunction*> m_statelessFFs;
public:
2013-05-29 21:16:15 +04:00
static const std::vector<const StatelessFeatureFunction*>& GetStatelessFeatureFunctions() {
return m_statelessFFs;
}
2013-05-24 22:11:15 +04:00
StatelessFeatureFunction(const std::string &line);
StatelessFeatureFunction(size_t numScoreComponents, const std::string &line);
2013-05-24 22:11:15 +04:00
/**
* This should be implemented for features that apply to phrase-based models.
**/
2013-08-23 17:25:25 +04:00
virtual void Evaluate(const Hypothesis& hypo,
ScoreComponentCollection* accumulator) const = 0;
2013-05-24 22:11:15 +04:00
/**
* Same for chart-based features.
**/
2013-08-23 18:00:47 +04:00
virtual void EvaluateChart(const ChartHypothesis &hypo,
ScoreComponentCollection* accumulator) const = 0;
2013-05-24 22:11:15 +04:00
2013-05-29 21:16:15 +04:00
virtual bool IsStateless() const {
return true;
}
2013-05-24 22:11:15 +04:00
};
2013-05-24 21:34:47 +04:00
} // namespace