Moses::Manager Class Reference

#include <Manager.h>

Collaboration diagram for Moses::Manager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Manager (size_t lineNumber, InputType const &source, SearchAlgorithm searchAlgorithm)
 ~Manager ()
const TranslationOptionCollectiongetSntTranslationOptions ()
void ProcessSentence ()
const HypothesisGetBestHypothesis () const
const HypothesisGetActualBestHypothesis () 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 InputTypeGetSource () const
void CalcDecoderStatistics () const
void ResetSentenceStats (const InputType &source)
SentenceStatsGetSentenceStats () 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

TranslationOptionCollectionm_transOptColl
Searchm_search
HypothesisStackactual_hypoStack
size_t interrupted_flag
std::auto_ptr< SentenceStatsm_sentenceStats
int m_hypoId
size_t m_lineNumber


Detailed Description

The Manager class implements a stack decoding algorithm for phrase-based decoding Hypotheses are organized in stacks. One stack contains all hypothesis that have the same number of foreign words translated. The data structure for hypothesis stacks is the class HypothesisStack. The data structure for a hypothesis is the class Hypothesis.

The main decoder loop in the function ProcessSentence() consists of the steps:

Definition at line 94 of file Manager.h.


Constructor & Destructor Documentation

Moses::Manager::Manager ( size_t  lineNumber,
InputType const &  source,
SearchAlgorithm  searchAlgorithm 
)

Definition at line 56 of file Manager.cpp.

References Moses::StaticData::InitializeForInput(), and Moses::StaticData::Instance().

Here is the call graph for this function:

Moses::Manager::~Manager (  ) 

Definition at line 67 of file Manager.cpp.

References Moses::StaticData::CleanUpAfterSentenceProcessing(), Moses::StaticData::Instance(), m_search, m_source, and m_transOptColl.

Here is the call graph for this function:


Member Function Documentation

void Moses::Manager::CalcDecoderStatistics (  )  const

void Moses::Manager::CalcLatticeSamples ( size_t  count,
TrellisPathList ret 
) const

Implements lattice sampling, as in Chatterjee & Cancedda, emnlp 2010

Definition at line 276 of file Manager.cpp.

References Moses::TrellisPathList::Add(), CHECK, Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), Moses::Hypothesis::GetScore(), GetSearchGraph(), and Moses::log_sum().

Here is the call graph for this function:

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.

Parameters:
count the number of n-best translations to produce
ret holds the n-best list that was calculated

Definition at line 209 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().

Here is the call graph for this function:

const Hypothesis* Moses::Manager::GetActualBestHypothesis (  )  const

const Hypothesis * Moses::Manager::GetBestHypothesis (  )  const

Definition at line 1429 of file Manager.cpp.

References Moses::Search::GetBestHypothesis(), and m_search.

Referenced by CalcDecoderStatistics(), MosesCmd::doConsensusDecoding(), and MosesCmd::getLatticeMBRNBest().

Here is the call graph for this function:

Here is the caller graph for this function:

void Moses::Manager::GetConnectedGraph ( std::map< int, bool > *  pConnected,
std::vector< const Hypothesis * > *  pConnectedList 
) const [protected]

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

Here is the caller graph for this function:

int Moses::Manager::GetNextHypoId (  ) 

Definition at line 1434 of file Manager.cpp.

References m_hypoId.

void Moses::Manager::GetSearchGraph ( std::vector< SearchGraphNode > &  searchGraph  )  const

Referenced by CalcLatticeSamples(), OutputSearchGraph(), OutputSearchGraphAsHypergraph(), and OutputSearchGraphAsSLF().

Here is the caller graph for this function:

SentenceStats & Moses::Manager::GetSentenceStats (  )  const

const TranslationOptionCollection * Moses::Manager::getSntTranslationOptions (  ) 

Definition at line 140 of file Manager.cpp.

References m_transOptColl.

const InputType& Moses::Manager::GetSource (  )  const [inline]

Definition at line 156 of file Manager.h.

References m_source.

Referenced by Moses::HypothesisStackCubePruning::SetBitmapAccessor().

Here is the caller graph for this function:

void Moses::Manager::GetWinnerConnectedGraph ( std::map< int, bool > *  pConnected,
std::vector< const Hypothesis * > *  pConnectedList 
) const [protected]

void Moses::Manager::GetWordGraph ( long  translationId,
std::ostream &  outputWordGraphStream 
) const

void Moses::Manager::OutputSearchGraph ( long  translationId,
std::ostream &  outputSearchGraphStream 
) const

Definition at line 1342 of file Manager.cpp.

References GetSearchGraph(), and Moses::OutputSearchNode().

Here is the call graph for this function:

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 845 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.

Here is the call graph for this function:

void Moses::Manager::OutputSearchGraphAsSLF ( long  translationId,
std::ostream &  outputSearchGraphStream 
) const

! Output search graph in HTK standard lattice format (SLF)

Definition at line 994 of file Manager.cpp.

References Moses::Hypothesis::GetCurrTargetPhrase(), Moses::Hypothesis::GetId(), Moses::Hypothesis::GetPrevHypo(), GetSearchGraph(), Moses::Phrase::GetSize(), and Moses::Phrase::GetWord().

Here is the call graph for this function:

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

void Moses::Manager::ResetSentenceStats ( const InputType source  ) 

Definition at line 1439 of file Manager.cpp.

References m_sentenceStats.

Referenced by ProcessSentence().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 118 of file Manager.h.

actual (full expanded) stack of hypotheses

Definition at line 119 of file Manager.h.

int Moses::Manager::m_hypoId [protected]

Definition at line 121 of file Manager.h.

Referenced by GetNextHypoId().

size_t Moses::Manager::m_lineNumber [protected]

Definition at line 122 of file Manager.h.

Referenced by ProcessSentence().

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


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

Generated on Fri Oct 31 00:31:40 2014 for Moses by  doxygen 1.5.9