#include <Rand.h>
Public Member Functions | |
LanguageModelRandLM (const std::string &line) | |
~LanguageModelRandLM () | |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
virtual LMResult | GetValue (const std::vector< const Word * > &contextFactor, State *finalState=NULL) const |
void | InitializeForInput (ttasksptr const &ttask) |
Called before search and collecting of translation options. | |
void | CleanUpAfterSentenceProcessing (const InputType &source) |
Protected Member Functions | |
void | CreateFactors (FactorCollection &factorCollection) |
uint32_t | GetLmID (const std::string &str) const |
uint32_t | GetLmID (const Factor *factor) const |
Protected Attributes | |
std::vector< uint32_t > | m_randlm_ids_vec |
randlm::RandLM * | m_lm |
uint32_t | m_oov_id |
Definition at line 36 of file Rand.h.
Moses::LanguageModelRandLM::LanguageModelRandLM | ( | const std::string & | line | ) |
Moses::LanguageModelRandLM::~LanguageModelRandLM | ( | ) |
void Moses::LanguageModelRandLM::CleanUpAfterSentenceProcessing | ( | const InputType & | source | ) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 141 of file Rand.cpp.
References m_lm.
void Moses::LanguageModelRandLM::CreateFactors | ( | FactorCollection & | factorCollection | ) | [protected] |
Definition at line 68 of file Rand.cpp.
References Moses::FactorCollection::AddFactor(), fill(), Moses::Factor::GetId(), Moses::LanguageModelSingleFactor::m_factorType, m_lm, m_oov_id, m_randlm_ids_vec, Moses::LanguageModelSingleFactor::m_sentenceEnd, Moses::LanguageModelImplementation::m_sentenceEndWord, Moses::LanguageModelSingleFactor::m_sentenceStart, Moses::LanguageModelImplementation::m_sentenceStartWord, and Moses::Output.
Referenced by Load().
randlm::WordID Moses::LanguageModelRandLM::GetLmID | ( | const Factor * | factor | ) | const [protected] |
Definition at line 109 of file Rand.cpp.
References Moses::Factor::GetId(), m_oov_id, and m_randlm_ids_vec.
randlm::WordID Moses::LanguageModelRandLM::GetLmID | ( | const std::string & | str | ) | const [protected] |
virtual LMResult Moses::LanguageModelRandLM::GetValue | ( | const std::vector< const Word * > & | contextFactor, | |
State * | finalState = NULL | |||
) | const [virtual] |
Implements Moses::LanguageModelSingleFactor.
void Moses::LanguageModelRandLM::InitializeForInput | ( | ttasksptr const & | ttask | ) | [virtual] |
Called before search and collecting of translation options.
Reimplemented from Moses::FeatureFunction.
Definition at line 137 of file Rand.cpp.
References m_lm.
void Moses::LanguageModelRandLM::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 55 of file Rand.cpp.
References CreateFactors(), Moses::FactorCollection::Instance(), Moses::LanguageModelImplementation::m_filePath, m_lm, Moses::LanguageModelImplementation::m_nGramOrder, m_oov_id, NULL, and UTIL_THROW_IF2.
randlm::RandLM* Moses::LanguageModelRandLM::m_lm [protected] |
Definition at line 51 of file Rand.h.
Referenced by CleanUpAfterSentenceProcessing(), CreateFactors(), GetLmID(), InitializeForInput(), Load(), and ~LanguageModelRandLM().
uint32_t Moses::LanguageModelRandLM::m_oov_id [protected] |
std::vector<uint32_t> Moses::LanguageModelRandLM::m_randlm_ids_vec [protected] |