summaryrefslogtreecommitdiff
path: root/dtrain
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-07-08 14:26:51 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-07-08 14:26:51 +0200
commite816274e337a066df1b1e86ef00136a021a17caf (patch)
tree6abc906f4675a0ef0b3799395fd96095e4cee2b3 /dtrain
parent0fdb260d38c32e0d4d5403b9bcf1d1a4e60be4c4 (diff)
parented50f2b747f21f1613243eee75d812d2596f02d0 (diff)
Merge branch 'master' of github.com:pks/cdec-dtrain
Diffstat (limited to 'dtrain')
-rw-r--r--dtrain/score.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/dtrain/score.cc b/dtrain/score.cc
index 4a7cac6e..34fc86a9 100644
--- a/dtrain/score.cc
+++ b/dtrain/score.cc
@@ -103,7 +103,7 @@ SmoothBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref,
i_bleu[j] += (1/((score_t)j+1)) * i_ng;
}
}
- sum += exp(i_bleu[i])/(pow(2.0, N_-i));
+ sum += exp(i_bleu[i])/pow(2.0, (double)(N_-i));
}
return brevity_penalty(hyp_len, ref_len) * sum;
}
@@ -126,7 +126,7 @@ SumBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref,
unsigned j = 1;
for (unsigned i = 0; i < M; i++) {
if (counts.sum_[i] == 0 || counts.clipped_[i] == 0) break;
- sum += ((score_t)counts.clipped_[i]/counts.sum_[i])/pow(2., N_-j+1);
+ sum += ((score_t)counts.clipped_[i]/counts.sum_[i])/pow(2.0, (double) (N_-j+1));
j++;
}
return brevity_penalty(hyp_len, ref_len) * sum;
@@ -150,7 +150,7 @@ SumExpBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref,
unsigned j = 1;
for (unsigned i = 0; i < M; i++) {
if (counts.sum_[i] == 0 || counts.clipped_[i] == 0) break;
- sum += exp(((score_t)counts.clipped_[i]/counts.sum_[i]))/pow(2., N_-j+1);
+ sum += exp(((score_t)counts.clipped_[i]/counts.sum_[i]))/pow(2.0, (double) (N_-j+1));
j++;
}
return brevity_penalty(hyp_len, ref_len) * sum;
@@ -178,7 +178,7 @@ SumWhateverBleuScorer::Score(vector<WordID>& hyp, vector<WordID>& ref,
unsigned j = 1;
for (unsigned i = 0; i < M; i++) {
if (counts.sum_[i] == 0 || counts.clipped_[i] == 0) break;
- sum += exp(v[i] * log(((score_t)counts.clipped_[i]/counts.sum_[i])))/pow(2., N_-j+1);
+ sum += exp(v[i] * log(((score_t)counts.clipped_[i]/counts.sum_[i])))/pow(2.0, (double) (N_-j+1));
j++;
}
return brevity_penalty(hyp_len, ref_len) * sum;