#include <Manager.h>

Public Member Functions | |
| Manager (size_t lineNumber, InputType const &source, SearchAlgorithm searchAlgorithm) | |
| ~Manager () | |
| const TranslationOptionCollection * | getSntTranslationOptions () |
| void | ProcessSentence () |
| const Hypothesis * | GetBestHypothesis () const |
| const Hypothesis * | GetActualBestHypothesis () const |
| void | CalcNBest (size_t count, TrellisPathList &ret, bool onlyDistinct=0) const |
| void | CalcLatticeSamples (size_t count, TrellisPathList &ret) const |
| void | PrintAllDerivations (long translationId, std::ostream &outputStream) const |
| void | printDivergentHypothesis (long translationId, const Hypothesis *hypo, const std::vector< const TargetPhrase * > &remainingPhrases, float remainingScore, std::ostream &outputStream) const |
| void | printThisHypothesis (long translationId, const Hypothesis *hypo, const std::vector< const TargetPhrase * > &remainingPhrases, float remainingScore, std::ostream &outputStream) const |
| void | GetWordGraph (long translationId, std::ostream &outputWordGraphStream) const |
| int | GetNextHypoId () |
| void | OutputSearchGraph (long translationId, std::ostream &outputSearchGraphStream) const |
| void | OutputSearchGraphAsSLF (long translationId, std::ostream &outputSearchGraphStream) const |
| void | OutputSearchGraphAsHypergraph (long translationId, std::ostream &outputSearchGraphStream) const |
| void | GetSearchGraph (std::vector< SearchGraphNode > &searchGraph) const |
| const InputType & | GetSource () const |
| void | CalcDecoderStatistics () const |
| void | ResetSentenceStats (const InputType &source) |
| SentenceStats & | GetSentenceStats () const |
| void | GetForwardBackwardSearchGraph (std::map< int, bool > *pConnected, std::vector< const Hypothesis * > *pConnectedList, std::map< const Hypothesis *, std::set< const Hypothesis * > > *pOutgoingHyps, std::vector< float > *pFwdBwdScores) const |
Public Attributes | |
| InputType const & | m_source |
Protected Member Functions | |
| void | GetConnectedGraph (std::map< int, bool > *pConnected, std::vector< const Hypothesis * > *pConnectedList) const |
| void | GetWinnerConnectedGraph (std::map< int, bool > *pConnected, std::vector< const Hypothesis * > *pConnectedList) const |
Protected Attributes | |
| TranslationOptionCollection * | m_transOptColl |
| Search * | m_search |
| HypothesisStack * | actual_hypoStack |
| size_t | interrupted_flag |
| std::auto_ptr< SentenceStats > | m_sentenceStats |
| int | m_hypoId |
| size_t | m_lineNumber |
The main decoder loop in the function ProcessSentence() consists of the steps:
Definition at line 94 of file Manager.h.
| Moses::Manager::Manager | ( | size_t | lineNumber, | |
| InputType const & | source, | |||
| SearchAlgorithm | searchAlgorithm | |||
| ) |
Definition at line 57 of file Manager.cpp.
References Moses::StaticData::InitializeForInput(), and Moses::StaticData::Instance().

| Moses::Manager::~Manager | ( | ) |
Definition at line 68 of file Manager.cpp.
References Moses::StaticData::CleanUpAfterSentenceProcessing(), Moses::StaticData::Instance(), m_search, m_source, and m_transOptColl.

| void Moses::Manager::CalcDecoderStatistics | ( | ) | const |
Definition at line 406 of file Manager.cpp.
References Moses::SentenceStats::CalcFinalStats(), GetBestHypothesis(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetInput(), Moses::Hypothesis::GetPrevHypo(), GetSentenceStats(), IFVERBOSE, NULL, and TRACE_ERR.

| void Moses::Manager::CalcLatticeSamples | ( | size_t | count, | |
| TrellisPathList & | ret | |||
| ) | const |
Implements lattice sampling, as in Chatterjee & Cancedda, emnlp 2010
Definition at line 266 of file Manager.cpp.
References Moses::TrellisPathList::Add(), CHECK, Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), Moses::Hypothesis::GetScore(), GetSearchGraph(), and Moses::log_sum().

| void Moses::Manager::CalcNBest | ( | size_t | count, | |
| TrellisPathList & | ret, | |||
| bool | onlyDistinct = 0 | |||
| ) | const |
After decoding, the hypotheses in the stacks and additional arcs form a search graph that can be mined for n-best lists. The heavy lifting is done in the TrellisPath and TrellisPathCollection this function controls this for one sentence.
| count | the number of n-best translations to produce | |
| ret | holds the n-best list that was calculated |
Definition at line 199 of file Manager.cpp.
References Moses::TrellisPathList::Add(), Moses::TrellisPathCollection::Add(), CHECK, Moses::TrellisPath::CreateDeviantPaths(), Moses::Search::GetHypothesisStacks(), Moses::StaticData::GetNBestFactor(), Moses::TrellisPathCollection::GetSize(), Moses::TrellisPathList::GetSize(), Moses::TrellisPath::GetSurfacePhrase(), Moses::StaticData::Instance(), m_search, NULL, Moses::TrellisPathCollection::pop(), and Moses::TrellisPathCollection::Prune().

| const Hypothesis* Moses::Manager::GetActualBestHypothesis | ( | ) | const |
| const Hypothesis * Moses::Manager::GetBestHypothesis | ( | ) | const |
Definition at line 1417 of file Manager.cpp.
References Moses::Search::GetBestHypothesis(), and m_search.
Referenced by CalcDecoderStatistics(), MosesCmd::doConsensusDecoding(), and MosesCmd::getLatticeMBRNBest().


| void Moses::Manager::GetConnectedGraph | ( | std::map< int, bool > * | pConnected, | |
| std::vector< const Hypothesis * > * | pConnectedList | |||
| ) | const [protected] |
Definition at line 1141 of file Manager.cpp.
References Moses::HypothesisStack::begin(), Moses::HypothesisStack::end(), Moses::Hypothesis::GetArcList(), Moses::Search::GetHypothesisStacks(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), m_search, and NULL.

| void Moses::Manager::GetForwardBackwardSearchGraph | ( | std::map< int, bool > * | pConnected, | |
| std::vector< const Hypothesis * > * | pConnectedList, | |||
| std::map< const Hypothesis *, std::set< const Hypothesis * > > * | pOutgoingHyps, | |||
| std::vector< float > * | pFwdBwdScores | |||
| ) | const |
Referenced by MosesCmd::doConsensusDecoding(), and MosesCmd::getLatticeMBRNBest().

| int Moses::Manager::GetNextHypoId | ( | ) |
| void Moses::Manager::GetSearchGraph | ( | std::vector< SearchGraphNode > & | searchGraph | ) | const |
Referenced by CalcLatticeSamples(), OutputSearchGraph(), OutputSearchGraphAsHypergraph(), and OutputSearchGraphAsSLF().

| SentenceStats & Moses::Manager::GetSentenceStats | ( | ) | const |
Definition at line 1431 of file Manager.cpp.
References m_sentenceStats.
Referenced by Moses::HypothesisStackNormal::AddPrune(), Moses::HypothesisStackCubePruning::AddPrune(), CalcDecoderStatistics(), Moses::Hypothesis::CalcScore(), Moses::LanguageModelImplementation::Evaluate(), Moses::SearchNormalBatch::ExpandHypothesis(), Moses::SearchNormal::ExpandHypothesis(), Moses::Hypothesis::Hypothesis(), Moses::SearchNormalBatch::ProcessSentence(), Moses::SearchNormal::ProcessSentence(), Moses::SearchCubePruning::ProcessSentence(), ProcessSentence(), Moses::HypothesisStackNormal::PruneToSize(), and Moses::HypothesisStackCubePruning::PruneToSize().

| const TranslationOptionCollection * Moses::Manager::getSntTranslationOptions | ( | ) |
| const InputType& Moses::Manager::GetSource | ( | ) | const [inline] |
Definition at line 156 of file Manager.h.
References m_source.
Referenced by Moses::HypothesisStackCubePruning::SetBitmapAccessor().

| void Moses::Manager::GetWinnerConnectedGraph | ( | std::map< int, bool > * | pConnected, | |
| std::vector< const Hypothesis * > * | pConnectedList | |||
| ) | const [protected] |
Definition at line 1184 of file Manager.cpp.
References Moses::HypothesisStack::begin(), Moses::HypothesisStack::end(), Moses::Hypothesis::GetArcList(), Moses::Search::GetHypothesisStacks(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), m_search, and NULL.

| void Moses::Manager::GetWordGraph | ( | long | translationId, | |
| std::ostream & | outputWordGraphStream | |||
| ) | const |
Definition at line 521 of file Manager.cpp.
References Moses::HypothesisStack::begin(), Moses::HypothesisStack::end(), Moses::Hypothesis::GetArcList(), Moses::Search::GetHypothesisStacks(), Moses::StaticData::GetParam(), Moses::StaticData::Instance(), m_search, NULL, Moses::OutputWordGraph(), and Moses::Scan< bool >().

| void Moses::Manager::OutputSearchGraph | ( | long | translationId, | |
| std::ostream & | outputSearchGraphStream | |||
| ) | const |
Definition at line 1330 of file Manager.cpp.
References GetSearchGraph(), and Moses::OutputSearchNode().

| void Moses::Manager::OutputSearchGraphAsHypergraph | ( | long | translationId, | |
| std::ostream & | outputSearchGraphStream | |||
| ) | const |
! Output search graph in hypergraph format of Kenneth Heafield's lazy hypergraph decoder
Definition at line 833 of file Manager.cpp.
References count, Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), GetSearchGraph(), Moses::Phrase::GetSize(), Moses::Phrase::GetWord(), NULL, UTIL_THROW_IF, and VERBOSE.

| void Moses::Manager::OutputSearchGraphAsSLF | ( | long | translationId, | |
| std::ostream & | outputSearchGraphStream | |||
| ) | const |
! Output search graph in HTK standard lattice format (SLF)
Definition at line 982 of file Manager.cpp.
References Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), GetSearchGraph(), Moses::Phrase::GetSize(), and Moses::Phrase::GetWord().

| void Moses::Manager::PrintAllDerivations | ( | long | translationId, | |
| std::ostream & | outputStream | |||
| ) | const |
| void Moses::Manager::printDivergentHypothesis | ( | long | translationId, | |
| const Hypothesis * | hypo, | |||
| const std::vector< const TargetPhrase * > & | remainingPhrases, | |||
| float | remainingScore, | |||
| std::ostream & | outputStream | |||
| ) | const |
| void Moses::Manager::printThisHypothesis | ( | long | translationId, | |
| const Hypothesis * | hypo, | |||
| const std::vector< const TargetPhrase * > & | remainingPhrases, | |||
| float | remainingScore, | |||
| std::ostream & | outputStream | |||
| ) | const |
| void Moses::Manager::ProcessSentence | ( | ) |
Main decoder loop that translates a sentence by expanding hypotheses stack by stack, until the end of the sentence.
Definition at line 80 of file Manager.cpp.
References Moses::SentenceStats::AddTimeCollectOpts(), Moses::TranslationOptionCollection::CreateTranslationOptions(), Moses::Timer::get_elapsed_time(), GetSentenceStats(), IFVERBOSE, m_lineNumber, m_search, m_source, m_transOptColl, Moses::Search::ProcessSentence(), ResetSentenceStats(), Moses::Timer::start(), and VERBOSE.

| void Moses::Manager::ResetSentenceStats | ( | const InputType & | source | ) |
Definition at line 1427 of file Manager.cpp.
References m_sentenceStats.
Referenced by ProcessSentence().

HypothesisStack* Moses::Manager::actual_hypoStack [protected] |
size_t Moses::Manager::interrupted_flag [protected] |
int Moses::Manager::m_hypoId [protected] |
size_t Moses::Manager::m_lineNumber [protected] |
Search* Moses::Manager::m_search [protected] |
Definition at line 116 of file Manager.h.
Referenced by CalcNBest(), GetBestHypothesis(), GetConnectedGraph(), GetWinnerConnectedGraph(), GetWordGraph(), ProcessSentence(), and ~Manager().
std::auto_ptr<SentenceStats> Moses::Manager::m_sentenceStats [protected] |
Definition at line 120 of file Manager.h.
Referenced by GetSentenceStats(), and ResetSentenceStats().
source sentence to be translated
Definition at line 133 of file Manager.h.
Referenced by GetSource(), ProcessSentence(), and ~Manager().
pre-computed list of translation options for the phrases in this sentence
Definition at line 115 of file Manager.h.
Referenced by getSntTranslationOptions(), ProcessSentence(), and ~Manager().
1.5.9