enum StatelessFeatureType

This commit is contained in:
Hieu Hoang 2013-04-30 18:45:36 +01:00
parent 26a4aa8d18
commit a311f07d1f
3 changed files with 17 additions and 13 deletions

View File

@ -181,16 +181,6 @@ StatelessFeatureFunction::StatelessFeatureFunction(const std::string& descriptio
m_statelessFFs.push_back(this); m_statelessFFs.push_back(this);
} }
bool StatelessFeatureFunction::IsStateless() const
{
return true;
}
bool StatelessFeatureFunction::ComputeValueInTranslationOption() const
{
return false;
}
StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, const std::string &line) StatefulFeatureFunction::StatefulFeatureFunction(const std::string& description, const std::string &line)
: FeatureFunction(description, line) : FeatureFunction(description, line)
{ {

View File

@ -158,15 +158,22 @@ public:
virtual void EvaluateChart(const ChartBasedFeatureContext& context, virtual void EvaluateChart(const ChartBasedFeatureContext& context,
ScoreComponentCollection* accumulator) const = 0; ScoreComponentCollection* accumulator) const = 0;
virtual StatelessFeatureType GetStatelessFeatureType() const
{ return CacheableInPhraseTable; }
//If true, then the feature is evaluated before search begins, and stored in //If true, then the feature is evaluated before search begins, and stored in
//the TranslationOptionCollection. //the TranslationOptionCollection.
virtual bool ComputeValueInTranslationOption() const; virtual bool ComputeValueInTranslationOption() const
{ return false; }
//!If true, the feature is stored in the ttable, so gets copied into the //!If true, the feature is stored in the ttable, so gets copied into the
//TargetPhrase and does not need cached in the TranslationOption //TargetPhrase and does not need cached in the TranslationOption
virtual bool ComputeValueInTranslationTable() const {return false;} virtual bool ComputeValueInTranslationTable() const
{ return false;}
bool IsStateless() const
{ return true; }
bool IsStateless() const;
}; };
/** base class for all stateful feature functions. /** base class for all stateful feature functions.

View File

@ -175,6 +175,13 @@ enum FormatType
,HieroFormat ,HieroFormat
}; };
enum StatelessFeatureType
{
CacheableInPhraseTable // simplest. eg. phrase table scores. word penalty, phrase penalty.
,DependsOnSource // can't be pre-computed during training, but can't be computed before search.eg. source bag-of-word features
,NotCacheable // can't be pre-computed. Depends on segmentation during search. eg. span-length feature
};
// typedef // typedef
typedef size_t FactorType; typedef size_t FactorType;