Moses::Word Class Reference

#include <Word.h>

Collaboration diagram for Moses::Word:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Word (const Word &copy)
 Word (bool isNonTerminal=false)
 ~Word ()
const Factor *& operator[] (FactorType index)
 returns Factor pointer for particular FactorType
const Factor *const & operator[] (FactorType index) const
const FactorGetFactor (FactorType factorType) const
 Deprecated. should use operator[].
void SetFactor (FactorType factorType, const Factor *factor)
bool IsNonTerminal () const
void SetIsNonTerminal (bool val)
bool IsOOV () const
void SetIsOOV (bool val)
bool IsEpsilon () const
void Merge (const Word &sourceWord)
std::string GetString (const std::vector< FactorType > factorType, bool endWithBlank) const
StringPiece GetString (FactorType factorType) const
 TO_STRING ()
bool operator== (const Word &compare) const
bool operator!= (const Word &compare) const
void CreateFromString (FactorDirection direction, const std::vector< FactorType > &factorOrder, const StringPiece &str, bool isNonTerminal, bool strict=true)
void CreateUnknownWord (const Word &sourceWord)
void OnlyTheseFactors (const FactorMask &factors)
size_t hash () const

Static Public Member Functions

static int Compare (const Word &targetWord, const Word &sourceWord)

Protected Types

typedef const FactorFactorArray [MAX_NUM_FACTORS]

Protected Attributes

FactorArray m_factorArray
bool m_isNonTerminal
bool m_isOOV

Friends

std::ostream & operator<< (std::ostream &, const Word &)


Detailed Description

Represent a word (terminal or non-term) Wrapper around hold a set of factors for a single word

Definition at line 44 of file Word.h.


Member Typedef Documentation

typedef const Factor* Moses::Word::FactorArray[MAX_NUM_FACTORS] [protected]

Definition at line 50 of file Word.h.


Constructor & Destructor Documentation

Moses::Word::Word ( const Word copy  )  [inline]

deep copy

Definition at line 58 of file Word.h.

References m_factorArray.

Moses::Word::Word ( bool  isNonTerminal = false  )  [inline, explicit]

empty word

Definition at line 65 of file Word.h.

References isNonTerminal(), m_factorArray, m_isNonTerminal, and m_isOOV.

Here is the call graph for this function:

Moses::Word::~Word (  )  [inline]

Definition at line 71 of file Word.h.


Member Function Documentation

int Word::Compare ( const Word targetWord,
const Word sourceWord 
) [static]

transitive comparison of 2 word objects. Used by operator<. Only compare the co-joined factors, ie. where factor exists for both words. Should make it non-static

Definition at line 49 of file Word.cpp.

References IsNonTerminal(), and NULL.

Here is the call graph for this function:

void Word::CreateFromString ( FactorDirection  direction,
const std::vector< FactorType > &  factorOrder,
const StringPiece str,
bool  isNonTerminal,
bool  strict = true 
)

void Word::CreateUnknownWord ( const Word sourceWord  ) 

Definition at line 172 of file Word.cpp.

References Moses::FactorCollection::AddFactor(), Moses::Factor::GetString(), Moses::FactorCollection::Instance(), IsNonTerminal(), m_isNonTerminal, m_isOOV, Moses::max_fax(), NULL, Moses::Output, SetFactor(), and UNKNOWN_FACTOR.

Referenced by Moses::ChartParserUnknown::Process().

Here is the call graph for this function:

Here is the caller graph for this function:

const Factor* Moses::Word::GetFactor ( FactorType  factorType  )  const [inline]

StringPiece Word::GetString ( FactorType  factorType  )  const

Definition at line 122 of file Word.cpp.

References m_factorArray.

std::string Moses::Word::GetString ( const std::vector< FactorType factorType,
bool  endWithBlank 
) const

size_t Moses::Word::hash (  )  const [inline]

Definition at line 143 of file Word.h.

References m_factorArray, m_isNonTerminal, and util::MurmurHashNative().

Referenced by Moses::hash_value().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Word::IsEpsilon (  )  const

Definition at line 202 of file Word.cpp.

References StringPiece::compare(), EPSILON, Moses::Factor::GetString(), and m_factorArray.

Referenced by Moses::TranslationOptionCollectionLattice::Extend(), and Moses::TranslationOptionCollectionLattice::TranslationOptionCollectionLattice().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Moses::Word::IsNonTerminal (  )  const [inline]

Definition at line 90 of file Word.h.

References m_isNonTerminal.

Referenced by Moses::TreeInput::AddChartLabel(), Moses::Syntax::S2T::PChart::AddVertex(), Moses::LanguageModelKen< Model >::CalcScore(), Moses::LanguageModelImplementation::CalcScore(), Moses::LanguageModelDALM::CalcScore(), Moses::BackwardLanguageModel< Model >::CalcScore(), Compare(), Moses::TargetWordInsertionFeature::ComputeFeatures(), Moses::SourceWordDeletionFeature::ComputeFeatures(), Moses::EditOps::ComputeFeatures(), Moses::PhraseDictionaryOnDisk::ConvertFromMoses(), CreateUnknownWord(), Moses::BackwardLanguageModel< Model >::Evaluate(), Moses::UnalignedWordCountFeature::EvaluateInIsolation(), Moses::RuleScope::EvaluateInIsolation(), Moses::RulePairUnlexicalizedSource::EvaluateInIsolation(), Moses::CountNonTerms::EvaluateInIsolation(), Moses::RDLM::EvaluateWhenApplied(), Moses::LanguageModelKen< Model >::EvaluateWhenApplied(), Moses::LanguageModelImplementation::EvaluateWhenApplied(), Moses::LanguageModelDALM::EvaluateWhenApplied(), Moses::TreeStructureFeature::EvaluateWhenApplied(), Moses::TargetPreferencesFeature::EvaluateWhenApplied(), Moses::TargetNgramFeature::EvaluateWhenApplied(), Moses::SoftMatchingFeature::EvaluateWhenApplied(), Moses::BleuScoreFeature::EvaluateWhenApplied(), Moses::WordTranslationFeature::EvaluateWithSourceContext(), Moses::SoftSourceSyntacticConstraintsFeature::EvaluateWithSourceContext(), Moses::NieceTerminal::EvaluateWithSourceContext(), Moses::Model1Feature::EvaluateWithSourceContext(), Moses::MaxSpanFreeNonTermSource::EvaluateWithSourceContext(), Moses::PhraseDictionaryNodeMemory::GetChild(), Moses::Syntax::T2S::RuleTrie::Node::GetChild(), Moses::Syntax::S2T::RuleTrieCYKPlus::Node::GetChild(), Moses::Syntax::T2S::RuleTrie::Node::GetNonTerminalChild(), Moses::Syntax::S2T::RuleTrieCYKPlus::Node::GetNonTerminalChild(), Moses::Phrase::GetNumTerminals(), Moses::Syntax::GetOneBestTargetYield(), Moses::PhraseDictionaryNodeMemory::GetOrCreateChild(), Moses::PhraseDictionaryFuzzyMatch::GetOrCreateNode(), Moses::PhraseDictionaryMemory::GetOrCreateNode(), Moses::UTrieNode::GetOrCreateNonTerminalChild(), Moses::Syntax::T2S::RuleTrie::Node::GetOrCreateNonTerminalChild(), Moses::Syntax::S2T::RuleTrieScope3::Node::GetOrCreateNonTerminalChild(), Moses::Syntax::S2T::RuleTrieCYKPlus::Node::GetOrCreateNonTerminalChild(), Moses::Syntax::T2S::RuleTrie::Node::GetOrCreateTargetPhraseCollection(), Moses::UTrieNode::GetOrCreateTerminalChild(), Moses::Syntax::S2T::RuleTrieScope3::Node::GetOrCreateTerminalChild(), Moses::Syntax::KBestExtractor::GetOutputPhrase(), Moses::ChartKBestExtractor::GetOutputPhrase(), Moses::ChartHypothesis::GetOutputPhrase(), Moses::ChartKBestExtractor::GetOutputScoreBreakdown(), Moses::Syntax::KBestExtractor::GetOutputTree(), Moses::ChartKBestExtractor::GetOutputTree(), Moses::InternalTree::IsLeafNT(), Moses::DottedRule::IsNonTerminal(), Moses::InternalTree::IsTerminal(), Moses::operator<<(), operator==(), Moses::Syntax::S2T::PHyperedgeToSHyperedgeBundle(), Moses::PhraseOrientationFeature::SparseWordL2RScore(), and Moses::PhraseOrientationFeature::SparseWordR2LScore().

bool Moses::Word::IsOOV (  )  const [inline]

void Word::Merge ( const Word sourceWord  ) 

add the factors from sourceWord into this representation, NULL elements in sourceWord will be skipped

Definition at line 86 of file Word.cpp.

References m_factorArray, and NULL.

void Word::OnlyTheseFactors ( const FactorMask factors  ) 

Definition at line 193 of file Word.cpp.

References NULL, and SetFactor().

Referenced by Moses::PhraseDictionaryOnDisk::GetTargetPhraseCollectionBatch(), and Moses::PhraseDictionaryMemory::GetTargetPhraseCollectionBatch().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Moses::Word::operator!= ( const Word compare  )  const [inline]

Definition at line 121 of file Word.h.

bool Word::operator== ( const Word compare  )  const

Definition at line 69 of file Word.cpp.

References GetFactor(), and IsNonTerminal().

Here is the call graph for this function:

const Factor* const& Moses::Word::operator[] ( FactorType  index  )  const [inline]

Definition at line 78 of file Word.h.

References m_factorArray.

const Factor*& Moses::Word::operator[] ( FactorType  index  )  [inline]

returns Factor pointer for particular FactorType

Definition at line 74 of file Word.h.

References m_factorArray.

void Moses::Word::SetFactor ( FactorType  factorType,
const Factor factor 
) [inline]

void Moses::Word::SetIsNonTerminal ( bool  val  )  [inline]

Definition at line 93 of file Word.h.

References m_isNonTerminal.

Referenced by Moses::StaticData::LoadNonTerminals(), and Moses::SyntaxOptions::LoadNonTerminals().

Here is the caller graph for this function:

void Moses::Word::SetIsOOV ( bool  val  )  [inline]

Definition at line 100 of file Word.h.

References m_isOOV.

Referenced by Moses::ChartParserUnknown::Process(), and Moses::TranslationOptionCollection::ProcessOneUnknownWord().

Here is the caller graph for this function:

Moses::Word::TO_STRING (  ) 


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const Word  
) [friend]


Member Data Documentation

set of factors

Definition at line 52 of file Word.h.

Referenced by CreateFromString(), GetFactor(), GetString(), hash(), IsEpsilon(), Merge(), operator[](), SetFactor(), and Word().

bool Moses::Word::m_isNonTerminal [protected]

Definition at line 53 of file Word.h.

Referenced by CreateFromString(), CreateUnknownWord(), hash(), IsNonTerminal(), SetIsNonTerminal(), and Word().

bool Moses::Word::m_isOOV [protected]

Definition at line 54 of file Word.h.

Referenced by CreateUnknownWord(), IsOOV(), SetIsOOV(), and Word().


The documentation for this class was generated from the following files:

Generated on Thu Jul 6 00:33:58 2017 for Moses by  doxygen 1.5.9