00001 #pragma once 00002 00003 #include <string> 00004 #include <boost/unordered_set.hpp> 00005 00006 #include "StatelessFeatureFunction.h" 00007 #include "moses/FactorCollection.h" 00008 #include "moses/AlignmentInfo.h" 00009 00010 namespace Moses 00011 { 00012 00015 class TargetWordInsertionFeature : public StatelessFeatureFunction 00016 { 00017 private: 00018 boost::unordered_set<std::string> m_vocab; 00019 FactorType m_factorType; 00020 bool m_unrestricted; 00021 std::string m_filename; 00022 00023 public: 00024 TargetWordInsertionFeature(const std::string &line); 00025 00026 bool IsUseable(const FactorMask &mask) const; 00027 00028 void Load(AllOptions::ptr const& opts); 00029 00030 virtual void EvaluateInIsolation(const Phrase &source 00031 , const TargetPhrase &targetPhrase 00032 , ScoreComponentCollection &scoreBreakdown 00033 , ScoreComponentCollection &estimatedScores) const; 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 void EvaluateWhenApplied(const Hypothesis& hypo, 00042 ScoreComponentCollection* accumulator) const { 00043 } 00044 void EvaluateWhenApplied(const ChartHypothesis &hypo, 00045 ScoreComponentCollection* accumulator) const { 00046 } 00047 00048 void EvaluateTranslationOptionListWithSourceContext(const InputType &input 00049 , const TranslationOptionList &translationOptionList) const { 00050 } 00051 00052 void ComputeFeatures(const Phrase &source, 00053 const TargetPhrase& targetPhrase, 00054 ScoreComponentCollection* accumulator, 00055 const AlignmentInfo &alignmentInfo) const; 00056 void SetParameter(const std::string& key, const std::string& value); 00057 00058 }; 00059 00060 } 00061