Moses::SoftSourceSyntacticConstraintsFeature Class Reference

#include <SoftSourceSyntacticConstraintsFeature.h>

Inheritance diagram for Moses::SoftSourceSyntacticConstraintsFeature:

Inheritance graph
[legend]
Collaboration diagram for Moses::SoftSourceSyntacticConstraintsFeature:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 SoftSourceSyntacticConstraintsFeature (const std::string &line)
 ~SoftSourceSyntacticConstraintsFeature ()
bool IsUseable (const FactorMask &mask) const
void SetParameter (const std::string &key, const std::string &value)
void Load (AllOptions::ptr const &opts)
 override to load model files
void EvaluateInIsolation (const Phrase &source, const TargetPhrase &targetPhrase, ScoreComponentCollection &scoreBreakdown, ScoreComponentCollection &estimatedScores) const
void EvaluateWithSourceContext (const InputType &input, const InputPath &inputPath, const TargetPhrase &targetPhrase, const StackVec *stackVec, ScoreComponentCollection &scoreBreakdown, ScoreComponentCollection *estimatedScores=NULL) const
void EvaluateTranslationOptionListWithSourceContext (const InputType &input, const TranslationOptionList &translationOptionList) const
void EvaluateWhenApplied (const Hypothesis &cur_hypo, ScoreComponentCollection *accumulator) const
void EvaluateWhenApplied (const ChartHypothesis &cur_hypo, ScoreComponentCollection *accumulator) const

Protected Member Functions

void LoadSourceLabelSet ()
void LoadCoreSourceLabelSet ()
void LoadTargetSourceLeftHandSideJointCountFile ()
void LoadLabelSet (std::string &filename, boost::unordered_set< size_t > &labelSet)
std::pair< float, float > GetLabelPairProbabilities (const Factor *target, const size_t source) const

Protected Attributes

std::string m_sourceLabelSetFile
std::string m_coreSourceLabelSetFile
std::string m_targetSourceLHSJointCountFile
std::string m_unknownLeftHandSideFile
bool m_useCoreSourceLabels
bool m_useLogprobs
bool m_useSparse
bool m_useSparseLabelPairs
bool m_noMismatches
float m_floor
boost::unordered_map
< std::string, size_t > 
m_sourceLabels
std::vector< std::string > m_sourceLabelsByIndex
std::vector< std::string > m_sourceLabelsByIndex_RHS_1
std::vector< std::string > m_sourceLabelsByIndex_RHS_0
std::vector< std::string > m_sourceLabelsByIndex_LHS_1
std::vector< std::string > m_sourceLabelsByIndex_LHS_0
boost::unordered_set< size_t > m_coreSourceLabels
boost::unordered_map< const
Factor *, size_t > 
m_sourceLabelIndexesByFactor
size_t m_GlueTopLabel
boost::unordered_map< const
Factor *, std::vector
< std::pair< float, float > > * > 
m_labelPairProbabilities
boost::unordered_map< size_t,
float > 
m_unknownLHSProbabilities
float m_smoothingWeight
float m_unseenLHSSmoothingFactorForUnknowns


Detailed Description

Definition at line 14 of file SoftSourceSyntacticConstraintsFeature.h.


Constructor & Destructor Documentation

Moses::SoftSourceSyntacticConstraintsFeature::SoftSourceSyntacticConstraintsFeature ( const std::string &  line  ) 

Moses::SoftSourceSyntacticConstraintsFeature::~SoftSourceSyntacticConstraintsFeature (  )  [inline]

Definition at line 21 of file SoftSourceSyntacticConstraintsFeature.h.

References m_labelPairProbabilities.


Member Function Documentation

void Moses::SoftSourceSyntacticConstraintsFeature::EvaluateInIsolation ( const Phrase source,
const TargetPhrase targetPhrase,
ScoreComponentCollection scoreBreakdown,
ScoreComponentCollection estimatedScores 
) const [inline, virtual]

Implements Moses::FeatureFunction.

Definition at line 36 of file SoftSourceSyntacticConstraintsFeature.h.

References Moses::TargetPhrase::SetRuleSource().

Here is the call graph for this function:

void Moses::SoftSourceSyntacticConstraintsFeature::EvaluateTranslationOptionListWithSourceContext ( const InputType input,
const TranslationOptionList translationOptionList 
) const [inline, virtual]

Implements Moses::FeatureFunction.

Definition at line 50 of file SoftSourceSyntacticConstraintsFeature.h.

void Moses::SoftSourceSyntacticConstraintsFeature::EvaluateWhenApplied ( const ChartHypothesis hypo,
ScoreComponentCollection accumulator 
) const [inline, virtual]

Same for chart-based features.

Implements Moses::StatelessFeatureFunction.

Definition at line 59 of file SoftSourceSyntacticConstraintsFeature.h.

void Moses::SoftSourceSyntacticConstraintsFeature::EvaluateWhenApplied ( const Hypothesis hypo,
ScoreComponentCollection accumulator 
) const [inline, virtual]

This should be implemented for features that apply to phrase-based models.

Implements Moses::StatelessFeatureFunction.

Definition at line 54 of file SoftSourceSyntacticConstraintsFeature.h.

void Moses::SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext ( const InputType input,
const InputPath inputPath,
const TargetPhrase targetPhrase,
const StackVec stackVec,
ScoreComponentCollection scoreBreakdown,
ScoreComponentCollection estimatedScores = NULL 
) const [virtual]

Implements Moses::FeatureFunction.

Definition at line 287 of file SoftSourceSyntacticConstraintsFeature.cpp.

References StringPiece::as_string(), begin, Moses::AlignmentInfo::begin(), Moses::AlignmentInfo::end(), FEATUREVERBOSE, Moses::TargetPhrase::GetAlignNonTerm(), Moses::ChartCellLabel::GetCoverage(), Moses::Range::GetEndPos(), GetLabelPairProbabilities(), Moses::TreeInput::GetLabelSet(), Moses::SourceLabelsPhraseProperty::GetNumberOfNonTerminals(), Moses::TargetPhrase::GetProperty(), Moses::TargetPhrase::GetRuleSource(), Moses::FeatureFunction::GetScoreProducerDescription(), Moses::Phrase::GetSize(), Moses::SourceLabelsPhraseProperty::GetSourceLabelItems(), Moses::Range::GetStartPos(), Moses::Factor::GetString(), Moses::TargetPhrase::GetTargetLHS(), Moses::SourceLabelsPhraseProperty::GetTotalCount(), Moses::Phrase::GetWord(), Moses::InputPath::GetWordsRange(), IFFEATUREVERBOSE, Moses::Word::IsNonTerminal(), Moses::Word::IsOOV(), m_coreSourceLabels, m_floor, m_GlueTopLabel, m_noMismatches, Moses::FeatureFunction::m_numScoreComponents, Moses::FeatureFunction::m_options, m_sourceLabelIndexesByFactor, m_sourceLabels, m_sourceLabelsByIndex, m_sourceLabelsByIndex_LHS_0, m_sourceLabelsByIndex_LHS_1, m_sourceLabelsByIndex_RHS_0, m_sourceLabelsByIndex_RHS_1, m_targetSourceLHSJointCountFile, m_useCoreSourceLabels, m_useLogprobs, m_useSparse, m_useSparseLabelPairs, Moses::ScoreComponentCollection::PlusEquals(), range, totalCount, Moses::TransformScore(), and UTIL_THROW_IF2.

Here is the call graph for this function:

std::pair< float, float > Moses::SoftSourceSyntacticConstraintsFeature::GetLabelPairProbabilities ( const Factor target,
const size_t  source 
) const [protected]

Definition at line 633 of file SoftSourceSyntacticConstraintsFeature.cpp.

References m_floor, and m_labelPairProbabilities.

Referenced by EvaluateWithSourceContext().

Here is the caller graph for this function:

bool Moses::SoftSourceSyntacticConstraintsFeature::IsUseable ( const FactorMask mask  )  const [inline, virtual]

Implements Moses::FeatureFunction.

Definition at line 28 of file SoftSourceSyntacticConstraintsFeature.h.

void Moses::SoftSourceSyntacticConstraintsFeature::Load ( AllOptions::ptr const &  opts  )  [virtual]

void Moses::SoftSourceSyntacticConstraintsFeature::LoadCoreSourceLabelSet (  )  [protected]

Definition at line 174 of file SoftSourceSyntacticConstraintsFeature.cpp.

References FEATUREVERBOSE, FEATUREVERBOSE2, LoadLabelSet(), m_coreSourceLabels, and m_coreSourceLabelSetFile.

Referenced by Load().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::SoftSourceSyntacticConstraintsFeature::LoadLabelSet ( std::string &  filename,
boost::unordered_set< size_t > &  labelSet 
) [protected]

Definition at line 182 of file SoftSourceSyntacticConstraintsFeature.cpp.

References Moses::InputFileStream::Close(), FEATUREVERBOSE, and m_sourceLabels.

Referenced by LoadCoreSourceLabelSet().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::SoftSourceSyntacticConstraintsFeature::LoadSourceLabelSet (  )  [protected]

void Moses::SoftSourceSyntacticConstraintsFeature::LoadTargetSourceLeftHandSideJointCountFile (  )  [protected]

void Moses::SoftSourceSyntacticConstraintsFeature::SetParameter ( const std::string &  key,
const std::string &  value 
) [virtual]


Member Data Documentation

boost::unordered_set<size_t> Moses::SoftSourceSyntacticConstraintsFeature::m_coreSourceLabels [protected]

boost::unordered_map<const Factor*, std::vector< std::pair<float,float> >* > Moses::SoftSourceSyntacticConstraintsFeature::m_labelPairProbabilities [protected]

Definition at line 92 of file SoftSourceSyntacticConstraintsFeature.h.

boost::unordered_map<std::string,size_t> Moses::SoftSourceSyntacticConstraintsFeature::m_sourceLabels [protected]

Definition at line 62 of file SoftSourceSyntacticConstraintsFeature.h.

Referenced by LoadSourceLabelSet(), and SetParameter().

Definition at line 70 of file SoftSourceSyntacticConstraintsFeature.h.

boost::unordered_map<size_t,float> Moses::SoftSourceSyntacticConstraintsFeature::m_unknownLHSProbabilities [protected]

Definition at line 91 of file SoftSourceSyntacticConstraintsFeature.h.

Definition at line 93 of file SoftSourceSyntacticConstraintsFeature.h.


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:33:10 2017 for Moses by  doxygen 1.5.9