Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <fishandfrolick@gmail.com>2013-02-20 02:29:48 +0400
committerHieu Hoang <fishandfrolick@gmail.com>2013-02-20 02:29:48 +0400
commite09199056540dab19c3852f28c2e80c9e9f34b8b (patch)
treed540d9ed1b31f52d56a82e7a5dcca313e18595b4 /moses/BitmapContainer.cpp
parent2835ea63e0b7282077308940df66179d26a2f2aa (diff)
delete mention of Distortion score producer and its weight in static data
Diffstat (limited to 'moses/BitmapContainer.cpp')
-rw-r--r--moses/BitmapContainer.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/moses/BitmapContainer.cpp b/moses/BitmapContainer.cpp
index c21cd552a..1a7f9f358 100644
--- a/moses/BitmapContainer.cpp
+++ b/moses/BitmapContainer.cpp
@@ -62,7 +62,6 @@ public:
CHECK(m_transOptRange != NULL);
const StaticData &staticData = StaticData::Instance();
- const float weightDistortion = staticData.GetWeightDistortion();
const float distortionScoreA = DistortionScoreProducer::CalculateDistortionScore(
*hypoA,
@@ -77,8 +76,22 @@ public:
hypoB->GetWordsBitmap().GetFirstGapPos()
);
- const float scoreA = hypoA->GetScore() + distortionScoreA * weightDistortion;
- const float scoreB = hypoB->GetScore() + distortionScoreB * weightDistortion;
+
+ float totalWeightDistortion = 0;
+ const std::vector<FeatureFunction*> &ffs = FeatureFunction::GetFeatureFunctions();
+ std::vector<FeatureFunction*>::const_iterator iter;
+ for (iter = ffs.begin(); iter != ffs.end(); ++iter) {
+ const FeatureFunction *ff = *iter;
+
+ const DistortionScoreProducer *model = dynamic_cast<const DistortionScoreProducer*>(ff);
+ if (model) {
+ float weight =staticData.GetAllWeights().GetScoreForProducer(model);
+ totalWeightDistortion += weight;
+ }
+ }
+ const float scoreA = hypoA->GetScore() + distortionScoreA * totalWeightDistortion;
+ const float scoreB = hypoB->GetScore() + distortionScoreB * totalWeightDistortion;
+
if (scoreA > scoreB) {
return true;