00001 #pragma once
00002
00003 #include <string>
00004 #include <boost/unordered_set.hpp>
00005
00006 #include "moses/FactorCollection.h"
00007 #include "moses/Sentence.h"
00008 #include "StatelessFeatureFunction.h"
00009
00010 namespace Moses
00011 {
00012
00015 class WordTranslationFeature : public StatelessFeatureFunction
00016 {
00017
00018 typedef std::map< char, short > CharHash;
00019 typedef std::vector< boost::unordered_set<std::string> > DocumentVector;
00020
00021 private:
00022 boost::unordered_set<std::string> m_vocabSource;
00023 boost::unordered_set<std::string> m_vocabTarget;
00024 DocumentVector m_vocabDomain;
00025 FactorType m_factorTypeSource;
00026 FactorType m_factorTypeTarget;
00027 bool m_unrestricted;
00028 bool m_simple;
00029 bool m_sourceContext;
00030 bool m_targetContext;
00031 bool m_domainTrigger;
00032 bool m_ignorePunctuation;
00033 CharHash m_punctuationHash;
00034 std::string m_filePathSource;
00035 std::string m_filePathTarget;
00036
00037 public:
00038 WordTranslationFeature(const std::string &line);
00039
00040 void SetParameter(const std::string& key, const std::string& value);
00041 bool IsUseable(const FactorMask &mask) const;
00042
00043 void Load(AllOptions::ptr const& opts);
00044
00045 void EvaluateWithSourceContext(const InputType &input
00046 , const InputPath &inputPath
00047 , const TargetPhrase &targetPhrase
00048 , const StackVec *stackVec
00049 , ScoreComponentCollection &scoreBreakdown
00050 , ScoreComponentCollection *estimatedScores = NULL) const;
00051
00052 void EvaluateInIsolation(const Phrase &source
00053 , const TargetPhrase &targetPhrase
00054 , ScoreComponentCollection &scoreBreakdown
00055 , ScoreComponentCollection &estimatedScores) const {
00056 }
00057
00058 void EvaluateWhenApplied(const Hypothesis& hypo,
00059 ScoreComponentCollection* accumulator) const {
00060 }
00061
00062 void EvaluateWhenApplied(const ChartHypothesis &hypo,
00063 ScoreComponentCollection* accumulator) const {
00064 }
00065
00066 void EvaluateTranslationOptionListWithSourceContext(const InputType &input
00067 , const TranslationOptionList &translationOptionList) const {
00068 }
00069
00070
00071 };
00072
00073 }
00074