Eliminated EvaluateWhenAppliedWithContext().

The Phrase class now provides access to the TranslationTask.
This commit is contained in:
Ulrich Germann 2015-10-24 01:31:50 +01:00
parent 8ace1398eb
commit 8c4e017fbf
2 changed files with 14 additions and 15 deletions

View File

@ -1,3 +1,4 @@
// -*- mode: c++; indent-tabs-mode: nil; tab-width:2 -*-
#pragma once
#include "FeatureFunction.h"
@ -37,13 +38,13 @@ public:
const FFState* prev_state,
ScoreComponentCollection* accumulator) const = 0;
virtual FFState* EvaluateWhenAppliedWithContext(
ttasksptr const& ttasks,
const Hypothesis& cur_hypo,
const FFState* prev_state,
ScoreComponentCollection* accumulator) const {
return EvaluateWhenApplied(cur_hypo, prev_state, accumulator);
}
// virtual FFState* EvaluateWhenAppliedWithContext(
// ttasksptr const& ttasks,
// const Hypothesis& cur_hypo,
// const FFState* prev_state,
// ScoreComponentCollection* accumulator) const {
// return EvaluateWhenApplied(cur_hypo, prev_state, accumulator);
// }
virtual FFState* EvaluateWhenApplied(
const ChartHypothesis& /* cur_hypo */,

View File

@ -143,17 +143,15 @@ AddArc(Hypothesis *loserHypo)
void
Hypothesis::
EvaluateWhenApplied(StatefulFeatureFunction const& sfff,
int state_idx)
EvaluateWhenApplied(StatefulFeatureFunction const& sfff, int state_idx)
{
const StaticData &staticData = StaticData::Instance();
if (! staticData.IsFeatureFunctionIgnored( sfff )) {
Manager& manager = this->GetManager(); //Get the manager and the ttask
ttasksptr const& ttask = manager.GetTtask();
m_ffStates[state_idx] = sfff.EvaluateWhenAppliedWithContext
(ttask, *this, m_prevHypo ? m_prevHypo->m_ffStates[state_idx] : NULL,
&m_currScoreBreakdown);
// Manager& manager = this->GetManager(); //Get the manager and the ttask
// ttasksptr const& ttask = manager.GetTtask();
FFState const* prev = m_prevHypo ? m_prevHypo->m_ffStates[state_idx] : NULL;
m_ffStates[state_idx]
= sfff.EvaluateWhenApplied(*this, prev, &m_currScoreBreakdown);
}
}