00001 #pragma once 00002 00003 #include "FeatureFunction.h" 00004 00005 00006 namespace Moses 00007 { 00008 00009 namespace Syntax 00010 { 00011 struct SHyperedge; 00012 } 00013 00017 class StatelessFeatureFunction: public FeatureFunction 00018 { 00019 //All stateless FFs, except those that cache scores in T-Option 00020 static std::vector<const StatelessFeatureFunction*> m_statelessFFs; 00021 00022 public: 00023 static const std::vector<const StatelessFeatureFunction*>& GetStatelessFeatureFunctions() { 00024 return m_statelessFFs; 00025 } 00026 00027 StatelessFeatureFunction(const std::string &line, bool registerNow); 00028 StatelessFeatureFunction(size_t numScoreComponents, const std::string &line); 00029 00033 virtual void EvaluateWhenApplied(const Hypothesis& hypo, 00034 ScoreComponentCollection* accumulator) const = 0; 00035 00039 virtual void EvaluateWhenApplied(const ChartHypothesis &hypo, 00040 ScoreComponentCollection* accumulator) const = 0; 00041 00042 virtual void EvaluateWhenApplied(const Syntax::SHyperedge &, 00043 ScoreComponentCollection*) const { 00044 assert(false); 00045 } 00046 00047 virtual bool IsStateless() const { 00048 return true; 00049 } 00050 00051 }; 00052 00053 00054 } // namespace 00055