#include <DynamicCacheBasedLanguageModel.h>
Public Member Functions | |
DynamicCacheBasedLanguageModel (const std::string &line) | |
~DynamicCacheBasedLanguageModel () | |
const std::string | GetName () |
void | SetName (const std::string name) |
bool | IsUseable (const FactorMask &mask) const |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
void | Load (const std::string filestr) |
void | Execute (std::string command) |
void | SetParameter (const std::string &key, const std::string &value) |
void | ExecuteDlt (std::map< std::string, std::string > dlt_meta) |
void | ClearEntries (std::string &entries) |
void | Insert (std::string &entries) |
void | Clear () |
virtual void | EvaluateInIsolation (const Phrase &source, const TargetPhrase &targetPhrase, ScoreComponentCollection &scoreBreakdown, ScoreComponentCollection &estimatedScores) const |
void | EvaluateWithSourceContext (const InputType &input, const InputPath &inputPath, const TargetPhrase &targetPhrase, const StackVec *stackVec, ScoreComponentCollection &scoreBreakdown, ScoreComponentCollection *estimatedScores=NULL) const |
void | EvaluateTranslationOptionListWithSourceContext (const InputType &input, const TranslationOptionList &translationOptionList) const |
void | EvaluateWhenApplied (const Hypothesis &hypo, ScoreComponentCollection *accumulator) const |
void | EvaluateWhenApplied (const ChartHypothesis &hypo, ScoreComponentCollection *accumulator) const |
void | SetQueryType (size_t type) |
void | SetScoreType (size_t type) |
void | SetMaxAge (unsigned int age) |
Static Public Member Functions | |
static const DynamicCacheBasedLanguageModel * | Instance (const std::string &name) |
static DynamicCacheBasedLanguageModel * | InstanceNonConst (const std::string &name) |
static const DynamicCacheBasedLanguageModel & | Instance () |
static DynamicCacheBasedLanguageModel & | InstanceNonConst () |
Static Protected Attributes | |
static DynamicCacheBasedLanguageModel * | s_instance = NULL |
static std::map< const std::string, DynamicCacheBasedLanguageModel * > | s_instance_map |
Definition at line 38 of file DynamicCacheBasedLanguageModel.h.
Moses::DynamicCacheBasedLanguageModel::DynamicCacheBasedLanguageModel | ( | const std::string & | line | ) |
Definition at line 12 of file DynamicCacheBasedLanguageModel.cpp.
References CBLM_QUERY_TYPE_ALLSUBSTRINGS, CBLM_SCORE_TYPE_HYPERBOLA, Moses::FeatureFunction::ReadParameters(), s_instance, s_instance_map, UTIL_THROW_IF2, and VERBOSE.
Moses::DynamicCacheBasedLanguageModel::~DynamicCacheBasedLanguageModel | ( | ) |
Definition at line 31 of file DynamicCacheBasedLanguageModel.cpp.
void Moses::DynamicCacheBasedLanguageModel::Clear | ( | ) |
Definition at line 318 of file DynamicCacheBasedLanguageModel.cpp.
Referenced by ExecuteDlt().
void Moses::DynamicCacheBasedLanguageModel::ClearEntries | ( | std::string & | entries | ) |
Definition at line 223 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::TokenizeMultiCharSeparator(), and VERBOSE.
void Moses::DynamicCacheBasedLanguageModel::EvaluateInIsolation | ( | const Phrase & | source, | |
const TargetPhrase & | targetPhrase, | |||
ScoreComponentCollection & | scoreBreakdown, | |||
ScoreComponentCollection & | estimatedScores | |||
) | const [virtual] |
Implements Moses::FeatureFunction.
Definition at line 88 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::ScoreComponentCollection::Assign(), CBLM_QUERY_TYPE_ALLSUBSTRINGS, CBLM_QUERY_TYPE_WHOLESTRING, and UTIL_THROW_IF2.
void Moses::DynamicCacheBasedLanguageModel::EvaluateTranslationOptionListWithSourceContext | ( | const InputType & | input, | |
const TranslationOptionList & | translationOptionList | |||
) | const [inline, virtual] |
void Moses::DynamicCacheBasedLanguageModel::EvaluateWhenApplied | ( | const ChartHypothesis & | hypo, | |
ScoreComponentCollection * | accumulator | |||
) | const [inline, virtual] |
Same for chart-based features.
Implements Moses::StatelessFeatureFunction.
Definition at line 153 of file DynamicCacheBasedLanguageModel.h.
void Moses::DynamicCacheBasedLanguageModel::EvaluateWhenApplied | ( | const Hypothesis & | hypo, | |
ScoreComponentCollection * | accumulator | |||
) | const [inline, virtual] |
This should be implemented for features that apply to phrase-based models.
Implements Moses::StatelessFeatureFunction.
Definition at line 149 of file DynamicCacheBasedLanguageModel.h.
void Moses::DynamicCacheBasedLanguageModel::EvaluateWithSourceContext | ( | const InputType & | input, | |
const InputPath & | inputPath, | |||
const TargetPhrase & | targetPhrase, | |||
const StackVec * | stackVec, | |||
ScoreComponentCollection & | scoreBreakdown, | |||
ScoreComponentCollection * | estimatedScores = NULL | |||
) | const [inline, virtual] |
void Moses::DynamicCacheBasedLanguageModel::Execute | ( | std::string | command | ) |
Definition at line 286 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::Tokenize(), and VERBOSE.
void Moses::DynamicCacheBasedLanguageModel::ExecuteDlt | ( | std::map< std::string, std::string > | dlt_meta | ) |
Definition at line 266 of file DynamicCacheBasedLanguageModel.cpp.
References Clear(), and Load().
const std::string Moses::DynamicCacheBasedLanguageModel::GetName | ( | ) | [inline] |
Definition at line 88 of file DynamicCacheBasedLanguageModel.h.
void Moses::DynamicCacheBasedLanguageModel::Insert | ( | std::string & | entries | ) |
Definition at line 246 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::TokenizeMultiCharSeparator(), and VERBOSE.
static const DynamicCacheBasedLanguageModel& Moses::DynamicCacheBasedLanguageModel::Instance | ( | ) | [inline, static] |
static const DynamicCacheBasedLanguageModel* Moses::DynamicCacheBasedLanguageModel::Instance | ( | const std::string & | name | ) | [inline, static] |
Definition at line 95 of file DynamicCacheBasedLanguageModel.h.
References NULL, and s_instance_map.
static DynamicCacheBasedLanguageModel& Moses::DynamicCacheBasedLanguageModel::InstanceNonConst | ( | ) | [inline, static] |
static DynamicCacheBasedLanguageModel* Moses::DynamicCacheBasedLanguageModel::InstanceNonConst | ( | const std::string & | name | ) | [inline, static] |
Definition at line 102 of file DynamicCacheBasedLanguageModel.h.
References NULL, and s_instance_map.
bool Moses::DynamicCacheBasedLanguageModel::IsUseable | ( | const FactorMask & | mask | ) | const [inline, virtual] |
void Moses::DynamicCacheBasedLanguageModel::Load | ( | const std::string | filestr | ) |
Definition at line 334 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::Tokenize(), and VERBOSE.
void Moses::DynamicCacheBasedLanguageModel::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 326 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::FeatureFunction::m_options, and VERBOSE.
Referenced by ExecuteDlt().
void Moses::DynamicCacheBasedLanguageModel::SetMaxAge | ( | unsigned int | age | ) |
Definition at line 420 of file DynamicCacheBasedLanguageModel.cpp.
References VERBOSE.
Referenced by SetParameter().
void Moses::DynamicCacheBasedLanguageModel::SetName | ( | const std::string | name | ) | [inline] |
Definition at line 91 of file DynamicCacheBasedLanguageModel.h.
void Moses::DynamicCacheBasedLanguageModel::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::FeatureFunction.
Definition at line 68 of file DynamicCacheBasedLanguageModel.cpp.
References Moses::Scan< bool >(), SetMaxAge(), SetQueryType(), SetScoreType(), and VERBOSE.
void Moses::DynamicCacheBasedLanguageModel::SetQueryType | ( | size_t | type | ) |
Definition at line 385 of file DynamicCacheBasedLanguageModel.cpp.
References CBLM_QUERY_TYPE_ALLSUBSTRINGS, CBLM_QUERY_TYPE_WHOLESTRING, and VERBOSE.
Referenced by SetParameter().
void Moses::DynamicCacheBasedLanguageModel::SetScoreType | ( | size_t | type | ) |
Definition at line 401 of file DynamicCacheBasedLanguageModel.cpp.
References CBLM_SCORE_TYPE_COSINE, CBLM_SCORE_TYPE_EXPONENTIAL, CBLM_SCORE_TYPE_EXPONENTIAL_REWARD, CBLM_SCORE_TYPE_HYPERBOLA, CBLM_SCORE_TYPE_HYPERBOLA_REWARD, CBLM_SCORE_TYPE_POWER, CBLM_SCORE_TYPE_POWER_REWARD, and VERBOSE.
Referenced by SetParameter().
DynamicCacheBasedLanguageModel * Moses::DynamicCacheBasedLanguageModel::s_instance = NULL [static, protected] |
Definition at line 81 of file DynamicCacheBasedLanguageModel.h.
Referenced by DynamicCacheBasedLanguageModel(), Instance(), and InstanceNonConst().
std::map< const std::string, DynamicCacheBasedLanguageModel * > Moses::DynamicCacheBasedLanguageModel::s_instance_map [static, protected] |
Definition at line 82 of file DynamicCacheBasedLanguageModel.h.
Referenced by DynamicCacheBasedLanguageModel(), Instance(), and InstanceNonConst().