00001 #pragma once
00002 #include <string>
00003 #include "StatelessFeatureFunction.h"
00004
00005 namespace Moses
00006 {
00007
00008
00009 class SpanLength : public StatelessFeatureFunction
00010 {
00011 public:
00012 SpanLength(const std::string &line);
00013
00014 virtual bool IsUseable(const FactorMask &mask) const {
00015 return true;
00016 }
00017
00018 virtual void EvaluateInIsolation(const Phrase &source
00019 , const TargetPhrase &targetPhrase
00020 , ScoreComponentCollection &scoreBreakdown
00021 , ScoreComponentCollection &estimatedScores) const;
00022
00023 virtual void EvaluateWithSourceContext(const InputType &input
00024 , const InputPath &inputPath
00025 , const TargetPhrase &targetPhrase
00026 , const StackVec *stackVec
00027 , ScoreComponentCollection &scoreBreakdown
00028 , ScoreComponentCollection *estimatedScores = NULL) const;
00029
00030 void EvaluateTranslationOptionListWithSourceContext(const InputType &input
00031 , const TranslationOptionList &translationOptionList) const {
00032 }
00033
00034
00035 virtual void EvaluateWhenApplied(const Hypothesis& hypo,
00036 ScoreComponentCollection* accumulator) const {
00037 }
00038
00039 virtual void EvaluateWhenApplied(const ChartHypothesis &hypo,
00040 ScoreComponentCollection* accumulator) const {
00041 }
00042
00043 void SetParameter(const std::string& key, const std::string& value);
00044
00045 protected:
00046 enum SmoothingMethod {
00047 None,
00048 PlusConst,
00049 };
00050 SmoothingMethod m_smoothingMethod;
00051
00052 float m_const;
00053 };
00054
00055 }
00056