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& description, const std::string &line);
|
|
|
|
StatelessFeatureFunction(const std::string& description, size_t numScoreComponents, const std::string &line);
|
|
|
|
/**
|
|
|
|
* This should be implemented for features that apply to phrase-based models.
|
|
|
|
**/
|
|
|
|
virtual void Evaluate(const PhraseBasedFeatureContext& context,
|
2013-06-10 21:11:55 +04:00
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
2013-05-24 22:11:15 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Same for chart-based features.
|
|
|
|
**/
|
|
|
|
virtual void EvaluateChart(const ChartBasedFeatureContext& context,
|
2013-06-10 21:11:55 +04:00
|
|
|
ScoreComponentCollection* accumulator) const {
|
|
|
|
}
|
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
|
|
|
|
|