#pragma once #include #include #include #include "moses/FF/StatefulFeatureFunction.h" #include "moses/Manager.h" #include "moses/FF/OSM-Feature/osmHyp.h" #include "KenOSM.h" namespace Moses { class OpSequenceModel : public StatefulFeatureFunction { public: OSMLM* OSM; float unkOpProb; int sFactor; // Source Factor ... int tFactor; // Target Factor ... int numFeatures; // Number of features used ... util::LoadMethod load_method; // method to load model OpSequenceModel(const std::string &line); ~OpSequenceModel(); void readLanguageModel(const char *); void Load(AllOptions::ptr const& opts); FFState* EvaluateWhenApplied( const Hypothesis& cur_hypo, const FFState* prev_state, ScoreComponentCollection* accumulator) const; virtual FFState* EvaluateWhenApplied( const ChartHypothesis& /* cur_hypo */, int /* featureID - used to index the state in the previous hypotheses */, ScoreComponentCollection* accumulator) const; void EvaluateInIsolation(const Phrase &source , const TargetPhrase &targetPhrase , ScoreComponentCollection &scoreBreakdown , ScoreComponentCollection &estimatedScores) const; virtual const FFState* EmptyHypothesisState(const InputType &input) const; virtual std::string GetScoreProducerWeightShortName(unsigned idx=0) const; std::vector GetFutureScores(const Phrase &source, const Phrase &target) const; void SetParameter(const std::string& key, const std::string& value); bool IsUseable(const FactorMask &mask) const; protected: typedef std::pair ParallelPhrase; typedef std::vector Scores; std::map m_futureCost; std::vector < std::pair < std::set , std::set > > ceptsInPhrase; std::set targetNullWords; std::string m_lmPath; }; } // namespace