#include <DistortionScoreProducer.h>
Public Member Functions | |
DistortionScoreProducer (const std::string &line) | |
void | SetParameter (const std::string &key, const std::string &value) |
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 &, int, ScoreComponentCollection *) const |
Static Public Member Functions | |
static const std::vector < const DistortionScoreProducer * > & | GetDistortionFeatureFunctions () |
static float | CalculateDistortionScore (const Hypothesis &hypo, const Range &prev, const Range &curr, const int FirstGapPosition) |
Protected Attributes | |
FactorType | m_sparseFactorTypeSource |
FactorType | m_sparseFactorTypeTarget |
bool | m_useSparse |
bool | m_sparseDistance |
bool | m_sparseSubordinate |
FactorType | m_sparseFactorTypeTargetSubordinate |
const Factor * | m_subordinateConjunctionTagFactor |
Static Protected Attributes | |
static std::vector< const DistortionScoreProducer * > | s_staticColl |
Definition at line 12 of file DistortionScoreProducer.h.
Moses::DistortionScoreProducer::DistortionScoreProducer | ( | const std::string & | line | ) |
Definition at line 35 of file DistortionScoreProducer.cpp.
References Moses::FeatureFunction::ReadParameters(), and s_staticColl.
float Moses::DistortionScoreProducer::CalculateDistortionScore | ( | const Hypothesis & | hypo, | |
const Range & | prev, | |||
const Range & | curr, | |||
const int | FirstGapPosition | |||
) | [static] |
Definition at line 84 of file DistortionScoreProducer.cpp.
References Moses::InputType::ComputeDistortionDistance(), Moses::Range::GetEndPos(), Moses::Hypothesis::GetInput(), Moses::Hypothesis::GetManager(), Moses::Range::GetNumWordsBetween(), Moses::Range::GetNumWordsCovered(), Moses::Range::GetStartPos(), IFVERBOSE, and Moses::BaseManager::options().
Referenced by EvaluateWhenApplied(), and Moses::HypothesisScoreOrdererWithDistortion::operator()().
const FFState * Moses::DistortionScoreProducer::EmptyHypothesisState | ( | const InputType & | input | ) | const [virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
Definition at line 67 of file DistortionScoreProducer.cpp.
References end, Moses::InputType::m_frontSpanCoveredLength, and NOT_FOUND.
virtual FFState* Moses::DistortionScoreProducer::EvaluateWhenApplied | ( | const ChartHypothesis & | , | |
int | , | |||
ScoreComponentCollection * | ||||
) | const [inline, virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 48 of file DistortionScoreProducer.h.
References UTIL_THROW.
FFState * Moses::DistortionScoreProducer::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 129 of file DistortionScoreProducer.cpp.
References CalculateDistortionScore(), Moses::DistortionState::first_gap, Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Range::GetEndPos(), Moses::Word::GetFactor(), Moses::Bitmap::GetFirstGapPos(), Moses::Hypothesis::GetInput(), Moses::Phrase::GetSize(), Moses::Sentence::GetSize(), Moses::Range::GetStartPos(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), Moses::Sentence::GetWord(), Moses::Hypothesis::GetWordsBitmap(), Moses::DistortionState::inSubordinateConjunction, Moses::FeatureFunction::m_description, m_sparseDistance, m_sparseFactorTypeSource, m_sparseFactorTypeTarget, m_sparseFactorTypeTargetSubordinate, m_sparseSubordinate, m_subordinateConjunctionTagFactor, m_useSparse, Moses::ScoreComponentCollection::PlusEquals(), Moses::DistortionState::range, Moses::ScoreComponentCollection::SparsePlusEquals(), state, and util::StringStream::str().
static const std::vector<const DistortionScoreProducer*>& Moses::DistortionScoreProducer::GetDistortionFeatureFunctions | ( | ) | [inline, static] |
Definition at line 26 of file DistortionScoreProducer.h.
References s_staticColl.
Referenced by Moses::HypothesisScoreOrdererWithDistortion::HypothesisScoreOrdererWithDistortion().
bool Moses::DistortionScoreProducer::IsUseable | ( | const FactorMask & | mask | ) | const [inline, virtual] |
void Moses::DistortionScoreProducer::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 45 of file DistortionScoreProducer.cpp.
References Moses::FactorCollection::Instance(), m_sparseDistance, m_sparseFactorTypeSource, m_sparseFactorTypeTarget, m_sparseFactorTypeTargetSubordinate, m_sparseSubordinate, m_subordinateConjunctionTagFactor, m_useSparse, and Moses::Scan< bool >().
bool Moses::DistortionScoreProducer::m_sparseDistance [protected] |
Definition at line 20 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
Definition at line 17 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
Definition at line 18 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
Definition at line 22 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
bool Moses::DistortionScoreProducer::m_sparseSubordinate [protected] |
Definition at line 21 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
const Factor* Moses::DistortionScoreProducer::m_subordinateConjunctionTagFactor [protected] |
Definition at line 23 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
bool Moses::DistortionScoreProducer::m_useSparse [protected] |
Definition at line 19 of file DistortionScoreProducer.h.
Referenced by EvaluateWhenApplied(), and SetParameter().
std::vector< const DistortionScoreProducer * > Moses::DistortionScoreProducer::s_staticColl [static, protected] |
< all the score producers in this run
Reimplemented from Moses::FeatureFunction.
Definition at line 15 of file DistortionScoreProducer.h.
Referenced by DistortionScoreProducer(), and GetDistortionFeatureFunctions().