#include <RDLM.h>
Classes | |
class | UnbinarizedChildren |
Public Member Functions | |
RDLM (const std::string &line) | |
~RDLM () | |
virtual const FFState * | EmptyHypothesisState (const InputType &input) const |
return the state associated with the empty hypothesis for a given sentence | |
void | Score (InternalTree *root, const TreePointerMap &back_pointers, boost::array< float, 4 > &score, size_t &boundary_hash, rdlm::ThreadLocal &thread_objects, int num_virtual=0, int rescoring_levels=0) const |
bool | GetHead (InternalTree *root, const TreePointerMap &back_pointers, std::pair< int, int > &IDs) const |
void | GetChildHeadsAndLabels (InternalTree *root, const TreePointerMap &back_pointers, int reached_end, rdlm::ThreadLocal &thread_objects) const |
void | GetIDs (const Word &head, const Word &preterminal, std::pair< int, int > &IDs) const |
int | Factor2ID (const Factor *const factor, int model_type) const |
void | ScoreFile (std::string &path) |
void | PrintInfo (std::vector< int > &ngram, nplm::neuralTM *lm) const |
TreePointerMap | AssociateLeafNTs (InternalTree *root, const std::vector< TreePointer > &previous) const |
bool | IsUseable (const FactorMask &mask) const |
void | SetParameter (const std::string &key, const std::string &value) |
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 |
void | Load (AllOptions::ptr const &opts) |
override to load model files |
Definition at line 85 of file RDLM.h.
Moses::RDLM::RDLM | ( | const std::string & | line | ) | [inline] |
Definition at line 153 of file RDLM.h.
References Moses::Word::CreateFromString(), Moses::Output, and Moses::FeatureFunction::ReadParameters().
RDLM::TreePointerMap Moses::RDLM::AssociateLeafNTs | ( | InternalTree * | root, | |
const std::vector< TreePointer > & | previous | |||
) | const |
Definition at line 732 of file RDLM.cpp.
Referenced by EvaluateWhenApplied().
virtual const FFState* Moses::RDLM::EmptyHypothesisState | ( | const InputType & | input | ) | const [inline, virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::StatefulFeatureFunction.
FFState * Moses::RDLM::EvaluateWhenApplied | ( | const ChartHypothesis & | cur_hypo, | |
int | featureID, | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 831 of file RDLM.cpp.
References Moses::rdlm::ThreadLocal::ancestor_heads, Moses::rdlm::ThreadLocal::ancestor_labels, AssociateLeafNTs(), Moses::TargetPhrase::GetAlignNonTerm(), Moses::RDLMState::GetApproximateScoreHead(), Moses::RDLMState::GetApproximateScoreLabel(), Moses::ChartHypothesis::GetCurrTargetPhrase(), Moses::ChartHypothesis::GetFFState(), Moses::AlignmentInfo::GetNonTermIndexMap(), Moses::ChartHypothesis::GetPrevHypo(), Moses::TargetPhrase::GetProperty(), Moses::Phrase::GetSize(), Moses::TreeState::GetTree(), Moses::Phrase::GetWord(), Moses::Word::IsNonTerminal(), Moses::FeatureFunction::m_index, Moses::ScoreComponentCollection::PlusEquals(), Score(), and UTIL_THROW2.
FFState* Moses::RDLM::EvaluateWhenApplied | ( | const Hypothesis & | cur_hypo, | |
const FFState * | prev_state, | |||
ScoreComponentCollection * | accumulator | |||
) | const [inline, 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 200 of file RDLM.h.
References UTIL_THROW.
int Moses::RDLM::Factor2ID | ( | const Factor *const | factor, | |
int | model_type | |||
) | const |
Definition at line 662 of file RDLM.cpp.
References StringPiece::as_string(), Moses::Factor::GetId(), Moses::Factor::GetString(), and NULL.
Referenced by GetChildHeadsAndLabels(), GetIDs(), and Score().
void Moses::RDLM::GetChildHeadsAndLabels | ( | InternalTree * | root, | |
const TreePointerMap & | back_pointers, | |||
int | reached_end, | |||
rdlm::ThreadLocal & | thread_objects | |||
) | const |
Definition at line 573 of file RDLM.cpp.
References Moses::RDLM::UnbinarizedChildren::begin(), Moses::RDLM::UnbinarizedChildren::ended(), Factor2ID(), Moses::InternalTree::GetChildren(), GetHead(), Moses::InternalTree::GetLabel(), Moses::InternalTree::GetLength(), Moses::rdlm::ThreadLocal::heads, Moses::rdlm::ThreadLocal::heads_output, Moses::rdlm::ThreadLocal::labels, Moses::rdlm::ThreadLocal::labels_output, and Moses::rdlm::ThreadLocal::stack.
Referenced by Score().
bool Moses::RDLM::GetHead | ( | InternalTree * | root, | |
const TreePointerMap & | back_pointers, | |||
std::pair< int, int > & | IDs | |||
) | const |
Definition at line 543 of file RDLM.cpp.
References Moses::InternalTree::GetChildren(), GetIDs(), Moses::InternalTree::GetLabel(), Moses::InternalTree::GetLength(), and Moses::Word::GetString().
Referenced by GetChildHeadsAndLabels(), and Score().
void Moses::RDLM::GetIDs | ( | const Word & | head, | |
const Word & | preterminal, | |||
std::pair< int, int > & | IDs | |||
) | const |
Definition at line 645 of file RDLM.cpp.
References Factor2ID().
Referenced by GetHead().
bool Moses::RDLM::IsUseable | ( | const FactorMask & | mask | ) | const [inline, virtual] |
void Moses::RDLM::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 42 of file RDLM.cpp.
References Moses::Word::GetString(), Moses::StaticData::GetTreeStructure(), Moses::StaticData::InstanceNonConst(), NULL, ScoreFile(), Moses::StaticData::SetTreeStructure(), and UTIL_THROW_IF2.
void Moses::RDLM::PrintInfo | ( | std::vector< int > & | ngram, | |
nplm::neuralTM * | lm | |||
) | const |
void Moses::RDLM::Score | ( | InternalTree * | root, | |
const TreePointerMap & | back_pointers, | |||
boost::array< float, 4 > & | score, | |||
size_t & | boundary_hash, | |||
rdlm::ThreadLocal & | thread_objects, | |||
int | num_virtual = 0 , |
|||
int | rescoring_levels = 0 | |||
) | const |
Definition at line 236 of file RDLM.cpp.
References Moses::rdlm::ThreadLocal::ancestor_heads, Moses::rdlm::ThreadLocal::ancestor_labels, StringPiece::as_string(), Moses::RDLM::UnbinarizedChildren::begin(), Moses::RDLM::UnbinarizedChildren::ended(), Factor2ID(), Moses::FloorScore(), GetChildHeadsAndLabels(), Moses::InternalTree::GetChildren(), GetHead(), Moses::InternalTree::GetLabel(), Moses::InternalTree::GetLength(), Moses::Word::GetString(), Moses::rdlm::ThreadLocal::heads, Moses::rdlm::ThreadLocal::heads_output, Moses::InternalTree::IsLeafNT(), Moses::InternalTree::IsTerminal(), Moses::rdlm::ThreadLocal::labels, Moses::rdlm::ThreadLocal::labels_output, Moses::rdlm::ThreadLocal::lm_head, Moses::rdlm::ThreadLocal::lm_label, Moses::rdlm::ThreadLocal::ngram, and Moses::rdlm::ThreadLocal::stack.
Referenced by EvaluateWhenApplied(), and ScoreFile().
void Moses::RDLM::ScoreFile | ( | std::string & | path | ) |
Definition at line 750 of file RDLM.cpp.
References Moses::rdlm::ThreadLocal::ancestor_heads, Moses::rdlm::ThreadLocal::ancestor_labels, and Score().
Referenced by Load().
void Moses::RDLM::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 782 of file RDLM.cpp.
References Moses::FeatureFunction::GetScoreProducerDescription(), Moses::FeatureFunction::m_tuneable, Moses::Scan< bool >(), and UTIL_THROW.