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 SourceWordDeletionFeature : 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 SourceWordDeletionFeature(const std::string &line); 00025 00026 void Load(AllOptions::ptr const& opts); 00027 00028 bool IsUseable(const FactorMask &mask) const; 00029 00030 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 00042 void EvaluateTranslationOptionListWithSourceContext(const InputType &input 00043 , const TranslationOptionList &translationOptionList) const { 00044 } 00045 00046 00047 void EvaluateWhenApplied(const Hypothesis& hypo, 00048 ScoreComponentCollection* accumulator) const { 00049 } 00050 void EvaluateWhenApplied(const ChartHypothesis &hypo, 00051 ScoreComponentCollection* accumulator) const { 00052 } 00053 00054 void ComputeFeatures(const Phrase &source, 00055 const TargetPhrase& targetPhrase, 00056 ScoreComponentCollection* accumulator, 00057 const AlignmentInfo &alignmentInfo) const; 00058 void SetParameter(const std::string& key, const std::string& value); 00059 00060 }; 00061 00062 } 00063