#include <HypothesisStackCubePruning.h>


Public Member Functions | |
| HypothesisStackCubePruning (Manager &manager) | |
| ~HypothesisStackCubePruning () | |
| bool | AddPrune (Hypothesis *hypothesis) |
| void | AddInitial (Hypothesis *hypo) |
| void | SetMaxHypoStackSize (size_t maxHypoStackSize) |
| size_t | GetMaxHypoStackSize () const |
| void | SetBeamWidth (float beamWidth) |
| float | GetBestScore () const |
| float | GetWorstScore () const |
| void | AddHypothesesToBitmapContainers () |
| const _BMType & | GetBitmapAccessor () const |
| void | SetBitmapAccessor (const WordsBitmap &newBitmap, HypothesisStackCubePruning &stack, const WordsRange &range, BitmapContainer &bitmapContainer, const SquareMatrix &futureScore, const TranslationOptionList &transOptList) |
| 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 | |
| void | CleanupArcList () |
| TO_STRING () | |
Protected Member Functions | |
| std::pair < HypothesisStackCubePruning::iterator, bool > | Add (Hypothesis *hypothesis) |
| void | RemoveAll () |
Protected Attributes | |
| _BMType | m_bitmapAccessor |
| float | m_bestScore |
| float | m_worstScore |
| float | m_beamWidth |
| size_t | m_maxHypoStackSize |
| bool | m_nBestIsEnabled |
Friends | |
| std::ostream & | operator<< (std::ostream &, const HypothesisStackCubePruning &) |
Definition at line 42 of file HypothesisStackCubePruning.h.
| Moses::HypothesisStackCubePruning::HypothesisStackCubePruning | ( | Manager & | manager | ) |
Definition at line 35 of file HypothesisStackCubePruning.cpp.
References Moses::StaticData::Instance(), Moses::StaticData::IsNBestEnabled(), m_bestScore, m_nBestIsEnabled, and m_worstScore.

| Moses::HypothesisStackCubePruning::~HypothesisStackCubePruning | ( | ) | [inline] |
Definition at line 66 of file HypothesisStackCubePruning.h.
References m_bitmapAccessor, and RemoveAll().

| pair< HypothesisStackCubePruning::iterator, bool > Moses::HypothesisStackCubePruning::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 53 of file HypothesisStackCubePruning.cpp.
References Moses::Hypothesis::GetTotalScore(), m_beamWidth, m_bestScore, Moses::HypothesisStack::m_hypos, m_maxHypoStackSize, m_worstScore, PruneToSize(), and VERBOSE.
Referenced by AddInitial(), and AddPrune().


| void Moses::HypothesisStackCubePruning::AddHypothesesToBitmapContainers | ( | ) |
Definition at line 283 of file HypothesisStackCubePruning.cpp.
References Moses::BitmapContainer::AddHypothesis(), Moses::Hypothesis::GetWordsBitmap(), m_bitmapAccessor, and Moses::HypothesisStack::m_hypos.
Referenced by Moses::SearchCubePruning::CreateForwardTodos().


| void Moses::HypothesisStackCubePruning::AddInitial | ( | Hypothesis * | hypo | ) |
Definition at line 137 of file HypothesisStackCubePruning.cpp.
References Add(), CHECK, Moses::Hypothesis::GetWordsBitmap(), and m_bitmapAccessor.
Referenced by Moses::SearchCubePruning::ProcessSentence().


| bool Moses::HypothesisStackCubePruning::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 82 of file HypothesisStackCubePruning.cpp.
References Add(), Moses::Hypothesis::AddArc(), Moses::SentenceStats::AddDiscarded(), Moses::SentenceStats::AddRecombination(), CHECK, Moses::HypothesisStack::Detach(), FREEHYPO, Moses::Hypothesis::GetId(), Moses::Manager::GetSentenceStats(), Moses::Hypothesis::GetTotalScore(), Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_nBestIsEnabled, m_worstScore, Moses::HypothesisStack::Remove(), TRACE_ERR, and VERBOSE.
Referenced by Moses::BitmapContainer::ProcessBestHypothesis().


| void Moses::HypothesisStackCubePruning::CleanupArcList | ( | ) |
make all arcs in point to the equiv hypothesis that contains them. Ie update doubly linked list be hypo & arcs
Definition at line 228 of file HypothesisStackCubePruning.cpp.
References Moses::Hypothesis::CleanupArcList(), Moses::HypothesisStack::m_hypos, and m_nBestIsEnabled.
Referenced by Moses::SearchCubePruning::ProcessSentence().


| const Hypothesis * Moses::HypothesisStackCubePruning::GetBestHypothesis | ( | ) | const [virtual] |
return the hypothesis with best score. Used to get the translated at end of decoding
Implements Moses::HypothesisStack.
Definition at line 202 of file HypothesisStackCubePruning.cpp.
References Moses::Hypothesis::GetTotalScore(), Moses::HypothesisStack::m_hypos, and NULL.

| float Moses::HypothesisStackCubePruning::GetBestScore | ( | ) | const [inline] |
return score of the best hypothesis in the stack
Definition at line 103 of file HypothesisStackCubePruning.h.
References m_bestScore.
| const _BMType& Moses::HypothesisStackCubePruning::GetBitmapAccessor | ( | ) | const [inline] |
Definition at line 114 of file HypothesisStackCubePruning.h.
References m_bitmapAccessor.
Referenced by Moses::SearchCubePruning::CreateForwardTodos(), Moses::SearchCubePruning::PrintBitmapContainerGraph(), and Moses::SearchCubePruning::ProcessSentence().

| size_t Moses::HypothesisStackCubePruning::GetMaxHypoStackSize | ( | ) | const [inline] |
| vector< const Hypothesis * > Moses::HypothesisStackCubePruning::GetSortedList | ( | ) | const [virtual] |
return all hypothesis, sorted by descending score. Used in creation of N best list
Implements Moses::HypothesisStack.
Definition at line 217 of file HypothesisStackCubePruning.cpp.
References Moses::HypothesisStack::m_hypos.
| float Moses::HypothesisStackCubePruning::GetWorstScore | ( | ) | const [inline, virtual] |
return worst score allowed for the stack
Reimplemented from Moses::HypothesisStack.
Definition at line 108 of file HypothesisStackCubePruning.h.
References m_worstScore.
| void Moses::HypothesisStackCubePruning::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 |
Definition at line 146 of file HypothesisStackCubePruning.cpp.
References Moses::SentenceStats::AddPruning(), Moses::Hypothesis::GetId(), Moses::Manager::GetSentenceStats(), Moses::Hypothesis::GetTotalScore(), IFVERBOSE, m_beamWidth, m_bestScore, Moses::HypothesisStack::m_hypos, Moses::HypothesisStack::m_manager, m_worstScore, Moses::HypothesisStack::Remove(), Moses::HypothesisStack::size(), TRACE_ERR, and VERBOSE.
Referenced by Add(), and Moses::SearchCubePruning::ProcessSentence().


| void Moses::HypothesisStackCubePruning::RemoveAll | ( | ) | [protected] |
destroy all instances of Hypothesis in this collection
remove all hypotheses from the collection
Definition at line 44 of file HypothesisStackCubePruning.cpp.
References m_bitmapAccessor.
Referenced by ~HypothesisStackCubePruning().

| void Moses::HypothesisStackCubePruning::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) |
Definition at line 98 of file HypothesisStackCubePruning.h.
References m_beamWidth.
Referenced by Moses::SearchCubePruning::SearchCubePruning().

| void Moses::HypothesisStackCubePruning::SetBitmapAccessor | ( | const WordsBitmap & | newBitmap, | |
| HypothesisStackCubePruning & | stack, | |||
| const WordsRange & | range, | |||
| BitmapContainer & | bitmapContainer, | |||
| const SquareMatrix & | futureScore, | |||
| const TranslationOptionList & | transOptList | |||
| ) |
Definition at line 240 of file HypothesisStackCubePruning.cpp.
References Moses::BitmapContainer::AddBackwardsEdge(), Moses::Manager::GetSource(), m_bitmapAccessor, and Moses::HypothesisStack::m_manager.
Referenced by Moses::SearchCubePruning::CreateForwardTodos().


| void Moses::HypothesisStackCubePruning::SetMaxHypoStackSize | ( | size_t | maxHypoStackSize | ) | [inline] |
set maximum number of hypotheses in the collection
| maxHypoStackSize | maximum number (typical number: 100) |
Definition at line 86 of file HypothesisStackCubePruning.h.
References m_maxHypoStackSize.
Referenced by Moses::SearchCubePruning::SearchCubePruning().

| Moses::HypothesisStackCubePruning::TO_STRING | ( | ) |
| std::ostream& operator<< | ( | std::ostream & | out, | |
| const HypothesisStackCubePruning & | hypoColl | |||
| ) | [friend] |
Definition at line 270 of file HypothesisStackCubePruning.cpp.
float Moses::HypothesisStackCubePruning::m_beamWidth [protected] |
minimum score due to threashold pruning
Definition at line 52 of file HypothesisStackCubePruning.h.
Referenced by Add(), PruneToSize(), and SetBeamWidth().
float Moses::HypothesisStackCubePruning::m_bestScore [protected] |
score of the best hypothesis in collection
Definition at line 50 of file HypothesisStackCubePruning.h.
Referenced by Add(), GetBestScore(), HypothesisStackCubePruning(), and PruneToSize().
Definition at line 48 of file HypothesisStackCubePruning.h.
Referenced by AddHypothesesToBitmapContainers(), AddInitial(), GetBitmapAccessor(), RemoveAll(), SetBitmapAccessor(), and ~HypothesisStackCubePruning().
size_t Moses::HypothesisStackCubePruning::m_maxHypoStackSize [protected] |
maximum number of hypothesis allowed in this stack
Definition at line 53 of file HypothesisStackCubePruning.h.
Referenced by Add(), GetMaxHypoStackSize(), and SetMaxHypoStackSize().
bool Moses::HypothesisStackCubePruning::m_nBestIsEnabled [protected] |
flag to determine whether to keep track of old arcs
Definition at line 54 of file HypothesisStackCubePruning.h.
Referenced by AddPrune(), CleanupArcList(), and HypothesisStackCubePruning().
float Moses::HypothesisStackCubePruning::m_worstScore [protected] |
score of the worse hypthesis in collection
Definition at line 51 of file HypothesisStackCubePruning.h.
Referenced by Add(), AddPrune(), GetWorstScore(), HypothesisStackCubePruning(), and PruneToSize().
1.5.9