diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-02-19 22:31:59 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-02-19 22:31:59 +0400 |
commit | 2835ea63e0b7282077308940df66179d26a2f2aa (patch) | |
tree | f7b912494b1e5d08e845510e586dd7db955cc881 /moses | |
parent | e0746cd5252077e2913fc614e49090afee92af00 (diff) |
getting rid of m_distortionScoreProducer in staticdata
Diffstat (limited to 'moses')
-rw-r--r-- | moses/BitmapContainer.cpp | 9 | ||||
-rw-r--r-- | moses/DummyScoreProducers.cpp | 2 | ||||
-rw-r--r-- | moses/DummyScoreProducers.h | 4 |
3 files changed, 8 insertions, 7 deletions
diff --git a/moses/BitmapContainer.cpp b/moses/BitmapContainer.cpp index 4dd63141f..c21cd552a 100644 --- a/moses/BitmapContainer.cpp +++ b/moses/BitmapContainer.cpp @@ -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, diff --git a/moses/DummyScoreProducers.cpp b/moses/DummyScoreProducers.cpp index 601b4f770..27a1ad715 100644 --- a/moses/DummyScoreProducers.cpp +++ b/moses/DummyScoreProducers.cpp @@ -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); diff --git a/moses/DummyScoreProducers.h b/moses/DummyScoreProducers.h index 00eb603c3..80dc7adc4 100644 --- a/moses/DummyScoreProducers.h +++ b/moses/DummyScoreProducers.h @@ -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; |