Moses::LanguageModelDALM Class Reference

#include <DALMWrapper.h>

Inheritance diagram for Moses::LanguageModelDALM:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 LanguageModelDALM (const std::string &line)
virtual ~LanguageModelDALM ()
void Load (AllOptions::ptr const &opts)
 override to load model files
virtual const FFStateEmptyHypothesisState (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 FFStateEvaluateWhenApplied (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 FFStateEvaluateWhenApplied (const ChartHypothesis &hypo, int featureID, ScoreComponentCollection *out) const
virtual bool IsUseable (const FactorMask &mask) const
virtual void SetParameter (const std::string &key, const std::string &value)

Protected Member Functions

void CreateVocabMapping (const std::string &wordstxt)
DALM::VocabId GetVocabId (const Factor *factor) const

Protected Attributes

const Factorm_beginSentenceFactor
FactorType m_factorType
std::string m_filePath
size_t m_nGramOrder
size_t m_ContextSize
 max n-gram length contained in this LM
DALM::Logger * m_logger
DALM::Vocabulary * m_vocab
DALM::LMm_lm
DALM::VocabId wid_start
DALM::VocabId wid_end
std::vector< DALM::VocabIdm_vocabMap


Detailed Description

Definition at line 25 of file DALMWrapper.h.


Constructor & Destructor Documentation

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

Definition at line 190 of file DALMWrapper.cpp.

References m_factorType, NOT_FOUND, and Moses::FeatureFunction::ReadParameters().

Here is the call graph for this function:

Moses::LanguageModelDALM::~LanguageModelDALM (  )  [virtual]

Definition at line 200 of file DALMWrapper.cpp.

References m_lm, m_logger, and m_vocab.


Member Function Documentation

void Moses::LanguageModelDALM::CalcScore ( const Phrase phrase,
float &  fullScore,
float &  ngramScore,
size_t &  oovCount 
) const [virtual]

void Moses::LanguageModelDALM::CreateVocabMapping ( const std::string &  wordstxt  )  [protected]

Definition at line 490 of file DALMWrapper.cpp.

References Moses::FactorCollection::AddFactor(), Moses::Factor::GetId(), Moses::FactorCollection::Instance(), m_vocab, and m_vocabMap.

Referenced by Load().

Here is the call graph for this function:

Here is the caller graph for this function:

const FFState * Moses::LanguageModelDALM::EmptyHypothesisState ( const InputType input  )  const [virtual]

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

Implements Moses::LanguageModel.

Definition at line 251 of file DALMWrapper.cpp.

References Moses::DALMState::get_state(), and m_lm.

Here is the call graph for this function:

FFState * Moses::LanguageModelDALM::EvaluateWhenApplied ( const ChartHypothesis hypo,
int  featureID,
ScoreComponentCollection out 
) const [virtual]

FFState * Moses::LanguageModelDALM::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 339 of file DALMWrapper.cpp.

References begin, end, Moses::DALMState::get_state(), Moses::Hypothesis::GetCurrTargetLength(), Moses::Hypothesis::GetCurrTargetWordsRange(), Moses::Range::GetEndPos(), Moses::Word::GetFactor(), Moses::Range::GetStartPos(), GetVocabId(), Moses::Hypothesis::GetWord(), Moses::Hypothesis::IsSourceCompleted(), m_factorType, m_lm, m_nGramOrder, NULL, Moses::LanguageModel::OOVFeatureEnabled(), Moses::ScoreComponentCollection::PlusEquals(), state, Moses::TransformLMScore(), and wid_end.

Here is the call graph for this function:

DALM::VocabId Moses::LanguageModelDALM::GetVocabId ( const Factor factor  )  const [protected]

Definition at line 520 of file DALMWrapper.cpp.

References Moses::Factor::GetId(), m_vocab, and m_vocabMap.

Referenced by CalcScore(), and EvaluateWhenApplied().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Moses::LanguageModelDALM::IsUseable ( const FactorMask mask  )  const [virtual]

Implements Moses::FeatureFunction.

Definition at line 485 of file DALMWrapper.cpp.

References m_factorType.

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

override to load model files

Reimplemented from Moses::FeatureFunction.

Definition at line 207 of file DALMWrapper.cpp.

References Moses::FactorCollection::AddFactor(), BOS_, CreateVocabMapping(), EOS_, Moses::FactorCollection::Instance(), LM, m_beginSentenceFactor, m_filePath, m_lm, m_logger, m_nGramOrder, m_vocab, read_ini(), UTIL_THROW_IF, wid_end, and wid_start.

Here is the call graph for this function:

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

Reimplemented from Moses::LanguageModel.

Definition at line 526 of file DALMWrapper.cpp.

References m_ContextSize, m_factorType, m_filePath, and m_nGramOrder.


Member Data Documentation

Definition at line 46 of file DALMWrapper.h.

Referenced by CalcScore(), EvaluateWhenApplied(), and Load().

max n-gram length contained in this LM

Definition at line 52 of file DALMWrapper.h.

Referenced by CalcScore(), and SetParameter().

std::string Moses::LanguageModelDALM::m_filePath [protected]

Definition at line 50 of file DALMWrapper.h.

Referenced by Load(), and SetParameter().

DALM::Logger* Moses::LanguageModelDALM::m_logger [protected]

Definition at line 54 of file DALMWrapper.h.

Referenced by Load(), and ~LanguageModelDALM().

Definition at line 51 of file DALMWrapper.h.

Referenced by EvaluateWhenApplied(), Load(), and SetParameter().

DALM::Vocabulary* Moses::LanguageModelDALM::m_vocab [protected]

Definition at line 55 of file DALMWrapper.h.

Referenced by CalcScore(), CreateVocabMapping(), GetVocabId(), Load(), and ~LanguageModelDALM().

std::vector<DALM::VocabId> Moses::LanguageModelDALM::m_vocabMap [mutable, protected]

Definition at line 59 of file DALMWrapper.h.

Referenced by CreateVocabMapping(), and GetVocabId().

Definition at line 57 of file DALMWrapper.h.

Referenced by EvaluateWhenApplied(), and Load().

Definition at line 57 of file DALMWrapper.h.

Referenced by Load().


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

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