Public Member Functions | |
LanguageModelLDHT () | |
LanguageModelLDHT (const std::string &path, ScoreIndexManager &manager, FactorType factorType) | |
LanguageModelLDHT (ScoreIndexManager &manager, LanguageModelLDHT ©From) | |
LDHT::Client * | getClientUnsafe () const |
LDHT::Client * | getClientSafe () |
LDHT::Client * | initTSSClient () |
virtual | ~LanguageModelLDHT () |
virtual void | InitializeForInput (InputType const &source) |
Called before search and collecting of translation options. | |
virtual void | CleanUpAfterSentenceProcessing (const InputType &source) |
virtual const FFState * | EmptyHypothesisState (const InputType &input) const |
return the state associated with the empty hypothesis for a given sentence | |
virtual void | CalcScore (const Phrase &phrase, float &fullScore, float &ngramScore, std::size_t &oovCount) const |
virtual void | CalcScoreFromCache (const Phrase &phrase, float &fullScore, float &ngramScore, std::size_t &oovCount) const |
FFState * | Evaluate (const Hypothesis &hypo, const FFState *input_state, ScoreComponentCollection *score_output) 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 * | EvaluateChart (const ChartHypothesis &hypo, int featureID, ScoreComponentCollection *accumulator) const |
virtual void | IssueRequestsFor (Hypothesis &hypo, const FFState *input_state) |
float | calcScoreFromState (LDHTLMState *hypo) const |
void | sync () |
void | SetFFStateIdx (int state_idx) |
Protected Attributes | |
boost::thread_specific_ptr < LDHT::Client > | m_client |
std::string | m_configPath |
FactorType | m_factorType |
int | m_state_idx |
int | m_calc_score_count |
uint64_t | m_start_tick |
Definition at line 64 of file LDHT.cpp.
Moses::LanguageModelLDHT::LanguageModelLDHT | ( | ) |
Moses::LanguageModelLDHT::LanguageModelLDHT | ( | const std::string & | path, | |
ScoreIndexManager & | manager, | |||
FactorType | factorType | |||
) |
Moses::LanguageModelLDHT::LanguageModelLDHT | ( | ScoreIndexManager & | manager, | |
LanguageModelLDHT & | copyFrom | |||
) |
Definition at line 124 of file LDHT.cpp.
References m_calc_score_count, m_configPath, and m_factorType.
void Moses::LanguageModelLDHT::CalcScore | ( | const Phrase & | phrase, | |
float & | fullScore, | |||
float & | ngramScore, | |||
std::size_t & | oovCount | |||
) | const [virtual] |
Implements Moses::LanguageModel.
Definition at line 216 of file LDHT.cpp.
References getClientUnsafe(), Moses::Word::GetFactor(), Moses::Phrase::GetSize(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), m_calc_score_count, m_factorType, and sync().
void Moses::LanguageModelLDHT::CalcScoreFromCache | ( | const Phrase & | phrase, | |
float & | fullScore, | |||
float & | ngramScore, | |||
std::size_t & | oovCount | |||
) | const [virtual] |
Reimplemented from Moses::LanguageModel.
Definition at line 253 of file LDHT.cpp.
References getClientUnsafe(), Moses::Word::GetFactor(), Moses::Phrase::GetSize(), Moses::Factor::GetString(), Moses::Phrase::GetWord(), m_factorType, sync(), and Moses::TransformLMScore().
float Moses::LanguageModelLDHT::calcScoreFromState | ( | LDHTLMState * | hypo | ) | const |
Definition at line 397 of file LDHT.cpp.
References Moses::LDHTLMState::clearRequestTags(), getClientUnsafe(), Moses::LDHTLMState::requestTagsBegin(), Moses::LDHTLMState::requestTagsEnd(), and Moses::LDHTLMState::setFinalised().
Referenced by Evaluate().
void Moses::LanguageModelLDHT::CleanUpAfterSentenceProcessing | ( | const InputType & | source | ) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 190 of file LDHT.cpp.
References getClientSafe(), and m_start_tick.
const FFState * Moses::LanguageModelLDHT::EmptyHypothesisState | ( | const InputType & | input | ) | const [virtual] |
return the state associated with the empty hypothesis for a given sentence
Implements Moses::LanguageModel.
Definition at line 210 of file LDHT.cpp.
References NULL.
FFState * Moses::LanguageModelLDHT::Evaluate | ( | 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 370 of file LDHT.cpp.
References calcScoreFromState(), Moses::FloorScore(), Moses::Hypothesis::GetFFState(), m_state_idx, Moses::ScoreComponentCollection::PlusEquals(), state, and Moses::TransformLMScore().
FFState * Moses::LanguageModelLDHT::EvaluateChart | ( | const ChartHypothesis & | hypo, | |
int | featureID, | |||
ScoreComponentCollection * | accumulator | |||
) | const [virtual] |
Implements Moses::StatefulFeatureFunction.
Definition at line 389 of file LDHT.cpp.
References NULL.
LDHT::Client * Moses::LanguageModelLDHT::getClientSafe | ( | ) |
Definition at line 151 of file LDHT.cpp.
References initTSSClient(), m_client, and NULL.
Referenced by CleanUpAfterSentenceProcessing(), and InitializeForInput().
LDHT::Client * Moses::LanguageModelLDHT::getClientUnsafe | ( | ) | const |
Definition at line 159 of file LDHT.cpp.
References m_client.
Referenced by CalcScore(), CalcScoreFromCache(), calcScoreFromState(), IssueRequestsFor(), and sync().
void Moses::LanguageModelLDHT::InitializeForInput | ( | InputType const & | source | ) | [virtual] |
Called before search and collecting of translation options.
Reimplemented from Moses::FeatureFunction.
Definition at line 184 of file LDHT.cpp.
References getClientSafe(), and m_start_tick.
LDHT::Client * Moses::LanguageModelLDHT::initTSSClient | ( | ) |
Definition at line 164 of file LDHT.cpp.
References m_configPath.
Referenced by getClientSafe().
void Moses::LanguageModelLDHT::IssueRequestsFor | ( | Hypothesis & | hypo, | |
const FFState * | input_state | |||
) | [virtual] |
Reimplemented from Moses::LanguageModel.
Definition at line 306 of file LDHT.cpp.
References Moses::LDHTLMState::appendRequestTag(), BOS_, Moses::LDHTLMState::copyFrom(), EOS_, getClientUnsafe(), Moses::Hypothesis::GetCurrTargetWordsRange(), Moses::WordsRange::GetEndPos(), Moses::Hypothesis::GetFactor(), Moses::WordsRange::GetStartPos(), Moses::Factor::GetString(), Moses::LDHTLMState::gram_fingerprints, Moses::Hypothesis::IsSourceCompleted(), m_factorType, m_state_idx, NULL, and Moses::Hypothesis::SetFFState().
void Moses::LanguageModelLDHT::SetFFStateIdx | ( | int | state_idx | ) | [virtual] |
Reimplemented from Moses::LanguageModel.
Definition at line 365 of file LDHT.cpp.
References m_state_idx.
void Moses::LanguageModelLDHT::sync | ( | ) | [virtual] |
Reimplemented from Moses::LanguageModel.
Definition at line 359 of file LDHT.cpp.
References getClientUnsafe(), and m_calc_score_count.
Referenced by CalcScore(), and CalcScoreFromCache().
int Moses::LanguageModelLDHT::m_calc_score_count [protected] |
Definition at line 107 of file LDHT.cpp.
Referenced by CalcScore(), LanguageModelLDHT(), and sync().
boost::thread_specific_ptr<LDHT::Client> Moses::LanguageModelLDHT::m_client [protected] |
std::string Moses::LanguageModelLDHT::m_configPath [protected] |
FactorType Moses::LanguageModelLDHT::m_factorType [protected] |
Definition at line 105 of file LDHT.cpp.
Referenced by CalcScore(), CalcScoreFromCache(), IssueRequestsFor(), and LanguageModelLDHT().
uint64_t Moses::LanguageModelLDHT::m_start_tick [protected] |
Definition at line 108 of file LDHT.cpp.
Referenced by CleanUpAfterSentenceProcessing(), and InitializeForInput().
int Moses::LanguageModelLDHT::m_state_idx [protected] |
Definition at line 106 of file LDHT.cpp.
Referenced by Evaluate(), IssueRequestsFor(), and SetFFStateIdx().