#include <SearchNormal.h>


Public Member Functions | |
| SearchNormal (Manager &manager, const InputType &source, const TranslationOptionCollection &transOptColl) | |
| ~SearchNormal () | |
| void | ProcessSentence () |
| void | OutputHypoStackSize () |
| void | OutputHypoStack (int stack) |
| virtual const std::vector < HypothesisStack * > & | GetHypothesisStacks () const |
| virtual const Hypothesis * | GetBestHypothesis () const |
Protected Member Functions | |
| void | ProcessOneHypothesis (const Hypothesis &hypothesis) |
| void | ExpandAllHypotheses (const Hypothesis &hypothesis, size_t startPos, size_t endPos) |
| virtual void | ExpandHypothesis (const Hypothesis &hypothesis, const TranslationOption &transOpt, float expectedScore) |
Protected Attributes | |
| const InputType & | m_source |
| std::vector< HypothesisStack * > | m_hypoStackColl |
| TargetPhrase | m_initialTargetPhrase |
| clock_t | m_start |
| size_t | interrupted_flag |
| HypothesisStackNormal * | actual_hypoStack |
| const TranslationOptionCollection & | m_transOptColl |
Definition at line 20 of file SearchNormal.h.
| Moses::SearchNormal::SearchNormal | ( | Manager & | manager, | |
| const InputType & | source, | |||
| const TranslationOptionCollection & | transOptColl | |||
| ) |
Organizing main function
/param source input sentence /param transOptColl collection of translation options to be used for this sentence
Definition at line 15 of file SearchNormal.cpp.
References Moses::StaticData::GetBeamWidth(), Moses::StaticData::GetConstrainingPhrase(), Moses::StaticData::GetMaxHypoStackSize(), Moses::StaticData::GetMinHypoStackDiversity(), Moses::Phrase::GetSize(), Moses::InputType::GetTranslationId(), Moses::StaticData::Instance(), Moses::Search::m_constraint, m_hypoStackColl, m_initialTargetPhrase, Moses::Search::m_manager, m_source, Moses::HypothesisStackNormal::SetBeamWidth(), Moses::HypothesisStackNormal::SetMaxHypoStackSize(), and VERBOSE.

| Moses::SearchNormal::~SearchNormal | ( | ) |
Definition at line 49 of file SearchNormal.cpp.
References m_hypoStackColl, and Moses::RemoveAllInColl().

| void Moses::SearchNormal::ExpandAllHypotheses | ( | const Hypothesis & | hypothesis, | |
| size_t | startPos, | |||
| size_t | endPos | |||
| ) | [protected] |
Expand a hypothesis given a list of translation options
| hypothesis | hypothesis to be expanded upon | |
| startPos | first word position of span covered | |
| endPos | last word position of span covered |
Definition at line 258 of file SearchNormal.cpp.
References Moses::TranslationOptionList::begin(), Moses::SquareMatrix::CalcFutureScore(), Moses::TranslationOptionList::end(), ExpandHypothesis(), Moses::TranslationOptionCollection::GetFutureScore(), Moses::Hypothesis::GetScore(), Moses::TranslationOptionCollection::GetTranslationOptionList(), Moses::Hypothesis::GetWordsBitmap(), Moses::StaticData::Instance(), and m_transOptColl.
Referenced by ProcessOneHypothesis().


| void Moses::SearchNormal::ExpandHypothesis | ( | const Hypothesis & | hypothesis, | |
| const TranslationOption & | transOpt, | |||
| float | expectedScore | |||
| ) | [protected, virtual] |
Expand one hypothesis with a translation option. this involves initial creation, scoring and adding it to the proper stack
| hypothesis | hypothesis to be expanded upon | |
| transOpt | translation option (phrase translation) that is applied to create the new hypothesis | |
| expectedScore | base score for early discarding (base hypothesis score plus future score estimation) |
Reimplemented in Moses::SearchNormalBatch.
Definition at line 288 of file SearchNormal.cpp.
References Moses::SentenceStats::AddEarlyDiscarded(), Moses::SentenceStats::AddNotBuilt(), Moses::SentenceStats::AddTimeBuildHyp(), Moses::SentenceStats::AddTimeStack(), Moses::Hypothesis::CalcScore(), Moses::Hypothesis::CreateNext(), FREEHYPO, Moses::StaticData::GetEarlyDiscardingThreshold(), Moses::TranslationOption::GetEndPos(), Moses::TranslationOption::GetFutureScore(), Moses::TranslationOptionCollection::GetFutureScore(), Moses::WordsBitmap::GetIDPlus(), Moses::StaticData::GetMinHypoStackDiversity(), Moses::WordsBitmap::GetNumWordsCovered(), Moses::Manager::GetSentenceStats(), Moses::TranslationOption::GetSize(), Moses::TranslationOption::GetStartPos(), Moses::Hypothesis::GetWordsBitmap(), IFVERBOSE, Moses::StaticData::Instance(), Moses::Search::m_constraint, m_hypoStackColl, Moses::Search::m_manager, m_transOptColl, NULL, Moses::Hypothesis::PrintHypothesis(), Moses::stats, and Moses::StaticData::UseEarlyDiscarding().
Referenced by ExpandAllHypotheses().


| const Hypothesis * Moses::SearchNormal::GetBestHypothesis | ( | ) | const [virtual] |
Find best hypothesis on the last stack. This is the end point of the best translation, which can be traced back from here
Implements Moses::Search.
Definition at line 377 of file SearchNormal.cpp.
References actual_hypoStack, Moses::HypothesisStackNormal::GetBestHypothesis(), interrupted_flag, and m_hypoStackColl.

| const std::vector< HypothesisStack * > & Moses::SearchNormal::GetHypothesisStacks | ( | ) | const [virtual] |
Implements Moses::Search.
Definition at line 368 of file SearchNormal.cpp.
References m_hypoStackColl.
| void Moses::SearchNormal::OutputHypoStack | ( | int | stack | ) |
| void Moses::SearchNormal::OutputHypoStackSize | ( | ) |
Logging of hypothesis stack sizes
Definition at line 391 of file SearchNormal.cpp.
References m_hypoStackColl, and TRACE_ERR.
Referenced by Moses::SearchNormalBatch::ProcessSentence(), and ProcessSentence().

| void Moses::SearchNormal::ProcessOneHypothesis | ( | const Hypothesis & | hypothesis | ) | [protected] |
Find all translation options to expand one hypothesis, trigger expansion this is mostly a check for overlap with already covered words, and for violation of reordering limits.
| hypothesis | hypothesis to be expanded upon |
Definition at line 120 of file SearchNormal.cpp.
References Moses::InputType::CanIGetFromAToB(), Moses::ReorderingConstraint::Check(), Moses::InputType::ComputeDistortionDistance(), ExpandAllHypotheses(), Moses::Hypothesis::GetCurrSourceWordsRange(), Moses::WordsBitmap::GetEdgeToTheLeftOf(), Moses::WordsBitmap::GetEdgeToTheRightOf(), Moses::WordsBitmap::GetFirstGapPos(), Moses::StaticData::GetInputType(), Moses::StaticData::GetMaxDistortion(), Moses::StaticData::GetMaxPhraseLength(), Moses::InputType::GetReorderingConstraint(), Moses::InputType::GetSize(), Moses::WordsRange::GetStartPos(), Moses::TranslationOptionCollection::GetTranslationOptionList(), Moses::WordsBitmap::GetValue(), Moses::Hypothesis::GetWordsBitmap(), Moses::StaticData::Instance(), Moses::InputType::IsCoveragePossible(), m_source, m_transOptColl, NOT_FOUND, Moses::WordsBitmap::Overlap(), Moses::TranslationOptionList::size(), and Moses::WordLatticeInput.
Referenced by Moses::SearchNormalBatch::ProcessSentence(), and ProcessSentence().


| void Moses::SearchNormal::ProcessSentence | ( | ) | [virtual] |
Main decoder loop that translates a sentence by expanding hypotheses stack by stack, until the end of the sentence.
Implements Moses::Search.
Reimplemented in Moses::SearchNormalBatch.
Definition at line 58 of file SearchNormal.cpp.
References actual_hypoStack, Moses::SentenceStats::AddTimeStack(), Moses::HypothesisStack::begin(), Moses::HypothesisStackNormal::CleanupArcList(), Moses::Hypothesis::Create(), Moses::HypothesisStack::end(), Moses::StaticData::GetMaxHypoStackSize(), Moses::Manager::GetSentenceStats(), Moses::StaticData::GetTimeoutThreshold(), Moses::GetUserTime(), IFVERBOSE, Moses::StaticData::Instance(), interrupted_flag, m_hypoStackColl, m_initialTargetPhrase, Moses::Search::m_manager, m_source, m_start, OutputHypoStackSize(), ProcessOneHypothesis(), Moses::HypothesisStackNormal::PruneToSize(), Moses::SentenceStats::SetTimeTotal(), Moses::stats, and VERBOSE.

Definition at line 29 of file SearchNormal.h.
Referenced by GetBestHypothesis(), Moses::SearchNormalBatch::ProcessSentence(), and ProcessSentence().
size_t Moses::SearchNormal::interrupted_flag [protected] |
flag indicating that decoder ran out of time (see switch -time-out)
Definition at line 28 of file SearchNormal.h.
Referenced by GetBestHypothesis(), Moses::SearchNormalBatch::ProcessSentence(), and ProcessSentence().
std::vector< HypothesisStack* > Moses::SearchNormal::m_hypoStackColl [protected] |
stacks to store hypotheses (partial translations)
Definition at line 24 of file SearchNormal.h.
Referenced by Moses::SearchNormalBatch::EvalAndMergePartialHypos(), ExpandHypothesis(), GetBestHypothesis(), GetHypothesisStacks(), OutputHypoStackSize(), Moses::SearchNormalBatch::ProcessSentence(), ProcessSentence(), SearchNormal(), and ~SearchNormal().
used to seed 1st hypo
Definition at line 26 of file SearchNormal.h.
Referenced by Moses::SearchNormalBatch::ProcessSentence(), ProcessSentence(), and SearchNormal().
const InputType& Moses::SearchNormal::m_source [protected] |
Definition at line 23 of file SearchNormal.h.
Referenced by ProcessOneHypothesis(), Moses::SearchNormalBatch::ProcessSentence(), ProcessSentence(), and SearchNormal().
clock_t Moses::SearchNormal::m_start [protected] |
starting time, used for logging
Definition at line 27 of file SearchNormal.h.
Referenced by Moses::SearchNormalBatch::ProcessSentence(), and ProcessSentence().
const TranslationOptionCollection& Moses::SearchNormal::m_transOptColl [protected] |
actual (full expanded) stack of hypotheses pre-computed list of translation options for the phrases in this sentence
Definition at line 30 of file SearchNormal.h.
Referenced by ExpandAllHypotheses(), ExpandHypothesis(), and ProcessOneHypothesis().
1.5.9