diff options
author | Patrick Simianer <p@simianer.de> | 2012-07-06 11:45:32 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2012-07-06 11:45:32 +0200 |
commit | 902591f9cc48a3b4cfc0a8d5df07898827bddf71 (patch) | |
tree | 17f023a7dd5ee0f527acf9d6a5388b6d96094d13 /dtrain/score.cc | |
parent | 96bb9719858dd1600d70a3affee42d0e0c5cd862 (diff) | |
parent | f6bd206d83d8e71227e42c933f56c2ccd43fe013 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'dtrain/score.cc')
-rw-r--r-- | dtrain/score.cc | 8 |
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; |