00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef moses_DecodeFeature
00023 #define moses_DecodeFeature
00024
00025 #include <vector>
00026
00027 #include "moses/FF/StatelessFeatureFunction.h"
00028 #include "moses/FactorTypeSet.h"
00029 #include "moses/TypeDef.h"
00030
00031 namespace Moses
00032 {
00033 class DecodeStep;
00034 class DecodeGraph;
00035
00039 class DecodeFeature : public StatelessFeatureFunction
00040 {
00041
00042 public:
00043 DecodeFeature(const std::string &line, bool registerNow);
00044
00045 DecodeFeature(size_t numScoreComponents
00046 , const std::string &line);
00047
00048 DecodeFeature(size_t numScoreComponents
00049 , const std::vector<FactorType> &input
00050 , const std::vector<FactorType> &output
00051 , const std::string &line);
00052
00054 const FactorMask& GetOutputFactorMask() const;
00055
00057 const FactorMask& GetInputFactorMask() const;
00058
00059 const std::vector<FactorType>& GetInput() const;
00060 const std::vector<FactorType>& GetOutput() const;
00061
00062 bool IsUseable(const FactorMask &mask) const;
00063 void SetParameter(const std::string& key, const std::string& value);
00064
00065 void EvaluateWhenApplied(const Hypothesis& hypo,
00066 ScoreComponentCollection* accumulator) const {
00067 }
00068 void EvaluateWhenApplied(const ChartHypothesis &hypo,
00069 ScoreComponentCollection* accumulator) const {
00070 }
00071 void EvaluateWhenApplied(const Syntax::SHyperedge &hyperedge,
00072 ScoreComponentCollection* accumulator) const {
00073 }
00074 void EvaluateWithSourceContext(const InputType &input
00075 , const InputPath &inputPath
00076 , const TargetPhrase &targetPhrase
00077 , const StackVec *stackVec
00078 , ScoreComponentCollection &scoreBreakdown
00079 , ScoreComponentCollection *estimatedScores = NULL) const {
00080 }
00081 void EvaluateTranslationOptionListWithSourceContext(const InputType &input
00082 , const TranslationOptionList &translationOptionList) const {
00083 }
00084
00085 void EvaluateInIsolation(const Phrase &source
00086 , const TargetPhrase &targetPhrase
00087 , ScoreComponentCollection &scoreBreakdown
00088 , ScoreComponentCollection &estimatedScores) const {
00089 }
00090
00091 void SetContainer(const DecodeStep *container) {
00092 m_container = container;
00093 }
00094
00095 const DecodeGraph &GetDecodeGraph() const;
00096
00097 protected:
00098 std::vector<FactorType> m_input;
00099 std::vector<FactorType> m_output;
00100 FactorMask m_inputFactors;
00101 FactorMask m_outputFactors;
00102 const DecodeStep *m_container;
00103 };
00104
00105 }
00106
00107 #endif