blob: 3f120a1de3fe56a0caf82fafdc27332bc7673ed7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include "FeatureFunction.h"
namespace Moses
{
/** 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:
static const std::vector<const StatelessFeatureFunction*>& GetStatelessFeatureFunctions() {
return m_statelessFFs;
}
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,
ScoreComponentCollection* accumulator) const
{}
/**
* Same for chart-based features.
**/
virtual void EvaluateChart(const ChartBasedFeatureContext& context,
ScoreComponentCollection* accumulator) const
{}
virtual bool IsStateless() const {
return true;
}
};
} // namespace
|