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)
virtual float GetWorstScoreForBitmap (const Bitmap &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

A stack for standard phrase-based decoding.

Definition at line 37 of file HypothesisStackNormal.h.


Constructor & Destructor Documentation

Moses::HypothesisStackNormal::HypothesisStackNormal ( Manager manager  ) 

Definition at line 35 of file HypothesisStackNormal.cpp.

References m_bestScore, m_nBestIsEnabled, m_worstScore, and Moses::BaseManager::options().

Here is the call graph for this function:


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

Definition at line 51 of file HypothesisStackNormal.cpp.

References Moses::Hypothesis::GetFutureScore(), Moses::Bitmap::GetID(), Moses::Hypothesis::GetWordsBitmap(), GetWorstScoreForBitmap(), m_beamWidth, m_bestScore, Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_maxHypoStackSize, m_minHypoStackDiversity, m_worstScore, Moses::BaseManager::options(), 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]

adds the hypo, but only if within thresholds (beamThr, stackSize). This function will recombine hypotheses silently! There is no record (could affect n-best list generation...TODO) Call stack for adding hypothesis is AddPrune() Add() AddNoPrune()

Implements Moses::HypothesisStack.

Definition at line 93 of file HypothesisStackNormal.cpp.

References Add(), Moses::Hypothesis::AddArc(), Moses::SentenceStats::AddDiscarded(), Moses::SentenceStats::AddRecombination(), Moses::HypothesisStack::Detach(), Moses::Hypothesis::GetFutureScore(), Moses::Hypothesis::GetId(), Moses::Manager::GetSentenceStats(), Moses::Hypothesis::GetWordsBitmap(), GetWorstScoreForBitmap(), Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_minHypoStackDiversity, m_nBestIsEnabled, m_worstScore, Moses::BaseManager::options(), Moses::HypothesisStack::Remove(), UTIL_THROW2, and VERBOSE.

Here is the call graph for this function:

void Moses::HypothesisStackNormal::CleanupArcList (  ) 

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

Definition at line 264 of file HypothesisStackNormal.cpp.

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

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

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.

Definition at line 229 of file HypothesisStackNormal.cpp.

References Moses::Hypothesis::GetFutureScore(), 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

Definition at line 102 of file HypothesisStackNormal.h.

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.

Definition at line 244 of file HypothesisStackNormal.cpp.

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

Here is the call graph for this function:

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

Definition at line 254 of file HypothesisStackNormal.cpp.

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

Referenced by PruneToSize().

Here is the call graph for this function:

Here is the caller graph for this function:

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

return worst allowable score

Reimplemented from Moses::HypothesisStack.

Definition at line 106 of file HypothesisStackNormal.h.

References m_worstScore.

virtual float Moses::HypothesisStackNormal::GetWorstScoreForBitmap ( const Bitmap coverage  )  [inline, virtual]

Reimplemented from Moses::HypothesisStack.

Definition at line 69 of file HypothesisStackNormal.h.

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

Here is the call graph for this function:

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

Reimplemented from Moses::HypothesisStack.

Definition at line 64 of file HypothesisStackNormal.h.

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

Definition at line 157 of file HypothesisStackNormal.cpp.

References Moses::SentenceStats::AddPruning(), Moses::HypothesisStack::Detach(), Moses::Hypothesis::GetFutureScore(), Moses::Hypothesis::GetId(), Moses::Bitmap::GetID(), Moses::Manager::GetSentenceStats(), GetSortedListNOTCONST(), 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::ProcessOneStack().

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

Definition at line 44 of file HypothesisStackNormal.cpp.

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)

Definition at line 98 of file HypothesisStackNormal.h.

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)

Definition at line 89 of file HypothesisStackNormal.h.

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]

Definition at line 59 of file HypothesisStackNormal.h.

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]

Definition at line 280 of file HypothesisStackNormal.cpp.


Member Data Documentation

minimum score due to threashold pruning

Definition at line 46 of file HypothesisStackNormal.h.

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

score of the best hypothesis in collection

Definition at line 43 of file HypothesisStackNormal.h.

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

score of worst hypothesis for particular source word coverage

Definition at line 45 of file HypothesisStackNormal.h.

Referenced by GetWorstScoreForBitmap(), and SetWorstScoreForBitmap().

maximum number of hypothesis allowed in this stack

Definition at line 47 of file HypothesisStackNormal.h.

Referenced by Add(), and SetMaxHypoStackSize().

minimum number of hypothesis with different source word coverage

Definition at line 48 of file HypothesisStackNormal.h.

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

flag to determine whether to keep track of old arcs

Definition at line 49 of file HypothesisStackNormal.h.

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

score of the worse hypothesis in collection

Definition at line 44 of file HypothesisStackNormal.h.

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


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

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