Moses::HypothesisStackNormal Class Reference

#include <HypothesisStackNormal.h>

Inheritance diagram for Moses::HypothesisStackNormal:

Inheritance graph
[legend]
Collaboration diagram for Moses::HypothesisStackNormal:

Collaboration graph
[legend]

List of all members.

Public Member Functions

float GetWorstScoreForBitmap (WordsBitmapID id)
float GetWorstScoreForBitmap (const WordsBitmap &coverage)
 HypothesisStackNormal (Manager &manager)
bool AddPrune (Hypothesis *hypothesis)
void SetMaxHypoStackSize (size_t maxHypoStackSize, size_t minHypoStackDiversity)
void SetBeamWidth (float beamWidth)
float GetBestScore () const
float GetWorstScore () const
void PruneToSize (size_t newSize)
const HypothesisGetBestHypothesis () const
 return the hypothesis with best score. Used to get the translated at end of decoding
std::vector< const Hypothesis * > GetSortedList () const
 return all hypothesis, sorted by descending score. Used in creation of N best list
std::vector< Hypothesis * > GetSortedListNOTCONST ()
void CleanupArcList ()
 TO_STRING ()

Protected Member Functions

std::pair
< HypothesisStackNormal::iterator,
bool > 
Add (Hypothesis *hypothesis)
void RemoveAll ()
void SetWorstScoreForBitmap (WordsBitmapID id, float worstScore)

Protected Attributes

float m_bestScore
float m_worstScore
std::map< WordsBitmapID, float > m_diversityWorstScore
float m_beamWidth
size_t m_maxHypoStackSize
size_t m_minHypoStackDiversity
bool m_nBestIsEnabled

Friends

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


Detailed Description

Stack for instances of Hypothesis, includes functions for pruning.

Constructor & Destructor Documentation

Moses::HypothesisStackNormal::HypothesisStackNormal ( Manager manager  ) 


Member Function Documentation

pair< HypothesisStackNormal::iterator, bool > Moses::HypothesisStackNormal::Add ( Hypothesis hypothesis  )  [protected]

add hypothesis to stack. Prune if necessary. Returns false if equiv hypo exists in collection, otherwise returns true

References Moses::WordsBitmap::GetID(), Moses::StaticData::GetMaxDistortion(), Moses::Hypothesis::GetTotalScore(), Moses::Hypothesis::GetWordsBitmap(), GetWorstScoreForBitmap(), Moses::StaticData::Instance(), m_beamWidth, m_bestScore, Moses::HypothesisStack::m_hypos, m_maxHypoStackSize, m_minHypoStackDiversity, m_worstScore, PruneToSize(), SetWorstScoreForBitmap(), and VERBOSE.

Referenced by AddPrune().

Here is the call graph for this function:

Here is the caller graph for this function:

bool Moses::HypothesisStackNormal::AddPrune ( Hypothesis hypothesis  )  [virtual]

void Moses::HypothesisStackNormal::CleanupArcList (  ) 

make all arcs in point to the equiv hypothesis that contains them. Ie update doubly linked list be hypo & arcs

References Moses::Hypothesis::CleanupArcList(), Moses::HypothesisStack::m_hypos, and m_nBestIsEnabled.

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

Here is the call graph for this function:

Here is the caller graph for this function:

const Hypothesis * Moses::HypothesisStackNormal::GetBestHypothesis (  )  const [virtual]

return the hypothesis with best score. Used to get the translated at end of decoding

Implements Moses::HypothesisStack.

References Moses::Hypothesis::GetTotalScore(), Moses::HypothesisStack::m_hypos, and NULL.

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

Here is the call graph for this function:

Here is the caller graph for this function:

float Moses::HypothesisStackNormal::GetBestScore (  )  const [inline]

return score of the best hypothesis in the stack

References m_bestScore.

vector< const Hypothesis * > Moses::HypothesisStackNormal::GetSortedList (  )  const [virtual]

return all hypothesis, sorted by descending score. Used in creation of N best list

Implements Moses::HypothesisStack.

References Moses::HypothesisStack::m_hypos.

vector< Hypothesis * > Moses::HypothesisStackNormal::GetSortedListNOTCONST (  ) 

References Moses::HypothesisStack::m_hypos.

Referenced by PruneToSize().

Here is the caller graph for this function:

float Moses::HypothesisStackNormal::GetWorstScore (  )  const [inline, virtual]

return worst allowable score

Reimplemented from Moses::HypothesisStack.

References m_worstScore.

float Moses::HypothesisStackNormal::GetWorstScoreForBitmap ( const WordsBitmap coverage  )  [inline]

References Moses::WordsBitmap::GetID(), and GetWorstScoreForBitmap().

Here is the call graph for this function:

float Moses::HypothesisStackNormal::GetWorstScoreForBitmap ( WordsBitmapID  id  )  [inline, virtual]

Reimplemented from Moses::HypothesisStack.

References m_diversityWorstScore.

Referenced by Add(), AddPrune(), and GetWorstScoreForBitmap().

Here is the caller graph for this function:

void Moses::HypothesisStackNormal::PruneToSize ( size_t  newSize  ) 

pruning, if too large. Pruning algorithm: find a threshold and delete all hypothesis below it. The threshold is chosen so that exactly newSize top items remain on the stack in fact, in situations where some of the hypothesis fell below m_beamWidth, the stack will contain less items.

Parameters:
newSize maximum size

References Moses::SentenceStats::AddPruning(), Moses::HypothesisStack::Detach(), FREEHYPO, Moses::Hypothesis::GetId(), Moses::WordsBitmap::GetID(), Moses::Manager::GetSentenceStats(), GetSortedListNOTCONST(), Moses::Hypothesis::GetTotalScore(), Moses::Hypothesis::GetWordsBitmap(), IFVERBOSE, m_beamWidth, m_bestScore, Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_minHypoStackDiversity, m_worstScore, SetWorstScoreForBitmap(), Moses::HypothesisStack::size(), TRACE_ERR, and VERBOSE.

Referenced by Add(), and Moses::SearchNormal::ProcessSentence().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::HypothesisStackNormal::RemoveAll (  )  [protected]

destroy all instances of Hypothesis in this collection

remove all hypotheses from the collection

References Moses::HypothesisStack::m_hypos, and Moses::HypothesisStack::Remove().

Here is the call graph for this function:

void Moses::HypothesisStackNormal::SetBeamWidth ( float  beamWidth  )  [inline]

set beam threshold, hypotheses in the stack must not be worse than this factor times the best score to be allowed in the stack

Parameters:
beamThreshold minimum factor (typical number: 0.03)

References m_beamWidth.

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

Here is the caller graph for this function:

void Moses::HypothesisStackNormal::SetMaxHypoStackSize ( size_t  maxHypoStackSize,
size_t  minHypoStackDiversity 
) [inline]

set maximum number of hypotheses in the collection

Parameters:
maxHypoStackSize maximum number (typical number: 100)
maxHypoStackSize maximum number (defauly: 0)

References m_maxHypoStackSize, and m_minHypoStackDiversity.

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

Here is the caller graph for this function:

void Moses::HypothesisStackNormal::SetWorstScoreForBitmap ( WordsBitmapID  id,
float  worstScore 
) [inline, protected]

References m_diversityWorstScore.

Referenced by Add(), and PruneToSize().

Here is the caller graph for this function:

Moses::HypothesisStackNormal::TO_STRING (  ) 


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const HypothesisStackNormal hypoColl 
) [friend]


Member Data Documentation

minimum score due to threashold pruning

Referenced by Add(), PruneToSize(), and SetBeamWidth().

score of the best hypothesis in collection

Referenced by Add(), GetBestScore(), HypothesisStackNormal(), and PruneToSize().

score of worst hypothesis for particular source word coverage

Referenced by GetWorstScoreForBitmap(), and SetWorstScoreForBitmap().

maximum number of hypothesis allowed in this stack

Referenced by Add(), and SetMaxHypoStackSize().

minimum number of hypothesis with different source word coverage

Referenced by Add(), AddPrune(), PruneToSize(), and SetMaxHypoStackSize().

flag to determine whether to keep track of old arcs

Referenced by AddPrune(), CleanupArcList(), and HypothesisStackNormal().

score of the worse hypothesis in collection

Referenced by Add(), AddPrune(), GetWorstScore(), HypothesisStackNormal(), and PruneToSize().


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

Generated on Fri Jul 30 20:05:16 2010 for Moses by  doxygen 1.5.9