#include <DsgModel.h>
Public Member Functions | |
DesegModel (const std::string &line) | |
~DesegModel () | |
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 |
void | SetParameter (const std::string &key, const std::string &value) |
bool | IsUseable (const FactorMask &mask) const |
Public Attributes | |
DsgLM * | DSGM |
Desegmenter * | desegT |
int | tFactor |
int | order |
int | numFeatures |
bool | optimistic |
Protected Types | |
typedef std::vector< float > | Scores |
Protected Attributes | |
std::string | m_lmPath |
std::string | m_desegPath |
bool | m_simple |
Definition at line 16 of file DsgModel.h.
typedef std::vector<float> Moses::DesegModel::Scores [protected] |
Definition at line 57 of file DsgModel.h.
Moses::DesegModel::DesegModel | ( | const std::string & | line | ) |
Definition at line 13 of file DsgModel.cpp.
References numFeatures, optimistic, order, Moses::FeatureFunction::ReadParameters(), and tFactor.
Moses::DesegModel::~DesegModel | ( | ) |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
Definition at line 105 of file DsgModel.cpp.
References Moses::KenDsgBase::BeginSentenceState(), DSGM, and VERBOSE.
void Moses::DesegModel::EvaluateInIsolation | ( | const Phrase & | source, | |
const TargetPhrase & | targetPhrase, | |||
ScoreComponentCollection & | scoreBreakdown, | |||
ScoreComponentCollection & | estimatedScores | |||
) | const [virtual] |
Reimplemented from Moses::StatefulFeatureFunction.
Definition at line 44 of file DsgModel.cpp.
References StringPiece::as_string(), Moses::dsgHypothesis::calculateDsgProbinIsol(), desegT, DSGM, Moses::TargetPhrase::GetAlignTerm(), Moses::Word::GetFactor(), Moses::Phrase::GetSize(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), Moses::KenDsgBase::NullContextState(), numFeatures, Moses::ScoreComponentCollection::PlusEquals(), Moses::dsgHypothesis::populateScores(), Moses::dsgHypothesis::setPhrases(), Moses::dsgHypothesis::setState(), and tFactor.
FFState * Moses::DesegModel::EvaluateWhenApplied | ( | const ChartHypothesis & | , | |
int | , | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 97 of file DsgModel.cpp.
References UTIL_THROW2.
FFState * Moses::DesegModel::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 68 of file DsgModel.cpp.
References StringPiece::as_string(), Moses::dsgHypothesis::calculateDsgProb(), desegT, DSGM, Moses::TargetPhrase::GetAlignTerm(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetLength(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Word::GetFactor(), Moses::Range::GetStartPos(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), Moses::Hypothesis::IsSourceCompleted(), numFeatures, optimistic, Moses::ScoreComponentCollection::PlusEquals(), Moses::dsgHypothesis::populateScores(), Moses::dsgHypothesis::saveState(), Moses::dsgHypothesis::setPhrases(), Moses::dsgHypothesis::setState(), and tFactor.
std::string Moses::DesegModel::GetScoreProducerWeightShortName | ( | unsigned | idx = 0 |
) | const [virtual] |
Definition at line 113 of file DsgModel.cpp.
bool Moses::DesegModel::IsUseable | ( | const FactorMask & | mask | ) | const [virtual] |
void Moses::DesegModel::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 36 of file DsgModel.cpp.
References m_lmPath, Moses::FeatureFunction::m_options, and readLanguageModel().
void Moses::DesegModel::readLanguageModel | ( | const char * | lmFile | ) |
Definition at line 28 of file DsgModel.cpp.
References Moses::ConstructDsgLM(), desegT, DSGM, m_desegPath, m_lmPath, m_simple, and Moses::KenDsgBase::NullContextState().
Referenced by Load().
void Moses::DesegModel::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 119 of file DsgModel.cpp.
References m_desegPath, m_lmPath, m_simple, numFeatures, optimistic, order, and tFactor.
Definition at line 21 of file DsgModel.h.
Referenced by EvaluateInIsolation(), EvaluateWhenApplied(), and readLanguageModel().
Definition at line 20 of file DsgModel.h.
Referenced by EmptyHypothesisState(), EvaluateInIsolation(), EvaluateWhenApplied(), readLanguageModel(), and ~DesegModel().
std::string Moses::DesegModel::m_desegPath [protected] |
std::string Moses::DesegModel::m_lmPath [protected] |
Definition at line 58 of file DsgModel.h.
Referenced by Load(), readLanguageModel(), and SetParameter().
bool Moses::DesegModel::m_simple [protected] |
Definition at line 24 of file DsgModel.h.
Referenced by DesegModel(), EvaluateInIsolation(), EvaluateWhenApplied(), and SetParameter().
Definition at line 25 of file DsgModel.h.
Referenced by DesegModel(), EvaluateWhenApplied(), and SetParameter().
Definition at line 22 of file DsgModel.h.
Referenced by DesegModel(), EvaluateInIsolation(), EvaluateWhenApplied(), and SetParameter().