00001 #ifndef moses_PhraseLengthFeature_h 00002 #define moses_PhraseLengthFeature_h 00003 00004 #include <stdexcept> 00005 #include <string> 00006 #include <map> 00007 00008 #include "StatelessFeatureFunction.h" 00009 #include "moses/Word.h" 00010 #include "moses/FactorCollection.h" 00011 00012 namespace Moses 00013 { 00014 00017 class PhraseLengthFeature : public StatelessFeatureFunction 00018 { 00019 public: 00020 PhraseLengthFeature(const std::string &line); 00021 00022 bool IsUseable(const FactorMask &mask) const { 00023 return true; 00024 } 00025 00026 void EvaluateWhenApplied(const Hypothesis& hypo, 00027 ScoreComponentCollection* accumulator) const { 00028 } 00029 00030 void EvaluateWhenApplied(const ChartHypothesis& hypo, 00031 ScoreComponentCollection*) const { 00032 } 00033 00034 void EvaluateWithSourceContext(const InputType &input 00035 , const InputPath &inputPath 00036 , const TargetPhrase &targetPhrase 00037 , const StackVec *stackVec 00038 , ScoreComponentCollection &scoreBreakdown 00039 , ScoreComponentCollection *estimatedScores = NULL) const { 00040 } 00041 00042 void EvaluateTranslationOptionListWithSourceContext(const InputType &input 00043 , const TranslationOptionList &translationOptionList) const { 00044 } 00045 virtual void EvaluateInIsolation(const Phrase &source 00046 , const TargetPhrase &targetPhrase 00047 , ScoreComponentCollection &scoreBreakdown 00048 , ScoreComponentCollection &estimatedScores) const; 00049 00050 }; 00051 00052 } 00053 00054 #endif // moses_PhraseLengthFeature_h