#include <ConstrainedDecoding.h>
Public Member Functions | |
ConstrainedDecoding (const std::string &line) | |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
bool | IsUseable (const FactorMask &mask) const |
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. | |
FFState * | EvaluateWhenApplied (const ChartHypothesis &, int, ScoreComponentCollection *accumulator) const |
virtual const FFState * | EmptyHypothesisState (const InputType &input) const |
return the state associated with the empty hypothesis for a given sentence | |
std::vector< float > | DefaultWeights () const |
void | SetParameter (const std::string &key, const std::string &value) |
Protected Attributes | |
std::vector< std::string > | m_paths |
std::map< long, std::vector < Phrase > > | m_constraints |
int | m_maxUnknowns |
bool | m_negate |
bool | m_soft |
Definition at line 34 of file ConstrainedDecoding.h.
Moses::ConstrainedDecoding::ConstrainedDecoding | ( | const std::string & | line | ) |
Definition at line 39 of file ConstrainedDecoding.cpp.
References Moses::FeatureFunction::m_tuneable, and Moses::FeatureFunction::ReadParameters().
std::vector< float > Moses::ConstrainedDecoding::DefaultWeights | ( | ) | const [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 82 of file ConstrainedDecoding.cpp.
References Moses::FeatureFunction::m_numScoreComponents, and UTIL_THROW_IF2.
virtual const FFState* Moses::ConstrainedDecoding::EmptyHypothesisState | ( | const InputType & | input | ) | const [inline, virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
Definition at line 55 of file ConstrainedDecoding.h.
FFState * Moses::ConstrainedDecoding::EvaluateWhenApplied | ( | const ChartHypothesis & | hypo, | |
int | , | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 150 of file ConstrainedDecoding.cpp.
References Moses::ChartHypothesis::GetCurrSourceRange(), Moses::Range::GetEndPos(), Moses::ChartHypothesis::GetManager(), Moses::ConstrainedDecodingState::GetPhrase(), Moses::Phrase::GetSize(), Moses::Sentence::GetSize(), Moses::BaseManager::GetSource(), Moses::Range::GetStartPos(), m_constraints, m_maxUnknowns, m_negate, m_soft, NOT_FOUND, and Moses::ScoreComponentCollection::PlusEquals().
FFState * Moses::ConstrainedDecoding::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 109 of file ConstrainedDecoding.cpp.
References Moses::ConstrainedDecodingState::GetPhrase(), Moses::Phrase::GetSize(), Moses::Hypothesis::IsSourceCompleted(), m_constraints, m_maxUnknowns, m_negate, m_soft, NOT_FOUND, and Moses::ScoreComponentCollection::PlusEquals().
bool Moses::ConstrainedDecoding::IsUseable | ( | const FactorMask & | mask | ) | const [inline, virtual] |
void Moses::ConstrainedDecoding::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 49 of file ConstrainedDecoding.cpp.
References Moses::ChartIncremental, Moses::Phrase::CreateFromString(), Moses::CYKPlus, Moses::Phrase::InitStartEndWord(), Moses::StaticData::Instance(), m_constraints, Moses::FeatureFunction::m_options, m_paths, NULL, Moses::Output, Moses::Tokenize(), and UTIL_THROW.
void Moses::ConstrainedDecoding::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 196 of file ConstrainedDecoding.cpp.
References m_maxUnknowns, m_negate, m_paths, m_soft, Moses::Scan< bool >(), and Moses::Tokenize().
std::map<long, std::vector<Phrase> > Moses::ConstrainedDecoding::m_constraints [protected] |
Definition at line 65 of file ConstrainedDecoding.h.
Referenced by EvaluateWhenApplied(), and Load().
int Moses::ConstrainedDecoding::m_maxUnknowns [protected] |
Definition at line 66 of file ConstrainedDecoding.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
bool Moses::ConstrainedDecoding::m_negate [protected] |
Definition at line 67 of file ConstrainedDecoding.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
std::vector<std::string> Moses::ConstrainedDecoding::m_paths [protected] |
bool Moses::ConstrainedDecoding::m_soft [protected] |
Definition at line 68 of file ConstrainedDecoding.h.
Referenced by EvaluateWhenApplied(), and SetParameter().