#include <OpSequenceModel.h>
Public Member Functions | |
OpSequenceModel (const std::string &line) | |
~OpSequenceModel () | |
void | readLanguageModel (const char *) |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
FFState * | EvaluateWhenApplied (const Hypothesis &cur_hypo, const FFState *prev_state, ScoreComponentCollection *accumulator) const |
This interface should be implemented. Notes: When evaluating the value of this feature function, you should avoid calling hypo.GetPrevHypo(). If you need something from the "previous" hypothesis, you should store it in an FFState object which will be passed in as prev_state. If you don't do this, you will get in trouble. | |
virtual FFState * | EvaluateWhenApplied (const ChartHypothesis &, int, ScoreComponentCollection *accumulator) const |
void | EvaluateInIsolation (const Phrase &source, const TargetPhrase &targetPhrase, ScoreComponentCollection &scoreBreakdown, ScoreComponentCollection &estimatedScores) const |
virtual const FFState * | EmptyHypothesisState (const InputType &input) const |
return the state associated with the empty hypothesis for a given sentence | |
virtual std::string | GetScoreProducerWeightShortName (unsigned idx=0) const |
std::vector< float > | GetFutureScores (const Phrase &source, const Phrase &target) const |
void | SetParameter (const std::string &key, const std::string &value) |
bool | IsUseable (const FactorMask &mask) const |
Public Attributes | |
OSMLM * | OSM |
float | unkOpProb |
int | sFactor |
int | tFactor |
int | numFeatures |
util::LoadMethod | load_method |
Protected Types | |
typedef std::pair< Phrase, Phrase > | ParallelPhrase |
typedef std::vector< float > | Scores |
Protected Attributes | |
std::map< ParallelPhrase, Scores > | m_futureCost |
std::vector< std::pair < std::set< int >, std::set < int > > > | ceptsInPhrase |
std::set< int > | targetNullWords |
std::string | m_lmPath |
Definition at line 14 of file OpSequenceModel.h.
typedef std::pair<Phrase, Phrase> Moses::OpSequenceModel::ParallelPhrase [protected] |
Definition at line 56 of file OpSequenceModel.h.
typedef std::vector<float> Moses::OpSequenceModel::Scores [protected] |
Definition at line 57 of file OpSequenceModel.h.
Moses::OpSequenceModel::OpSequenceModel | ( | const std::string & | line | ) |
Definition at line 13 of file OpSequenceModel.cpp.
References load_method, numFeatures, util::READ, Moses::FeatureFunction::ReadParameters(), sFactor, and tFactor.
Moses::OpSequenceModel::~OpSequenceModel | ( | ) |
const FFState * Moses::OpSequenceModel::EmptyHypothesisState | ( | const InputType & | input | ) | const [virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
Definition at line 208 of file OpSequenceModel.cpp.
References Moses::KenOSMBase::BeginSentenceState(), OSM, and VERBOSE.
void Moses::OpSequenceModel::EvaluateInIsolation | ( | const Phrase & | source, | |
const TargetPhrase & | targetPhrase, | |||
ScoreComponentCollection & | scoreBreakdown, | |||
ScoreComponentCollection & | estimatedScores | |||
) | const [virtual] |
Reimplemented from Moses::StatefulFeatureFunction.
Definition at line 47 of file OpSequenceModel.cpp.
References StringPiece::as_string(), Moses::AlignmentInfo::begin(), Moses::osmHypothesis::calculateOSMProb(), Moses::osmHypothesis::computeOSMFeature(), Moses::osmHypothesis::constructCepts(), Moses::AlignmentInfo::end(), Moses::TargetPhrase::GetAlignTerm(), Moses::Word::GetFactor(), Moses::Phrase::GetSize(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), Moses::Word::IsOOV(), Moses::KenOSMBase::NullContextState(), numFeatures, OSM, Moses::ScoreComponentCollection::PlusEquals(), Moses::osmHypothesis::populateScores(), Moses::osmHypothesis::setPhrases(), Moses::osmHypothesis::setState(), sFactor, and tFactor.
FFState * Moses::OpSequenceModel::EvaluateWhenApplied | ( | const ChartHypothesis & | , | |
int | , | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 199 of file OpSequenceModel.cpp.
References UTIL_THROW2.
FFState * Moses::OpSequenceModel::EvaluateWhenApplied | ( | const Hypothesis & | cur_hypo, | |
const FFState * | prev_state, | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
This interface should be implemented. Notes: When evaluating the value of this feature function, you should avoid calling hypo.GetPrevHypo(). If you need something from the "previous" hypothesis, you should store it in an FFState object which will be passed in as prev_state. If you don't do this, you will get in trouble.
Implements Moses::StatefulFeatureFunction.
Definition at line 92 of file OpSequenceModel.cpp.
References StringPiece::as_string(), Moses::AlignmentInfo::begin(), Moses::osmHypothesis::calculateOSMProb(), Moses::osmHypothesis::computeOSMFeature(), Moses::osmHypothesis::constructCepts(), Moses::AlignmentInfo::end(), Moses::TargetPhrase::GetAlignTerm(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Range::GetEndPos(), Moses::Word::GetFactor(), Moses::Hypothesis::GetManager(), Moses::Phrase::GetSize(), Moses::Manager::GetSource(), Moses::Range::GetStartPos(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), Moses::InputType::GetWord(), Moses::Hypothesis::GetWordsBitmap(), Moses::Word::IsOOV(), numFeatures, OSM, Moses::ScoreComponentCollection::PlusEquals(), Moses::osmHypothesis::populateScores(), Moses::osmHypothesis::saveState(), Moses::osmHypothesis::setPhrases(), Moses::osmHypothesis::setState(), Moses::Bitmap::SetValue(), sFactor, and tFactor.
std::vector< float > Moses::OpSequenceModel::GetFutureScores | ( | const Phrase & | source, | |
const Phrase & | target | |||
) | const |
Definition at line 222 of file OpSequenceModel.cpp.
References m_futureCost, numFeatures, and unkOpProb.
std::string Moses::OpSequenceModel::GetScoreProducerWeightShortName | ( | unsigned | idx = 0 |
) | const [virtual] |
Definition at line 217 of file OpSequenceModel.cpp.
bool Moses::OpSequenceModel::IsUseable | ( | const FactorMask & | mask | ) | const [virtual] |
void Moses::OpSequenceModel::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 39 of file OpSequenceModel.cpp.
References m_lmPath, Moses::FeatureFunction::m_options, and readLanguageModel().
void Moses::OpSequenceModel::readLanguageModel | ( | const char * | lmFile | ) |
Definition at line 28 of file OpSequenceModel.cpp.
References Moses::ConstructOSMLM(), load_method, m_lmPath, Moses::KenOSMBase::NullContextState(), OSM, Moses::KenOSMBase::Score(), and unkOpProb.
Referenced by Load().
void Moses::OpSequenceModel::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 238 of file OpSequenceModel.cpp.
References util::LAZY, load_method, m_lmPath, numFeatures, util::PARALLEL_READ, util::POPULATE_OR_LAZY, util::POPULATE_OR_READ, util::READ, sFactor, tFactor, and UTIL_THROW2.
std::vector< std::pair < std::set <int> , std::set <int> > > Moses::OpSequenceModel::ceptsInPhrase [protected] |
Definition at line 60 of file OpSequenceModel.h.
Definition at line 23 of file OpSequenceModel.h.
Referenced by OpSequenceModel(), readLanguageModel(), and SetParameter().
std::map<ParallelPhrase, Scores> Moses::OpSequenceModel::m_futureCost [protected] |
std::string Moses::OpSequenceModel::m_lmPath [protected] |
Definition at line 62 of file OpSequenceModel.h.
Referenced by Load(), readLanguageModel(), and SetParameter().
Definition at line 22 of file OpSequenceModel.h.
Referenced by EvaluateInIsolation(), EvaluateWhenApplied(), GetFutureScores(), OpSequenceModel(), and SetParameter().
Definition at line 18 of file OpSequenceModel.h.
Referenced by EmptyHypothesisState(), EvaluateInIsolation(), EvaluateWhenApplied(), readLanguageModel(), and ~OpSequenceModel().
Definition at line 20 of file OpSequenceModel.h.
Referenced by EvaluateInIsolation(), EvaluateWhenApplied(), OpSequenceModel(), and SetParameter().
std::set<int> Moses::OpSequenceModel::targetNullWords [protected] |
Definition at line 61 of file OpSequenceModel.h.
Definition at line 21 of file OpSequenceModel.h.
Referenced by EvaluateInIsolation(), EvaluateWhenApplied(), OpSequenceModel(), and SetParameter().
Definition at line 19 of file OpSequenceModel.h.
Referenced by GetFutureScores(), and readLanguageModel().