#include <FactorCollection.h>
Classes | |
struct | EqualsFactor |
struct | HashFactor |
Public Member Functions | |
~FactorCollection () | |
const Factor * | AddFactor (const StringPiece &factorString, bool isNonTerminal=false) |
size_t | GetNumNonTerminals () |
const Factor * | GetFactor (const StringPiece &factorString, bool isNonTerminal=false) |
const Factor * | AddFactor (FactorDirection, FactorType, const StringPiece &factorString, bool isNonTerminal=false) |
TO_STRING () | |
Static Public Member Functions | |
static FactorCollection & | Instance () |
Friends | |
class | ::System |
std::ostream & | operator<< (std::ostream &, const FactorCollection &) |
All Factors in moses are accessed and created by a FactorCollection. By enforcing this strict creation processes (ie, forbidding factors from being created on the stack, etc), their memory addresses can be used as keys to uniquely identify them. Only 1 FactorCollection object should be created.
Definition at line 68 of file FactorCollection.h.
Moses::FactorCollection::~FactorCollection | ( | ) |
Definition at line 87 of file FactorCollection.cpp.
const Factor* Moses::FactorCollection::AddFactor | ( | FactorDirection | , | |
FactorType | , | |||
const StringPiece & | factorString, | |||
bool | isNonTerminal = false | |||
) | [inline] |
Definition at line 123 of file FactorCollection.h.
References AddFactor(), and isNonTerminal().
const Factor * Moses::FactorCollection::AddFactor | ( | const StringPiece & | factorString, | |
bool | isNonTerminal = false | |||
) |
returns a factor with the same direction, factorType and factorString. If a factor already exist in the collection, return the existing factor, if not create a new 1
Definition at line 38 of file FactorCollection.cpp.
References util::Pool::Allocate(), StringPiece::data(), end, Moses::FactorFriend::in, moses_MaxNumNonterminals, StringPiece::size(), and UTIL_THROW_IF2.
Referenced by AddFactor(), Moses::BilingualLM::BilingualLM(), Moses::BilingualLM_NPLM::BilingualLM_NPLM(), Moses::PhraseDictionaryOnDisk::ConvertToMoses(), Moses::LanguageModelSRI::CreateFactors(), Moses::LanguageModelRandLM::CreateFactors(), Moses::LanguageModelMaxEntSRI::CreateFactors(), Moses::LanguageModelIRST::CreateFactors(), Moses::Word::CreateFromString(), Moses::PDTAimp::CreateTargetPhrase(), Moses::Word::CreateUnknownWord(), Moses::LanguageModelDALM::CreateVocabMapping(), Moses::TargetConstituentAdjacencyFeature::EvaluateWhenApplied(), Moses::ExampleLM::ExampleLM(), Moses::GlobalLexicalModel::GlobalLexicalModel(), Moses::Phrase::InitStartEndWord(), Moses::ProbingPT::Load(), Moses::NeuralLMWrapper::Load(), Moses::LanguageModelDALM::Load(), Moses::GenerationDictionary::Load(), Moses::Model1Vocabulary::Load(), Moses::SyntaxOptions::LoadNonTerminals(), Moses::BleuScoreFeature::LoadReferences(), Moses::SoftSourceSyntacticConstraintsFeature::LoadSourceLabelSet(), Moses::SoftSourceSyntacticConstraintsFeature::LoadTargetSourceLeftHandSideJointCountFile(), Moses::PhraseOrientationFeature::LoadWordList(), Moses::MaxSpanFreeNonTermSource::MaxSpanFreeNonTermSource(), Moses::Model1Vocabulary::Model1Vocabulary(), Moses::OxLMMapper::OxLMMapper(), Moses::OxLMParallelMapper::OxLMParallelMapper(), Moses::PhraseOrientationFeature::PhraseOrientationFeature(), Moses::ProcessAndStripXMLTags(), Moses::TranslationOptionCollection::ProcessOneUnknownWord(), Moses::Sentence::ProcessPlaceholders(), Moses::TargetConstituentBoundariesRightAdjacentPhraseProperty::ProcessValue(), Moses::TargetConstituentBoundariesLeftPhraseProperty::ProcessValue(), Moses::NonTermContextProperty::ProcessValue(), Moses::RulePairUnlexicalizedSource::RulePairUnlexicalizedSource(), Moses::SparseHieroReorderingFeature::SparseHieroReorderingFeature(), Moses::TargetBigramFeature::TargetBigramFeature(), Moses::TargetNgramFeature::TargetNgramFeature(), and Moses::VW::VW().
const Factor * Moses::FactorCollection::GetFactor | ( | const StringPiece & | factorString, | |
bool | isNonTerminal = false | |||
) |
Definition at line 69 of file FactorCollection.cpp.
References end, Moses::FactorFriend::in, and NULL.
size_t Moses::FactorCollection::GetNumNonTerminals | ( | ) | [inline] |
Definition at line 116 of file FactorCollection.h.
Referenced by Moses::SoftMatchingFeature::ResizeCache().
static FactorCollection& Moses::FactorCollection::Instance | ( | ) | [inline, static] |
Definition at line 105 of file FactorCollection.h.
Referenced by Moses::BilingualLM::BilingualLM(), Moses::BilingualLM_NPLM::BilingualLM_NPLM(), Moses::ChartCellLabelSet::ChartCellExists(), Moses::PhraseDictionaryOnDisk::ConvertToMoses(), Moses::LanguageModelSRI::CreateFactors(), Moses::LanguageModelMaxEntSRI::CreateFactors(), Moses::Word::CreateFromString(), Moses::PDTAimp::CreateTargetPhrase(), Moses::Word::CreateUnknownWord(), Moses::LanguageModelDALM::CreateVocabMapping(), Moses::TargetConstituentAdjacencyFeature::EvaluateWhenApplied(), Moses::ExampleLM::ExampleLM(), Moses::GlobalLexicalModel::GlobalLexicalModel(), Moses::Phrase::InitStartEndWord(), Moses::ProbingPT::Load(), Moses::LanguageModelRandLM::Load(), Moses::NeuralLMWrapper::Load(), Moses::LanguageModelIRST::Load(), Moses::LanguageModelDALM::Load(), Moses::GenerationDictionary::Load(), Moses::Model1Vocabulary::Load(), Moses::StaticData::LoadData(), Moses::BleuScoreFeature::LoadReferences(), Moses::SoftSourceSyntacticConstraintsFeature::LoadSourceLabelSet(), Moses::SoftSourceSyntacticConstraintsFeature::LoadTargetSourceLeftHandSideJointCountFile(), Moses::PhraseOrientationFeature::LoadWordList(), Moses::MaxSpanFreeNonTermSource::MaxSpanFreeNonTermSource(), Moses::Model1Vocabulary::Model1Vocabulary(), Moses::OxLMMapper::OxLMMapper(), Moses::OxLMParallelMapper::OxLMParallelMapper(), Moses::Syntax::S2T::PChart::PChart(), Moses::PhraseOrientationFeature::PhraseOrientationFeature(), Moses::ProcessAndStripXMLTags(), Moses::TranslationOptionCollection::ProcessOneUnknownWord(), Moses::Sentence::ProcessPlaceholders(), Moses::TargetConstituentBoundariesRightAdjacentPhraseProperty::ProcessValue(), Moses::TargetConstituentBoundariesLeftPhraseProperty::ProcessValue(), Moses::NonTermContextProperty::ProcessValue(), Moses::SoftMatchingFeature::ResizeCache(), Moses::RulePairUnlexicalizedSource::RulePairUnlexicalizedSource(), Moses::DistortionScoreProducer::SetParameter(), Moses::SparseHieroReorderingFeature::SparseHieroReorderingFeature(), Moses::TargetBigramFeature::TargetBigramFeature(), Moses::TargetNgramFeature::TargetNgramFeature(), and Moses::VW::VW().
Moses::FactorCollection::TO_STRING | ( | ) |
friend class ::System [friend] |
Definition at line 71 of file FactorCollection.h.
std::ostream& operator<< | ( | std::ostream & | , | |
const FactorCollection & | ||||
) | [friend] |