#include <ChartCell.h>
Public Types | |
typedef std::map< Word, ChartHypothesisCollection > | MapType |
Public Member Functions | |
ChartCell (size_t startPos, size_t endPos, ChartManager &manager) | |
~ChartCell () | |
void | Decode (const ChartTranslationOptionList &transOptList, const ChartCellCollection &allChartCells) |
const HypoList * | GetSortedHypotheses (const Word &constituentLabel) const |
Get all hypotheses in the cell that have the specified constituent label. | |
const HypoList * | GetAllSortedHypotheses () const |
for n-best list | |
bool | AddHypothesis (ChartHypothesis *hypo) |
void | SortHypotheses () |
call SortHypotheses() in each hypo collection in this cell | |
void | PruneToSize () |
const ChartHypothesis * | GetBestHypothesis () const |
void | CleanupArcList () |
call CleanupArcList() in each hypo collection in this cell | |
void | OutputSizes (std::ostream &out) const |
debug info - size of each hypo collection in this cell | |
size_t | GetSize () const |
debug info - total number of hypos in all hypo collection in this cell | |
void | WriteSearchGraph (const ChartSearchGraphWriter &writer, const std::map< unsigned, bool > &reachable) const |
call WriteSearchGraph() for each hypo collection | |
Protected Attributes | |
MapType | m_hypoColl |
bool | m_nBestIsEnabled |
ChartManager & | m_manager |
Friends | |
std::ostream & | operator<< (std::ostream &, const ChartCell &) |
Definition at line 75 of file ChartCell.h.
typedef std::map<Word, ChartHypothesisCollection> Moses::ChartCell::MapType |
Definition at line 86 of file ChartCell.h.
Moses::ChartCell::ChartCell | ( | size_t | startPos, | |
size_t | endPos, | |||
ChartManager & | manager | |||
) |
Constructor
startPos | endPos range of this cell | |
manager | pointer back to the manager |
Definition at line 50 of file ChartCell.cpp.
References m_nBestIsEnabled, and Moses::BaseManager::options().
Moses::ChartCell::~ChartCell | ( | ) |
Definition at line 56 of file ChartCell.cpp.
bool Moses::ChartCell::AddHypothesis | ( | ChartHypothesis * | hypo | ) |
Add the given hypothesis to the cell. Returns true if added, false if not. Maybe it already exists in the collection or score falls below threshold etc. This function just calls the corresponding AddHypothesis() in ChartHypothesisCollection
hypo | Hypothesis to be added |
Definition at line 63 of file ChartCell.cpp.
References Moses::ChartHypothesis::GetTargetLHS(), m, m_hypoColl, m_manager, and Moses::BaseManager::options().
Referenced by Moses::ChartManager::AddXmlChartOptions(), and Decode().
void Moses::ChartCell::CleanupArcList | ( | ) |
call CleanupArcList() in each hypo collection in this cell
Definition at line 149 of file ChartCell.cpp.
References Moses::ChartHypothesisCollection::CleanupArcList(), m_hypoColl, and m_nBestIsEnabled.
Referenced by Moses::ChartManager::Decode().
void Moses::ChartCell::Decode | ( | const ChartTranslationOptionList & | transOptList, | |
const ChartCellCollection & | allChartCells | |||
) |
Decoding at span level: fill chart cell with hypotheses (implementation of cube pruning)
transOptList | list of applicable rules to create hypotheses for the cell | |
allChartCells | entire chart - needed to look up underlying hypotheses |
Definition at line 90 of file ChartCell.cpp.
References Moses::RuleCubeQueue::Add(), AddHypothesis(), Moses::ChartTranslationOptionList::Get(), Moses::ChartTranslationOptionList::GetSize(), Moses::RuleCubeQueue::IsEmpty(), m_manager, Moses::BaseManager::options(), and Moses::RuleCubeQueue::Pop().
Referenced by Moses::ChartManager::Decode().
const HypoList * Moses::ChartCell::GetAllSortedHypotheses | ( | ) | const |
for n-best list
Definition at line 187 of file ChartCell.cpp.
References Moses::ChartHypothesisCollection::GetSortedHypotheses(), and m_hypoColl.
const ChartHypothesis * Moses::ChartCell::GetBestHypothesis | ( | ) | const |
Return the highest scoring hypothesis out of all the hypo collection in this cell
Definition at line 128 of file ChartCell.cpp.
References Moses::ChartHypothesis::GetFutureScore(), m_hypoColl, and NULL.
Referenced by Moses::ChartManager::GetBestHypothesis().
size_t Moses::ChartCell::GetSize | ( | ) | const |
debug info - total number of hypos in all hypo collection in this cell
Definition at line 174 of file ChartCell.cpp.
References Moses::ChartHypothesisCollection::GetSize(), and m_hypoColl.
Referenced by Moses::ChartManager::Decode().
const HypoList* Moses::ChartCell::GetSortedHypotheses | ( | const Word & | constituentLabel | ) | const [inline] |
Get all hypotheses in the cell that have the specified constituent label.
Definition at line 103 of file ChartCell.h.
References m_hypoColl, and NULL.
void Moses::ChartCell::OutputSizes | ( | std::ostream & | out | ) | const |
debug info - size of each hypo collection in this cell
Definition at line 162 of file ChartCell.cpp.
References Moses::ChartHypothesisCollection::GetSize(), and m_hypoColl.
void Moses::ChartCell::PruneToSize | ( | ) |
Prune each collection in this cell to a particular size
Definition at line 76 of file ChartCell.cpp.
References m_hypoColl, m_manager, and Moses::ChartHypothesisCollection::PruneToSize().
Referenced by Moses::ChartManager::Decode().
void Moses::ChartCell::SortHypotheses | ( | ) |
call SortHypotheses() in each hypo collection in this cell
Definition at line 112 of file ChartCell.cpp.
References Moses::ChartCellLabelSet::AddConstituent(), Moses::ChartCellLabelSet::Empty(), Moses::ChartHypothesisCollection::GetSize(), Moses::ChartHypothesisCollection::GetSortedHypotheses(), m_hypoColl, Moses::ChartCellBase::m_targetLabelSet, Moses::ChartHypothesisCollection::SortHypotheses(), and UTIL_THROW_IF2.
Referenced by Moses::ChartManager::Decode().
void Moses::ChartCell::WriteSearchGraph | ( | const ChartSearchGraphWriter & | writer, | |
const std::map< unsigned, bool > & | reachable | |||
) | const |
call WriteSearchGraph() for each hypo collection
Definition at line 201 of file ChartCell.cpp.
References m_hypoColl, and Moses::ChartHypothesisCollection::WriteSearchGraph().
std::ostream& operator<< | ( | std::ostream & | out, | |
const ChartCell & | cell | |||
) | [friend] |
Definition at line 210 of file ChartCell.cpp.
MapType Moses::ChartCell::m_hypoColl [protected] |
Definition at line 90 of file ChartCell.h.
Referenced by AddHypothesis(), CleanupArcList(), GetAllSortedHypotheses(), GetBestHypothesis(), GetSize(), GetSortedHypotheses(), Moses::operator<<(), OutputSizes(), PruneToSize(), SortHypotheses(), and WriteSearchGraph().
ChartManager& Moses::ChartCell::m_manager [protected] |
Definition at line 93 of file ChartCell.h.
Referenced by AddHypothesis(), Decode(), and PruneToSize().
bool Moses::ChartCell::m_nBestIsEnabled [protected] |
flag to determine whether to keep track of old arcs
Definition at line 92 of file ChartCell.h.
Referenced by ChartCell(), and CleanupArcList().