#include <ProbingPT.h>
Public Member Functions | |
ProbingPT (const std::string &line) | |
~ProbingPT () | |
void | Load (AllOptions::ptr const &opts) |
override to load model files | |
void | InitializeForInput (ttasksptr const &ttask) |
Create entry for translation of source to targetPhrase. | |
void | SetParameter (const std::string &key, const std::string &value) |
void | GetTargetPhraseCollectionBatch (const InputPathList &inputPathQueue) const |
virtual ChartRuleLookupManager * | CreateRuleLookupManager (const ChartParser &, const ChartCellCollectionBase &, std::size_t) |
Create a sentence-specific manager for SCFG rule lookup. | |
TO_STRING () | |
Protected Types | |
typedef boost::unordered_map < uint64_t, TargetPhraseCollection * > | CachePb |
Protected Member Functions | |
void | CreateAlignmentMap (const std::string path) |
TargetPhraseCollection::shared_ptr | CreateTargetPhrase (const Phrase &sourcePhrase) const |
std::pair< bool, uint64_t > | GetKey (const Phrase &sourcePhrase) const |
void | GetSourceProbingIds (const Phrase &sourcePhrase, bool &ok, uint64_t probingSource[]) const |
uint64_t | GetSourceProbingId (const Word &word) const |
uint64_t | GetSourceProbingId (const Factor *factor) const |
TargetPhraseCollection * | CreateTargetPhrases (const Phrase &sourcePhrase, uint64_t key) const |
TargetPhrase * | CreateTargetPhrase (const char *&offset) const |
const Factor * | GetTargetFactor (uint32_t probingId) const |
Protected Attributes | |
probingpt::QueryEngine * | m_engine |
uint64_t | m_unkId |
std::vector< uint64_t > | m_sourceVocab |
std::vector< const Factor * > | m_targetVocab |
std::vector< const AlignmentInfo * > | m_aligns |
util::LoadMethod | load_method |
boost::iostreams::mapped_file_source | file |
const char * | data |
CachePb | m_cachePb |
Friends | |
std::ostream & | operator<< (std::ostream &, const ProbingPT &) |
Definition at line 21 of file ProbingPT.h.
typedef boost::unordered_map<uint64_t, TargetPhraseCollection*> Moses::ProbingPT::CachePb [protected] |
Definition at line 60 of file ProbingPT.h.
Moses::ProbingPT::ProbingPT | ( | const std::string & | line | ) |
Definition at line 14 of file ProbingPT.cpp.
References Moses::DecodeFeature::m_input, Moses::DecodeFeature::m_output, and Moses::FeatureFunction::ReadParameters().
Moses::ProbingPT::~ProbingPT | ( | ) |
void Moses::ProbingPT::CreateAlignmentMap | ( | const std::string | path | ) | [protected] |
Definition at line 98 of file ProbingPT.cpp.
References Moses::AlignmentInfoCollection::Instance(), m_aligns, m_engine, and NULL.
Referenced by Load().
ChartRuleLookupManager * Moses::ProbingPT::CreateRuleLookupManager | ( | const ChartParser & | , | |
const ChartCellCollectionBase & | , | |||
std::size_t | ||||
) | [virtual] |
Create a sentence-specific manager for SCFG rule lookup.
Implements Moses::PhraseDictionary.
Definition at line 356 of file ProbingPT.cpp.
References NULL.
TargetPhrase * Moses::ProbingPT::CreateTargetPhrase | ( | const char *& | offset | ) | const [protected] |
Definition at line 279 of file ProbingPT.cpp.
References Moses::Phrase::AddWord(), Moses::FloorScore(), Moses::TargetPhrase::GetScoreBreakdown(), GetTargetFactor(), m_aligns, m_engine, Moses::DecodeFeature::m_output, Moses::ScoreComponentCollection::PlusEquals(), Moses::TargetPhrase::SetAlignTerm(), Moses::TransformScore(), and UTIL_THROW_IF2.
TargetPhraseCollection::shared_ptr Moses::ProbingPT::CreateTargetPhrase | ( | const Phrase & | sourcePhrase | ) | const [protected] |
Definition at line 163 of file ProbingPT.cpp.
References CreateTargetPhrases(), GetKey(), Moses::Phrase::GetSize(), and m_cachePb.
Referenced by CreateTargetPhrases(), and GetTargetPhraseCollectionBatch().
TargetPhraseCollection * Moses::ProbingPT::CreateTargetPhrases | ( | const Phrase & | sourcePhrase, | |
uint64_t | key | |||
) | const [protected] |
Definition at line 245 of file ProbingPT.cpp.
References Moses::TargetPhraseCollection::Add(), CreateTargetPhrase(), data, Moses::TargetPhrase::EvaluateInIsolation(), Moses::PhraseDictionary::GetFeaturesToApply(), m_engine, Moses::PhraseDictionary::m_tableLimit, NULL, and Moses::TargetPhraseCollection::Prune().
Referenced by CreateTargetPhrase().
std::pair< bool, uint64_t > Moses::ProbingPT::GetKey | ( | const Phrase & | sourcePhrase | ) | const [protected] |
Definition at line 187 of file ProbingPT.cpp.
References Moses::Phrase::GetSize(), GetSourceProbingIds(), and m_engine.
Referenced by CreateTargetPhrase().
uint64_t Moses::ProbingPT::GetSourceProbingId | ( | const Factor * | factor | ) | const [protected] |
uint64_t Moses::ProbingPT::GetSourceProbingId | ( | const Word & | word | ) | const [protected] |
Definition at line 227 of file ProbingPT.cpp.
References Moses::Factor::GetId(), Moses::DecodeFeature::m_input, m_sourceVocab, and m_unkId.
Referenced by GetSourceProbingIds().
void Moses::ProbingPT::GetSourceProbingIds | ( | const Phrase & | sourcePhrase, | |
bool & | ok, | |||
uint64_t | probingSource[] | |||
) | const [protected] |
Definition at line 208 of file ProbingPT.cpp.
References Moses::Phrase::GetSize(), GetSourceProbingId(), Moses::Phrase::GetWord(), and m_unkId.
Referenced by GetKey().
const Factor* Moses::ProbingPT::GetTargetFactor | ( | uint32_t | probingId | ) | const [inline, protected] |
Definition at line 78 of file ProbingPT.h.
References m_targetVocab, and NULL.
Referenced by CreateTargetPhrase().
void Moses::ProbingPT::GetTargetPhraseCollectionBatch | ( | const InputPathList & | inputPathQueue | ) | const [virtual] |
Reimplemented from Moses::PhraseDictionary.
Definition at line 147 of file ProbingPT.cpp.
References CreateTargetPhrase(), Moses::InputPath::GetPhrase(), Moses::Phrase::GetSize(), Moses::FeatureFunction::m_options, NULL, and Moses::InputPath::SetTargetPhrases().
void Moses::ProbingPT::InitializeForInput | ( | ttasksptr const & | ttask | ) | [virtual] |
Create entry for translation of source to targetPhrase.
Reimplemented from Moses::PhraseDictionary.
Definition at line 142 of file ProbingPT.cpp.
void Moses::ProbingPT::Load | ( | AllOptions::ptr const & | opts | ) | [virtual] |
override to load model files
Reimplemented from Moses::FeatureFunction.
Definition at line 30 of file ProbingPT.cpp.
References Moses::FactorCollection::AddFactor(), CreateAlignmentMap(), data, file, Moses::Factor::GetId(), Moses::FactorCollection::Instance(), load_method, m_engine, Moses::PhraseDictionary::m_filePath, Moses::FeatureFunction::m_options, m_sourceVocab, m_targetVocab, m_unkId, Moses::PhraseDictionary::SetFeaturesToApply(), Moses::Tokenize(), and UTIL_THROW_IF2.
void Moses::ProbingPT::SetParameter | ( | const std::string & | key, | |
const std::string & | value | |||
) | [virtual] |
Reimplemented from Moses::PhraseDictionary.
Definition at line 120 of file ProbingPT.cpp.
References util::LAZY, load_method, util::PARALLEL_READ, util::POPULATE_OR_LAZY, util::POPULATE_OR_READ, util::READ, and UTIL_THROW2.
Moses::ProbingPT::TO_STRING | ( | ) |
std::ostream& operator<< | ( | std::ostream & | , | |
const ProbingPT & | ||||
) | [friend] |
const char* Moses::ProbingPT::data [protected] |
boost::iostreams::mapped_file_source Moses::ProbingPT::file [protected] |
util::LoadMethod Moses::ProbingPT::load_method [protected] |
std::vector<const AlignmentInfo*> Moses::ProbingPT::m_aligns [protected] |
Definition at line 53 of file ProbingPT.h.
Referenced by CreateAlignmentMap(), and CreateTargetPhrase().
CachePb Moses::ProbingPT::m_cachePb [protected] |
probingpt::QueryEngine* Moses::ProbingPT::m_engine [protected] |
Definition at line 48 of file ProbingPT.h.
Referenced by CreateAlignmentMap(), CreateTargetPhrase(), CreateTargetPhrases(), GetKey(), Load(), and ~ProbingPT().
std::vector<uint64_t> Moses::ProbingPT::m_sourceVocab [protected] |
std::vector<const Factor*> Moses::ProbingPT::m_targetVocab [protected] |
uint64_t Moses::ProbingPT::m_unkId [protected] |
Definition at line 49 of file ProbingPT.h.
Referenced by GetSourceProbingId(), GetSourceProbingIds(), and Load().