#include <HypothesisStackNormal.h>


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 Hypothesis * | GetBestHypothesis () 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 &) |
| Moses::HypothesisStackNormal::HypothesisStackNormal | ( | Manager & | manager | ) |
References Moses::StaticData::Instance(), Moses::StaticData::IsNBestEnabled(), m_bestScore, m_nBestIsEnabled, and m_worstScore.

| 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().


| 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.
References Add(), Moses::Hypothesis::AddArc(), Moses::SentenceStats::AddDiscarded(), Moses::SentenceStats::AddRecombination(), Moses::HypothesisStack::Detach(), FREEHYPO, Moses::Hypothesis::GetId(), Moses::Manager::GetSentenceStats(), Moses::Hypothesis::GetTotalScore(), Moses::Hypothesis::GetWordsBitmap(), GetWorstScoreForBitmap(), Moses::StaticData::Instance(), Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_minHypoStackDiversity, m_nBestIsEnabled, m_worstScore, Moses::HypothesisStack::Remove(), TRACE_ERR, and VERBOSE.

| 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().


| 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().


| 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().

| float Moses::HypothesisStackNormal::GetWorstScore | ( | ) | const [inline, virtual] |
| float Moses::HypothesisStackNormal::GetWorstScoreForBitmap | ( | const WordsBitmap & | coverage | ) | [inline] |
References Moses::WordsBitmap::GetID(), and GetWorstScoreForBitmap().

| float Moses::HypothesisStackNormal::GetWorstScoreForBitmap | ( | WordsBitmapID | id | ) | [inline, virtual] |
Reimplemented from Moses::HypothesisStack.
References m_diversityWorstScore.
Referenced by Add(), AddPrune(), and GetWorstScoreForBitmap().

| 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.
| 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().


| 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().

| 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
| beamThreshold | minimum factor (typical number: 0.03) |
References m_beamWidth.
Referenced by Moses::SearchNormal::SearchNormal().

| void Moses::HypothesisStackNormal::SetMaxHypoStackSize | ( | size_t | maxHypoStackSize, | |
| size_t | minHypoStackDiversity | |||
| ) | [inline] |
set maximum number of hypotheses in the collection
| maxHypoStackSize | maximum number (typical number: 100) | |
| maxHypoStackSize | maximum number (defauly: 0) |
References m_maxHypoStackSize, and m_minHypoStackDiversity.
Referenced by Moses::SearchNormal::SearchNormal().

| void Moses::HypothesisStackNormal::SetWorstScoreForBitmap | ( | WordsBitmapID | id, | |
| float | worstScore | |||
| ) | [inline, protected] |
References m_diversityWorstScore.
Referenced by Add(), and PruneToSize().

| Moses::HypothesisStackNormal::TO_STRING | ( | ) |
| std::ostream& operator<< | ( | std::ostream & | out, | |
| const HypothesisStackNormal & | hypoColl | |||
| ) | [friend] |
float Moses::HypothesisStackNormal::m_beamWidth [protected] |
minimum score due to threashold pruning
Referenced by Add(), PruneToSize(), and SetBeamWidth().
float Moses::HypothesisStackNormal::m_bestScore [protected] |
score of the best hypothesis in collection
Referenced by Add(), GetBestScore(), HypothesisStackNormal(), and PruneToSize().
std::map< WordsBitmapID, float > Moses::HypothesisStackNormal::m_diversityWorstScore [protected] |
score of worst hypothesis for particular source word coverage
Referenced by GetWorstScoreForBitmap(), and SetWorstScoreForBitmap().
size_t Moses::HypothesisStackNormal::m_maxHypoStackSize [protected] |
maximum number of hypothesis allowed in this stack
Referenced by Add(), and SetMaxHypoStackSize().
size_t Moses::HypothesisStackNormal::m_minHypoStackDiversity [protected] |
minimum number of hypothesis with different source word coverage
Referenced by Add(), AddPrune(), PruneToSize(), and SetMaxHypoStackSize().
bool Moses::HypothesisStackNormal::m_nBestIsEnabled [protected] |
flag to determine whether to keep track of old arcs
Referenced by AddPrune(), CleanupArcList(), and HypothesisStackNormal().
float Moses::HypothesisStackNormal::m_worstScore [protected] |
score of the worse hypothesis in collection
Referenced by Add(), AddPrune(), GetWorstScore(), HypothesisStackNormal(), and PruneToSize().
1.5.9