Moses::Manager Class Reference

#include <Manager.h>

Collaboration diagram for Moses::Manager:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Manager (InputType const &source, SearchAlgorithm searchAlgorithm, const TranslationSystem *system)
 ~Manager ()
const TranslationOptionCollectiongetSntTranslationOptions ()
const TranslationSystemGetTranslationSystem ()
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 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
clock_t m_start
size_t interrupted_flag
std::auto_ptr< SentenceStatsm_sentenceStats
int m_hypoId


Detailed Description

The Manager class implements a stack decoding algorithm. 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 91 of file Manager.h.


Constructor & Destructor Documentation

Moses::Manager::Manager ( InputType const &  source,
SearchAlgorithm  searchAlgorithm,
const TranslationSystem system 
)

Definition at line 51 of file Manager.cpp.

References Moses::TranslationSystem::InitializeBeforeSentenceProcessing().

Here is the call graph for this function:

Moses::Manager::~Manager (  ) 

Definition at line 63 of file Manager.cpp.

References Moses::TranslationSystem::CleanUpAfterSentenceProcessing(), end, m_search, m_start, m_transOptColl, and VERBOSE.

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 267 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 200 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 977 of file Manager.cpp.

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

Referenced by CalcDecoderStatistics(), doConsensusDecoding(), and 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 doConsensusDecoding(), and getLatticeMBRNBest().

Here is the caller graph for this function:

int Moses::Manager::GetNextHypoId (  ) 

Definition at line 982 of file Manager.cpp.

References m_hypoId.

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

Referenced by CalcLatticeSamples(), and OutputSearchGraph().

Here is the caller graph for this function:

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

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

Definition at line 131 of file Manager.cpp.

References m_transOptColl.

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

Definition at line 142 of file Manager.h.

References m_source.

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

Here is the caller graph for this function:

const TranslationSystem* Moses::Manager::GetTranslationSystem (  )  [inline]

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 890 of file Manager.cpp.

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

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

Main decoder loop that translates a sentence by expanding hypotheses stack by stack, until the end of the sentence.

Definition at line 81 of file Manager.cpp.

References Moses::SentenceStats::AddTimeCollectOpts(), Moses::TranslationOptionCollection::CreateTranslationOptions(), GetSentenceStats(), IFVERBOSE, Moses::TranslationSystem::InitializeBeforeSentenceProcessing(), m_search, m_source, m_start, m_transOptColl, Moses::Search::ProcessSentence(), ResetSentenceStats(), and VERBOSE.

Here is the call graph for this function:

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

Definition at line 987 of file Manager.cpp.

References m_sentenceStats.

Referenced by ProcessSentence().

Here is the caller graph for this function:


Member Data Documentation

Definition at line 103 of file Manager.h.

Definition at line 105 of file Manager.h.

int Moses::Manager::m_hypoId [protected]

Definition at line 107 of file Manager.h.

Referenced by GetNextHypoId().

std::auto_ptr<SentenceStats> Moses::Manager::m_sentenceStats [protected]

Definition at line 106 of file Manager.h.

Referenced by GetSentenceStats(), and ResetSentenceStats().

source sentence to be translated

Definition at line 118 of file Manager.h.

Referenced by GetSource(), and ProcessSentence().

clock_t Moses::Manager::m_start [protected]

actual (full expanded) stack of hypotheses starting time, used for logging

Definition at line 104 of file Manager.h.

Referenced by ProcessSentence(), and ~Manager().

pre-computed list of translation options for the phrases in this sentence

Definition at line 100 of file Manager.h.

Referenced by getSntTranslationOptions(), ProcessSentence(), and ~Manager().


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

Generated on Wed Feb 8 08:04:09 2012 for Moses by  doxygen 1.5.9