getting rid of m_distortionScoreProducer in staticdata

This commit is contained in:
Hieu Hoang 2013-02-19 18:31:59 +00:00
parent e0746cd525
commit 2835ea63e0
3 changed files with 8 additions and 7 deletions

View File

@ -61,15 +61,16 @@ public:
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const {
CHECK(m_transOptRange != NULL);
const float weightDistortion = StaticData::Instance().GetWeightDistortion();
const DistortionScoreProducer *dsp = StaticData::Instance().GetDistortionProducer();
const float distortionScoreA = dsp->CalculateDistortionScore(
const StaticData &staticData = StaticData::Instance();
const float weightDistortion = staticData.GetWeightDistortion();
const float distortionScoreA = DistortionScoreProducer::CalculateDistortionScore(
*hypoA,
hypoA->GetCurrSourceWordsRange(),
*m_transOptRange,
hypoA->GetWordsBitmap().GetFirstGapPos()
);
const float distortionScoreB = dsp->CalculateDistortionScore(
const float distortionScoreB = DistortionScoreProducer::CalculateDistortionScore(
*hypoB,
hypoB->GetCurrSourceWordsRange(),
*m_transOptRange,

View File

@ -39,7 +39,7 @@ const FFState* DistortionScoreProducer::EmptyHypothesisState(const InputType &in
}
float DistortionScoreProducer::CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGap) const
const WordsRange &prev, const WordsRange &curr, const int FirstGap)
{
if(!StaticData::Instance().UseEarlyDistortionCost()) {
return - (float) hypo.GetInput().ComputeDistortionDistance(prev, curr);

View File

@ -19,8 +19,8 @@ public:
: StatefulFeatureFunction("Distortion", 1, line)
{}
float CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGapPosition) const;
static float CalculateDistortionScore(const Hypothesis& hypo,
const WordsRange &prev, const WordsRange &curr, const int FirstGapPosition);
virtual const FFState* EmptyHypothesisState(const InputType &input) const;