#include <PhraseDictionaryDynamicCacheBased.h>
Public Member Functions | |
PhraseDictionaryDynamicCacheBased (const std::string &line) | |
contructor | |
~PhraseDictionaryDynamicCacheBased () | |
const std::string | GetName () |
void | SetName (const std::string name) |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
void | Load (const std::string files) |
TargetPhraseCollection::shared_ptr | GetTargetPhraseCollection (const Phrase &src) const |
TargetPhraseCollection::shared_ptr | GetTargetPhraseCollectionLEGACY (Phrase const &src) const |
find list of translations that can translates src. Only for phrase input | |
TargetPhraseCollection::shared_ptr | GetTargetPhraseCollectionNonCacheLEGACY (Phrase const &src) const |
ChartRuleLookupManager * | CreateRuleLookupManager (const ChartParser &, const ChartCellCollectionBase &, std::size_t) |
Create a sentence-specific manager for SCFG rule lookup. | |
void | SetParameter (const std::string &key, const std::string &value) |
void | InitializeForInput (ttasksptr const &ttask) |
Create entry for translation of source to targetPhrase. | |
void | Print () const |
void | Clear () |
void | ClearEntries (std::string &entries) |
void | ClearSource (std::string &entries) |
void | Insert (std::string &entries) |
void | Execute (std::string command) |
void | ExecuteDlt (std::map< std::string, std::string > dlt_meta) |
void | SetScoreType (size_t type) |
void | SetMaxAge (unsigned int age) |
Static Public Member Functions | |
static const PhraseDictionaryDynamicCacheBased * | Instance (const std::string &name) |
static PhraseDictionaryDynamicCacheBased * | InstanceNonConst (const std::string &name) |
static const PhraseDictionaryDynamicCacheBased & | Instance () |
static PhraseDictionaryDynamicCacheBased & | InstanceNonConst () |
Protected Member Functions | |
float | decaying_score (const int age) |
void | Insert (std::vector< std::string > entries) |
void | Decay () |
void | Decay (Phrase p) |
void | Update (std::vector< std::string > entries, std::string ageString) |
void | Update (std::string sourceString, std::string targetString, std::string ageString, std::string waString="") |
void | Update (Phrase p, TargetPhrase tp, int age, std::string waString="") |
void | ClearEntries (std::vector< std::string > entries) |
void | ClearEntries (std::string sourceString, std::string targetString) |
void | ClearEntries (Phrase p, Phrase tp) |
void | ClearSource (std::vector< std::string > entries) |
void | ClearSource (Phrase sp) |
void | Execute (std::vector< std::string > commands) |
void | Execute_Single_Command (std::string command) |
void | SetPreComputedScores (const unsigned int numScoreComponent) |
Scores | GetPreComputedScores (const unsigned int age) |
void | Load_Multiple_Files (std::vector< std::string > files) |
void | Load_Single_File (const std::string file) |
TargetPhrase * | CreateTargetPhrase (const Phrase &sourcePhrase) const |
Static Protected Attributes | |
static PhraseDictionaryDynamicCacheBased * | s_instance = NULL |
static std::map< const std::string, PhraseDictionaryDynamicCacheBased * > | s_instance_map |
Friends | |
std::ostream & | operator<< (std::ostream &, const PhraseDictionaryDynamicCacheBased &) |
Definition at line 52 of file PhraseDictionaryDynamicCacheBased.h.
Moses::PhraseDictionaryDynamicCacheBased::PhraseDictionaryDynamicCacheBased | ( | const std::string & | line | ) |
contructor
Definition at line 38 of file PhraseDictionaryDynamicCacheBased.cpp.
References CBTM_SCORE_TYPE_HYPERBOLA, Moses::PhraseDictionary::m_maxCacheSize, Moses::FeatureFunction::ReadParameters(), s_instance, s_instance_map, and UTIL_THROW_IF2.
Moses::PhraseDictionaryDynamicCacheBased::~PhraseDictionaryDynamicCacheBased | ( | ) |
Definition at line 58 of file PhraseDictionaryDynamicCacheBased.cpp.
References Clear().
void Moses::PhraseDictionaryDynamicCacheBased::Clear | ( | ) |
Definition at line 703 of file PhraseDictionaryDynamicCacheBased.cpp.
Referenced by Execute_Single_Command(), ExecuteDlt(), and ~PhraseDictionaryDynamicCacheBased().
void Moses::PhraseDictionaryDynamicCacheBased::ClearEntries | ( | std::string | sourceString, | |
std::string | targetString | |||
) | [protected] |
Definition at line 329 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::Phrase::Clear(), ClearEntries(), Moses::Phrase::CreateFromString(), Moses::Input, Instance(), NULL, Moses::StaticData::options(), Moses::Output, and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::ClearEntries | ( | std::vector< std::string > | entries | ) | [protected] |
Definition at line 313 of file PhraseDictionaryDynamicCacheBased.cpp.
References ClearEntries(), Moses::TokenizeMultiCharSeparator(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::ClearEntries | ( | std::string & | entries | ) |
Definition at line 303 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::TokenizeMultiCharSeparator(), and VERBOSE.
Referenced by ClearEntries(), ClearSource(), and ExecuteDlt().
void Moses::PhraseDictionaryDynamicCacheBased::ClearSource | ( | Phrase | sp | ) | [protected] |
void Moses::PhraseDictionaryDynamicCacheBased::ClearSource | ( | std::vector< std::string > | entries | ) | [protected] |
Definition at line 426 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::Phrase::Clear(), ClearSource(), Moses::Phrase::CreateFromString(), IFVERBOSE, Moses::Input, Instance(), NULL, Print(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::ClearSource | ( | std::string & | entries | ) |
Definition at line 416 of file PhraseDictionaryDynamicCacheBased.cpp.
References ClearEntries(), Moses::TokenizeMultiCharSeparator(), and VERBOSE.
Referenced by ClearSource(), and ExecuteDlt().
ChartRuleLookupManager * Moses::PhraseDictionaryDynamicCacheBased::CreateRuleLookupManager | ( | const ChartParser & | , | |
const ChartCellCollectionBase & | , | |||
std::size_t | ||||
) | [virtual] |
Create a sentence-specific manager for SCFG rule lookup.
Implements Moses::PhraseDictionary.
Definition at line 190 of file PhraseDictionaryDynamicCacheBased.cpp.
References UTIL_THROW.
TargetPhrase* Moses::PhraseDictionaryDynamicCacheBased::CreateTargetPhrase | ( | const Phrase & | sourcePhrase | ) | const [protected] |
void Moses::PhraseDictionaryDynamicCacheBased::Decay | ( | Phrase | p | ) | [protected] |
Definition at line 631 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::ScoreComponentCollection::Assign(), GetPreComputedScores(), Moses::TargetPhrase::GetScoreBreakdown(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::Decay | ( | ) | [protected] |
Definition at line 620 of file PhraseDictionaryDynamicCacheBased.cpp.
Referenced by Insert().
float Moses::PhraseDictionaryDynamicCacheBased::decaying_score | ( | const int | age | ) | [protected] |
Definition at line 233 of file PhraseDictionaryDynamicCacheBased.cpp.
References CBTM_SCORE_TYPE_COSINE, CBTM_SCORE_TYPE_EXPONENTIAL, CBTM_SCORE_TYPE_EXPONENTIAL_REWARD, CBTM_SCORE_TYPE_HYPERBOLA, CBTM_SCORE_TYPE_HYPERBOLA_REWARD, CBTM_SCORE_TYPE_POWER, CBTM_SCORE_TYPE_POWER_REWARD, and PI.
Referenced by SetPreComputedScores().
void Moses::PhraseDictionaryDynamicCacheBased::Execute | ( | std::vector< std::string > | commands | ) | [protected] |
Definition at line 684 of file PhraseDictionaryDynamicCacheBased.cpp.
References Execute_Single_Command(), IFVERBOSE, and Print().
void Moses::PhraseDictionaryDynamicCacheBased::Execute | ( | std::string | command | ) |
Definition at line 677 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::Tokenize(), and VERBOSE.
Referenced by ExecuteDlt().
void Moses::PhraseDictionaryDynamicCacheBased::Execute_Single_Command | ( | std::string | command | ) | [protected] |
Definition at line 692 of file PhraseDictionaryDynamicCacheBased.cpp.
References Clear(), and VERBOSE.
Referenced by Execute().
void Moses::PhraseDictionaryDynamicCacheBased::ExecuteDlt | ( | std::map< std::string, std::string > | dlt_meta | ) |
Definition at line 719 of file PhraseDictionaryDynamicCacheBased.cpp.
References Clear(), ClearEntries(), ClearSource(), Execute(), Insert(), and Load().
const std::string Moses::PhraseDictionaryDynamicCacheBased::GetName | ( | ) | [inline] |
Definition at line 81 of file PhraseDictionaryDynamicCacheBased.h.
Scores Moses::PhraseDictionaryDynamicCacheBased::GetPreComputedScores | ( | const unsigned int | age | ) | [protected] |
Definition at line 294 of file PhraseDictionaryDynamicCacheBased.cpp.
Referenced by Decay(), and Update().
TargetPhraseCollection::shared_ptr Moses::PhraseDictionaryDynamicCacheBased::GetTargetPhraseCollection | ( | const Phrase & | src | ) | const |
Definition at line 154 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::PhraseDictionary::GetFeaturesToApply(), and Moses::PhraseDictionary::m_tableLimit.
Referenced by GetTargetPhraseCollectionLEGACY(), and GetTargetPhraseCollectionNonCacheLEGACY().
TargetPhraseCollection::shared_ptr Moses::PhraseDictionaryDynamicCacheBased::GetTargetPhraseCollectionLEGACY | ( | Phrase const & | src | ) | const [virtual] |
find list of translations that can translates src. Only for phrase input
Reimplemented from Moses::PhraseDictionary.
Definition at line 178 of file PhraseDictionaryDynamicCacheBased.cpp.
References GetTargetPhraseCollection().
TargetPhraseCollection::shared_ptr Moses::PhraseDictionaryDynamicCacheBased::GetTargetPhraseCollectionNonCacheLEGACY | ( | Phrase const & | src | ) | const [virtual] |
Reimplemented from Moses::PhraseDictionary.
Definition at line 184 of file PhraseDictionaryDynamicCacheBased.cpp.
References GetTargetPhraseCollection().
void Moses::PhraseDictionaryDynamicCacheBased::InitializeForInput | ( | ttasksptr const & | ttask | ) | [virtual] |
Create entry for translation of source to targetPhrase.
Reimplemented from Moses::PhraseDictionary.
Definition at line 149 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::PhraseDictionary::ReduceCache().
void Moses::PhraseDictionaryDynamicCacheBased::Insert | ( | std::vector< std::string > | entries | ) | [protected] |
void Moses::PhraseDictionaryDynamicCacheBased::Insert | ( | std::string & | entries | ) |
Definition at line 471 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::TokenizeMultiCharSeparator(), and VERBOSE.
Referenced by ExecuteDlt().
static const PhraseDictionaryDynamicCacheBased& Moses::PhraseDictionaryDynamicCacheBased::Instance | ( | ) | [inline, static] |
Definition at line 103 of file PhraseDictionaryDynamicCacheBased.h.
References s_instance.
Referenced by ClearEntries(), ClearSource(), Load(), and Update().
static const PhraseDictionaryDynamicCacheBased* Moses::PhraseDictionaryDynamicCacheBased::Instance | ( | const std::string & | name | ) | [inline, static] |
Definition at line 88 of file PhraseDictionaryDynamicCacheBased.h.
References NULL, and s_instance_map.
static PhraseDictionaryDynamicCacheBased& Moses::PhraseDictionaryDynamicCacheBased::InstanceNonConst | ( | ) | [inline, static] |
static PhraseDictionaryDynamicCacheBased* Moses::PhraseDictionaryDynamicCacheBased::InstanceNonConst | ( | const std::string & | name | ) | [inline, static] |
Definition at line 95 of file PhraseDictionaryDynamicCacheBased.h.
References NULL, and s_instance_map.
void Moses::PhraseDictionaryDynamicCacheBased::Load | ( | const std::string | files | ) |
Definition at line 75 of file PhraseDictionaryDynamicCacheBased.cpp.
References Load_Multiple_Files(), Moses::Tokenize(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 63 of file PhraseDictionaryDynamicCacheBased.cpp.
References Instance(), Moses::FeatureFunction::m_options, Moses::PhraseDictionary::SetFeaturesToApply(), SetPreComputedScores(), and VERBOSE.
Referenced by ExecuteDlt().
void Moses::PhraseDictionaryDynamicCacheBased::Load_Multiple_Files | ( | std::vector< std::string > | files | ) | [protected] |
Definition at line 83 of file PhraseDictionaryDynamicCacheBased.cpp.
References Load_Single_File(), and VERBOSE.
Referenced by Load().
void Moses::PhraseDictionaryDynamicCacheBased::Load_Single_File | ( | const std::string | file | ) | [protected] |
Definition at line 91 of file PhraseDictionaryDynamicCacheBased.cpp.
References IFVERBOSE, Print(), Moses::TokenizeMultiCharSeparator(), Update(), UTIL_THROW_IF2, and VERBOSE.
Referenced by Load_Multiple_Files().
void Moses::PhraseDictionaryDynamicCacheBased::Print | ( | ) | const |
Definition at line 742 of file PhraseDictionaryDynamicCacheBased.cpp.
References util::ToString(), and VERBOSE.
Referenced by ClearSource(), Execute(), Insert(), and Load_Single_File().
void Moses::PhraseDictionaryDynamicCacheBased::SetMaxAge | ( | unsigned int | age | ) |
Definition at line 217 of file PhraseDictionaryDynamicCacheBased.cpp.
References VERBOSE.
Referenced by SetParameter().
void Moses::PhraseDictionaryDynamicCacheBased::SetName | ( | const std::string | name | ) | [inline] |
Definition at line 84 of file PhraseDictionaryDynamicCacheBased.h.
void Moses::PhraseDictionaryDynamicCacheBased::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::PhraseDictionary.
Definition at line 130 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::Scan< bool >(), SetMaxAge(), SetScoreType(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::SetPreComputedScores | ( | const unsigned int | numScoreComponent | ) | [protected] |
Definition at line 264 of file PhraseDictionaryDynamicCacheBased.cpp.
References CBTM_SCORE_TYPE_COSINE, CBTM_SCORE_TYPE_EXPONENTIAL, CBTM_SCORE_TYPE_HYPERBOLA, CBTM_SCORE_TYPE_POWER, decaying_score(), and VERBOSE.
Referenced by Load().
void Moses::PhraseDictionaryDynamicCacheBased::SetScoreType | ( | size_t | type | ) |
Definition at line 195 of file PhraseDictionaryDynamicCacheBased.cpp.
References CBTM_SCORE_TYPE_COSINE, CBTM_SCORE_TYPE_EXPONENTIAL, CBTM_SCORE_TYPE_EXPONENTIAL_REWARD, CBTM_SCORE_TYPE_HYPERBOLA, CBTM_SCORE_TYPE_HYPERBOLA_REWARD, CBTM_SCORE_TYPE_POWER, CBTM_SCORE_TYPE_POWER_REWARD, and VERBOSE.
Referenced by SetParameter().
void Moses::PhraseDictionaryDynamicCacheBased::Update | ( | Phrase | p, | |
TargetPhrase | tp, | |||
int | age, | |||
std::string | waString = "" | |||
) | [protected] |
Definition at line 546 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::ScoreComponentCollection::Assign(), GetPreComputedScores(), Moses::TargetPhrase::GetScoreBreakdown(), NULL, Moses::TargetPhrase::SetAlignmentInfo(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::Update | ( | std::string | sourceString, | |
std::string | targetString, | |||
std::string | ageString, | |||
std::string | waString = "" | |||
) | [protected] |
Definition at line 514 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::Phrase::Clear(), Moses::Phrase::CreateFromString(), Moses::Input, Instance(), NULL, Moses::StaticData::options(), Moses::Output, Moses::Trim(), Update(), and VERBOSE.
void Moses::PhraseDictionaryDynamicCacheBased::Update | ( | std::vector< std::string > | entries, | |
std::string | ageString | |||
) | [protected] |
Definition at line 492 of file PhraseDictionaryDynamicCacheBased.cpp.
References Moses::TokenizeMultiCharSeparator(), and VERBOSE.
Referenced by Insert(), Load_Single_File(), and Update().
std::ostream& operator<< | ( | std::ostream & | , | |
const PhraseDictionaryDynamicCacheBased & | ||||
) | [friend] |
PhraseDictionaryDynamicCacheBased * Moses::PhraseDictionaryDynamicCacheBased::s_instance = NULL [static, protected] |
Definition at line 150 of file PhraseDictionaryDynamicCacheBased.h.
Referenced by Instance(), InstanceNonConst(), and PhraseDictionaryDynamicCacheBased().
std::map< const std::string, PhraseDictionaryDynamicCacheBased * > Moses::PhraseDictionaryDynamicCacheBased::s_instance_map [static, protected] |
Definition at line 151 of file PhraseDictionaryDynamicCacheBased.h.
Referenced by Instance(), InstanceNonConst(), and PhraseDictionaryDynamicCacheBased().