00001 #pragma once 00002 00003 #include <string> 00004 #include "StatelessFeatureFunction.h" 00005 00006 namespace Moses 00007 { 00008 00009 class ExampleTranslationOptionListFeature : public StatelessFeatureFunction 00010 { 00011 public: 00012 ExampleTranslationOptionListFeature(const std::string &line) 00013 :StatelessFeatureFunction(1, line) { 00014 ReadParameters(); 00015 } 00016 00017 bool IsUseable(const FactorMask &mask) const { 00018 return true; 00019 } 00020 00021 void EvaluateInIsolation(const Phrase &source 00022 , const TargetPhrase &targetPhrase 00023 , ScoreComponentCollection &scoreBreakdown 00024 , ScoreComponentCollection &estimatedFutureScore) const { 00025 } 00026 00027 void EvaluateWithSourceContext(const InputType &input 00028 , const InputPath &inputPath 00029 , const TargetPhrase &targetPhrase 00030 , const StackVec *stackVec 00031 , ScoreComponentCollection &scoreBreakdown 00032 , ScoreComponentCollection *estimatedFutureScore = NULL) const { 00033 } 00034 00035 void EvaluateTranslationOptionListWithSourceContext(const InputType &input 00036 , const TranslationOptionList &translationOptionList) const { 00037 std::vector<float> newScores(m_numScoreComponents); 00038 newScores[0] = translationOptionList.size(); 00039 00040 TranslationOptionList::const_iterator iterTransOpt; 00041 for(iterTransOpt = translationOptionList.begin() ; 00042 iterTransOpt != translationOptionList.end() ; ++iterTransOpt) { 00043 TranslationOption &transOpt = **iterTransOpt; 00044 00045 ScoreComponentCollection &scoreBreakDown = transOpt.GetScoreBreakdown(); 00046 scoreBreakDown.PlusEquals(this, newScores); 00047 00048 transOpt.UpdateScore(); 00049 } 00050 } 00051 00052 void EvaluateWhenApplied(const Hypothesis& hypo, 00053 ScoreComponentCollection* accumulator) const { 00054 } 00055 00056 void EvaluateWhenApplied(const ChartHypothesis &hypo, 00057 ScoreComponentCollection* accumulator) const { 00058 } 00059 00060 00061 void SetParameter(const std::string& key, const std::string& value) { 00062 } 00063 00064 }; 00065 00066 } 00067