Moses::TranslationOption Class Reference

#include <TranslationOption.h>

Collaboration diagram for Moses::TranslationOption:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 TranslationOption (const WordsRange &wordsRange, const TargetPhrase &targetPhrase, const InputType &inputType)
 TranslationOption (const WordsRange &wordsRange, const TargetPhrase &targetPhrase, const InputType &inputType, const UnknownWordPenaltyProducer *uwpProducer)
 TranslationOption (const TranslationOption &copy)
 TranslationOption (const TranslationOption &copy, const WordsRange &sourceWordsRange)
 ~TranslationOption ()
bool IsCompatible (const Phrase &phrase, const std::vector< FactorType > &featuresToCheck) const
void MergeNewFeatures (const Phrase &phrase, const ScoreComponentCollection &score, const std::vector< FactorType > &featuresToMerge)
const TargetPhraseGetTargetPhrase () const
const WordsRangeGetSourceWordsRange () const
const PhraseGetSourcePhrase () const
bool Overlap (const Hypothesis &hypothesis) const
size_t GetStartPos () const
size_t GetEndPos () const
size_t GetSize () const
float GetFutureScore () const
bool IsDeletionOption () const
const ScoreComponentCollectionGetScoreBreakdown () const
const ScoresGetCachedScores (const ScoreProducer *scoreProducer) const
void CalcScore (const TranslationSystem *system)
void CacheScores (const ScoreProducer &scoreProducer, const Scores &score)
 TO_STRING ()

Protected Types

typedef std::map< const
ScoreProducer *, const Scores * > 
_ScoreCacheMap

Protected Attributes

TargetPhrase m_targetPhrase
Phrasem_sourcePhrase
const WordsRange m_sourceWordsRange
float m_futureScore
ScoreComponentCollection m_scoreBreakdown
_ScoreCacheMap m_cachedScores

Friends

std::ostream & operator<< (std::ostream &out, const TranslationOption &possibleTranslation)


Detailed Description

Available phrase translation for a particular sentence pair. In a multi-factor model, this is expanded from the entries in the translation tables and generation tables (and pruned to the maximum number allowed). By pre-computing the allowable phrase translations, efficient beam search in Manager is possible when expanding instances of the class Hypothesis - the states in the search.

A translation option contains source and target phrase, aggregate and details scores (in m_scoreBreakdown), including an estimate how expensive this option will be in search (used to build the future cost matrix.)

m_targetPhrase points to a phrase-table entry. The source word range is zero-indexed, so it can't refer to an empty range. The target phrase may be empty.

Definition at line 59 of file TranslationOption.h.


Member Typedef Documentation

typedef std::map<const ScoreProducer *, const Scores *> Moses::TranslationOption::_ScoreCacheMap [protected]

Definition at line 76 of file TranslationOption.h.


Constructor & Destructor Documentation

Moses::TranslationOption::TranslationOption ( const WordsRange wordsRange,
const TargetPhrase targetPhrase,
const InputType inputType 
)

Moses::TranslationOption::TranslationOption ( const WordsRange wordsRange,
const TargetPhrase targetPhrase,
const InputType inputType,
const UnknownWordPenaltyProducer uwpProducer 
)

Moses::TranslationOption::TranslationOption ( const TranslationOption copy  ) 

copy constructor

Definition at line 84 of file TranslationOption.cpp.

Moses::TranslationOption::TranslationOption ( const TranslationOption copy,
const WordsRange sourceWordsRange 
)

copy constructor, but change words range. used by caching

Definition at line 94 of file TranslationOption.cpp.

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

Definition at line 95 of file TranslationOption.h.

References m_cachedScores, and m_sourcePhrase.


Member Function Documentation

void Moses::TranslationOption::CacheScores ( const ScoreProducer scoreProducer,
const Scores score 
)

Definition at line 165 of file TranslationOption.cpp.

References m_cachedScores.

Referenced by Moses::TranslationOptionCollection::CacheLexReordering().

Here is the caller graph for this function:

void Moses::TranslationOption::CalcScore ( const TranslationSystem system  ) 

const Scores* Moses::TranslationOption::GetCachedScores ( const ScoreProducer scoreProducer  )  const [inline]

returns cached scores

Definition at line 156 of file TranslationOption.h.

References m_cachedScores, and NULL.

Referenced by Moses::LexicalReorderingState::CopyScores().

Here is the caller graph for this function:

size_t Moses::TranslationOption::GetEndPos (  )  const [inline]

return end index of source phrase

Definition at line 131 of file TranslationOption.h.

References Moses::WordsRange::GetEndPos(), and m_sourceWordsRange.

Referenced by Moses::SearchNormal::ExpandHypothesis().

Here is the call graph for this function:

Here is the caller graph for this function:

float Moses::TranslationOption::GetFutureScore (  )  const [inline]

const ScoreComponentCollection& Moses::TranslationOption::GetScoreBreakdown (  )  const [inline]

returns detailed component scores

Definition at line 151 of file TranslationOption.h.

References m_scoreBreakdown.

Referenced by Moses::Hypothesis::CalcExpectedScore(), Moses::Hypothesis::CalcScore(), and Moses::operator<<().

Here is the caller graph for this function:

size_t Moses::TranslationOption::GetSize (  )  const [inline]

return length of source phrase

Definition at line 136 of file TranslationOption.h.

References Moses::WordsRange::GetEndPos(), Moses::WordsRange::GetStartPos(), and m_sourceWordsRange.

Referenced by Moses::SearchNormal::ExpandHypothesis().

Here is the call graph for this function:

Here is the caller graph for this function:

const Phrase* Moses::TranslationOption::GetSourcePhrase (  )  const [inline]

returns source phrase

Definition at line 118 of file TranslationOption.h.

References m_sourcePhrase.

Referenced by Moses::TranslationOptionCollection::CacheLexReordering().

Here is the caller graph for this function:

const WordsRange& Moses::TranslationOption::GetSourceWordsRange (  )  const [inline]

size_t Moses::TranslationOption::GetStartPos (  )  const [inline]

return start index of source phrase

Definition at line 126 of file TranslationOption.h.

References Moses::WordsRange::GetStartPos(), and m_sourceWordsRange.

Referenced by Moses::SearchNormal::ExpandHypothesis().

Here is the call graph for this function:

Here is the caller graph for this function:

const TargetPhrase& Moses::TranslationOption::GetTargetPhrase (  )  const [inline]

bool Moses::TranslationOption::IsCompatible ( const Phrase phrase,
const std::vector< FactorType > &  featuresToCheck 
) const

returns true if all feature types in featuresToCheck are compatible between the two phrases

Definition at line 117 of file TranslationOption.cpp.

References Moses::Phrase::IsCompatible(), and m_targetPhrase.

Here is the call graph for this function:

bool Moses::TranslationOption::IsDeletionOption (  )  const [inline]

return true if the source phrase translates into nothing

Definition at line 146 of file TranslationOption.h.

References Moses::Phrase::GetSize(), and m_targetPhrase.

Referenced by Moses::Hypothesis::Hypothesis().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::TranslationOption::MergeNewFeatures ( const Phrase phrase,
const ScoreComponentCollection score,
const std::vector< FactorType > &  featuresToMerge 
)

used when precomputing (composing) translation options

Definition at line 104 of file TranslationOption.cpp.

References CHECK, Moses::Phrase::GetSize(), m_scoreBreakdown, m_targetPhrase, Moses::Phrase::MergeFactors(), and Moses::ScoreComponentCollection::PlusEquals().

Here is the call graph for this function:

bool Moses::TranslationOption::Overlap ( const Hypothesis hypothesis  )  const

whether source span overlaps with those of a hypothesis

Definition at line 129 of file TranslationOption.cpp.

References GetSourceWordsRange(), Moses::Hypothesis::GetWordsBitmap(), and Moses::WordsBitmap::Overlap().

Here is the call graph for this function:

Moses::TranslationOption::TO_STRING (  ) 


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const TranslationOption possibleTranslation 
) [friend]


Member Data Documentation

Definition at line 77 of file TranslationOption.h.

Referenced by CacheScores(), GetCachedScores(), and ~TranslationOption().

Definition at line 68 of file TranslationOption.h.

Referenced by CalcScore(), and GetFutureScore().

in TranslationOption, m_scoreBreakdown is not complete. It cannot, for example, know the full n-gram score since the length of the TargetPhrase may be shorter than the n-gram order. But, if it is possible to estimate, it is included here.

Definition at line 74 of file TranslationOption.h.

Referenced by CalcScore(), GetScoreBreakdown(), MergeNewFeatures(), and TranslationOption().

Definition at line 66 of file TranslationOption.h.

Referenced by GetSourcePhrase(), TranslationOption(), and ~TranslationOption().

Definition at line 67 of file TranslationOption.h.

Referenced by GetEndPos(), GetSize(), GetSourceWordsRange(), and GetStartPos().


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

Generated on Wed Feb 8 23:04:10 2012 for Moses by  doxygen 1.5.9