#include <TargetNgramFeature.h>
Public Member Functions | |
TargetNgramFeature (const std::string &line) | |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
bool | IsUseable (const FactorMask &mask) const |
virtual const FFState * | EmptyHypothesisState (const InputType &input) const |
return the state associated with the empty hypothesis for a given sentence | |
virtual 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 &cur_hypo, int featureId, ScoreComponentCollection *accumulator) const |
void | SetParameter (const std::string &key, const std::string &value) |
Definition at line 201 of file TargetNgramFeature.h.
Moses::TargetNgramFeature::TargetNgramFeature | ( | const std::string & | line | ) |
Definition at line 47 of file TargetNgramFeature.cpp.
References Moses::FactorCollection::AddFactor(), BOS_, Moses::FeatureFunction::GetScoreProducerDescription(), Moses::FactorCollection::Instance(), Moses::Output, Moses::FeatureFunction::ReadParameters(), and Moses::Word::SetFactor().
const FFState * Moses::TargetNgramFeature::EmptyHypothesisState | ( | const InputType & | input | ) | const [virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
Definition at line 100 of file TargetNgramFeature.cpp.
FFState * Moses::TargetNgramFeature::EvaluateWhenApplied | ( | const ChartHypothesis & | cur_hypo, | |
int | featureId, | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 218 of file TargetNgramFeature.cpp.
References StringPiece::compare(), Moses::TargetPhrase::GetAlignNonTerm(), Moses::ChartHypothesis::GetCurrTargetPhrase(), Moses::ChartHypothesis::GetFFState(), Moses::AlignmentInfo::GetNonTermIndexMap(), Moses::TargetNgramChartState::GetNumTargetTerminals(), Moses::TargetNgramChartState::GetPrefix(), Moses::ChartHypothesis::GetPrevHypo(), Moses::Phrase::GetSize(), Moses::Word::GetString(), Moses::TargetNgramChartState::GetSuffix(), Moses::Phrase::GetWord(), Moses::Word::IsNonTerminal(), Moses::ScoreComponentCollection::SparseMinusEquals(), Moses::ScoreComponentCollection::SparsePlusEquals(), and util::StringStream::str().
FFState * Moses::TargetNgramFeature::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 106 of file TargetNgramFeature.cpp.
References EOS_, FindStringPiece(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetSize(), Moses::Phrase::GetSize(), Moses::Word::GetString(), Moses::Hypothesis::GetWord(), Moses::Phrase::GetWord(), Moses::TargetNgramState::GetWords(), Moses::Hypothesis::GetWordsBitmap(), Moses::Bitmap::IsComplete(), n, Moses::ScoreComponentCollection::PlusEquals(), skip, and util::StringStream::str().
bool Moses::TargetNgramFeature::IsUseable | ( | const FactorMask & | mask | ) | const [virtual] |
void Moses::TargetNgramFeature::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 77 of file TargetNgramFeature.cpp.
References BOS_, EOS_, Moses::FeatureFunction::m_options, and UTIL_THROW.
void Moses::TargetNgramFeature::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 62 of file TargetNgramFeature.cpp.
References Moses::Scan< bool >().