Moses::LanguageModelKen< Model > Class Template Reference

#include <Ken.h>

Inheritance diagram for Moses::LanguageModelKen< Model >:

Inheritance graph
[legend]
Collaboration diagram for Moses::LanguageModelKen< Model >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 LanguageModelKen (const std::string &line, const std::string &file, FactorType factorType, util::LoadMethod load_method)
virtual const FFState * EmptyHypothesisState (const InputType &) const
 return the state associated with the empty hypothesis for a given sentence
virtual void CalcScore (const Phrase &phrase, float &fullScore, float &ngramScore, size_t &oovCount) const
virtual FFState * EvaluateWhenApplied (const Hypothesis &hypo, const FFState *ps, ScoreComponentCollection *out) 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
virtual FFState * EvaluateWhenApplied (const Syntax::SHyperedge &hyperedge, int featureID, ScoreComponentCollection *accumulator) const
virtual void IncrementalCallback (Incremental::Manager &manager) const
virtual void ReportHistoryOrder (std::ostream &out, const Phrase &phrase) const
virtual bool IsUseable (const FactorMask &mask) const

Protected Member Functions

void LoadModel (const std::string &file, util::LoadMethod load_method)
lm::WordIndex TranslateID (const Word &word) const

Protected Attributes

boost::shared_ptr< Model > m_ngram
const Factor * m_beginSentenceFactor
FactorType m_factorType
std::vector< lm::WordIndex > m_lmIdLookup

Friends

class InMemoryPerSentenceOnDemandLM


Detailed Description

template<class Model>
class Moses::LanguageModelKen< Model >

Definition at line 53 of file Ken.h.


Constructor & Destructor Documentation

template<class Model >
Moses::LanguageModelKen< Model >::LanguageModelKen ( const std::string &  line,
const std::string &  file,
FactorType  factorType,
util::LoadMethod  load_method 
) [inline]

Definition at line 111 of file Ken.cpp.

References Moses::LanguageModelKen< Model >::LoadModel(), and Moses::FeatureFunction::ReadParameters().

Here is the call graph for this function:


Member Function Documentation

template<class Model >
void Moses::LanguageModelKen< Model >::CalcScore ( const Phrase &  phrase,
float &  fullScore,
float &  ngramScore,
size_t &  oovCount 
) const [inline, virtual]

template<class Model >
const FFState * Moses::LanguageModelKen< Model >::EmptyHypothesisState ( const InputType &  input  )  const [inline, virtual]

return the state associated with the empty hypothesis for a given sentence

Implements Moses::LanguageModel.

Reimplemented in Moses::BackwardLanguageModel< Model >, and Moses::BackwardLanguageModel< lm::ngram::ProbingModel >.

Definition at line 139 of file Ken.cpp.

Referenced by Moses::InMemoryPerSentenceOnDemandLM::EmptyHypothesisState().

Here is the caller graph for this function:

template<class Model >
FFState * Moses::LanguageModelKen< Model >::EvaluateWhenApplied ( const Syntax::SHyperedge &  hyperedge,
int  featureID,
ScoreComponentCollection *  accumulator 
) const [inline, virtual]

template<class Model >
FFState * Moses::LanguageModelKen< Model >::EvaluateWhenApplied ( const ChartHypothesis &  cur_hypo,
int  featureID,
ScoreComponentCollection *  accumulator 
) const [inline, virtual]

template<class Model >
FFState * Moses::LanguageModelKen< Model >::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 197 of file Ken.cpp.

References begin, end, Moses::Hypothesis::GetCurrTargetLength(), Moses::Hypothesis::GetCurrTargetWordsRange(), Moses::Range::GetEndPos(), Moses::Range::GetStartPos(), Moses::Hypothesis::GetWord(), Moses::Hypothesis::IsSourceCompleted(), Moses::ScoreComponentCollection::PlusEquals(), prob(), swap(), and Moses::TransformLMScore().

Referenced by Moses::InMemoryPerSentenceOnDemandLM::EvaluateWhenApplied().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Model >
void Moses::LanguageModelKen< Model >::IncrementalCallback ( Incremental::Manager &  manager  )  const [inline, virtual]

Reimplemented from Moses::LanguageModel.

Definition at line 383 of file Ken.cpp.

References Moses::Incremental::Manager::LMCallback(), Moses::LanguageModelKen< Model >::m_lmIdLookup, and Moses::LanguageModelKen< Model >::m_ngram.

Referenced by Moses::InMemoryPerSentenceOnDemandLM::IncrementalCallback().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Model >
bool Moses::LanguageModelKen< Model >::IsUseable ( const FactorMask &  mask  )  const [inline, virtual]

Implements Moses::FeatureFunction.

Definition at line 410 of file Ken.cpp.

References Moses::LanguageModelKen< Model >::m_factorType.

template<class Model >
void Moses::LanguageModelKen< Model >::LoadModel ( const std::string &  file,
util::LoadMethod  load_method 
) [inline, protected]

template<class Model >
void Moses::LanguageModelKen< Model >::ReportHistoryOrder ( std::ostream &  out,
const Phrase &  phrase 
) const [inline, virtual]

Reimplemented from Moses::LanguageModel.

Definition at line 388 of file Ken.cpp.

References Moses::Phrase::GetSize(), Moses::Phrase::GetWord(), swap(), and Moses::TransformLMScore().

Referenced by Moses::InMemoryPerSentenceOnDemandLM::ReportHistoryOrder().

Here is the call graph for this function:

Here is the caller graph for this function:

template<class Model>
lm::WordIndex Moses::LanguageModelKen< Model >::TranslateID ( const Word &  word  )  const [inline, protected]

Definition at line 84 of file Ken.h.

Referenced by Moses::LanguageModelKen< Model >::CalcScore(), and Moses::LanguageModelKen< Model >::EvaluateWhenApplied().

Here is the caller graph for this function:


Friends And Related Function Documentation

template<class Model>
friend class InMemoryPerSentenceOnDemandLM [friend]

Definition at line 73 of file Ken.h.


Member Data Documentation

template<class Model>
const Factor* Moses::LanguageModelKen< Model >::m_beginSentenceFactor [protected]

template<class Model>
FactorType Moses::LanguageModelKen< Model >::m_factorType [protected]

template<class Model>
std::vector<lm::WordIndex> Moses::LanguageModelKen< Model >::m_lmIdLookup [protected]

template<class Model>
boost::shared_ptr<Model> Moses::LanguageModelKen< Model >::m_ngram [protected]


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

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