new CalcFutureScore() works with cube pruning

This commit is contained in:
Hieu Hoang 2015-10-05 18:28:52 +01:00
parent 67fb5cd5f0
commit be7f0c16de
2 changed files with 10 additions and 5 deletions

View File

@ -110,13 +110,13 @@ public:
BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
, BitmapContainer &parent
, const TranslationOptionList &translations
, const SquareMatrix &futureScore,
, const SquareMatrix &futureScores,
const InputType& itype)
: m_initialized(false)
, m_prevBitmapContainer(prevBitmapContainer)
, m_parent(parent)
, m_translations(translations)
, m_futurescore(futureScore)
, m_futureScores(futureScores)
, m_seenPosition()
{
@ -195,6 +195,10 @@ BackwardsEdge::Initialize()
return;
}
const WordsBitmap &bm = m_hypotheses[0]->GetWordsBitmap();
const WordsRange &newRange = m_translations.Get(0)->GetSourceWordsRange();
m_futureScore = m_futureScores.CalcFutureScore2(bm, newRange.GetStartPos(), newRange.GetEndPos());
Hypothesis *expanded = CreateHypothesis(*m_hypotheses[0], *m_translations.Get(0));
m_parent.Enqueue(0, 0, expanded, this);
SetSeenPosition(0, 0);
@ -211,7 +215,7 @@ Hypothesis *BackwardsEdge::CreateHypothesis(const Hypothesis &hypothesis, const
IFVERBOSE(2) {
hypothesis.GetManager().GetSentenceStats().StopTimeBuildHyp();
}
//newHypo->EvaluateWhenApplied(m_futurescore);
newHypo->EvaluateWhenApplied(m_futureScore);
return newHypo;
}

View File

@ -161,7 +161,8 @@ private:
const BitmapContainer &m_prevBitmapContainer;
BitmapContainer &m_parent;
const TranslationOptionList &m_translations;
const SquareMatrix &m_futurescore;
const SquareMatrix &m_futureScores;
float m_futureScore;
std::vector< const Hypothesis* > m_hypotheses;
boost::unordered_set< int > m_seenPosition;
@ -180,7 +181,7 @@ public:
BackwardsEdge(const BitmapContainer &prevBitmapContainer
, BitmapContainer &parent
, const TranslationOptionList &translations
, const SquareMatrix &futureScore,
, const SquareMatrix &futureScores,
const InputType& source);
~BackwardsEdge();