summaryrefslogtreecommitdiff
path: root/dtrain/score.cc
diff options
context:
space:
mode:
authorKenneth Heafield <github@kheafield.com>2012-08-03 07:46:54 -0400
committerKenneth Heafield <github@kheafield.com>2012-08-03 07:46:54 -0400
commitbe1ab0a8937f9c5668ea5e6c31b798e87672e55e (patch)
treea13aad60ab6cced213401bce6a38ac885ba171ba /dtrain/score.cc
parente5d6f4ae41009c26978ecd62668501af9762b0bc (diff)
parent9fe0219562e5db25171cce8776381600ff9a5649 (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'dtrain/score.cc')
-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;