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