diff options
author | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-04-24 08:07:14 +0400 |
---|---|---|
committer | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-04-24 08:07:14 +0400 |
commit | 07cc85d58404dd08c7b55d9bd9635ca039d062f9 (patch) | |
tree | 63d04f80f7f3ca56baa79bd07ed7a8859ab5f81d /moses | |
parent | 2d4c0c6580f7ac4cbf0d1ef977eb20744425859c (diff) |
handle zero counts in history bleu
Diffstat (limited to 'moses')
-rw-r--r-- | moses/src/BleuScoreFeature.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/moses/src/BleuScoreFeature.cpp b/moses/src/BleuScoreFeature.cpp index 53973080c..db2a4f568 100644 --- a/moses/src/BleuScoreFeature.cpp +++ b/moses/src/BleuScoreFeature.cpp @@ -715,7 +715,8 @@ float BleuScoreFeature::CalculateBleu(BleuScoreState* state) const { float precision_pd = 1.0; if (m_target_length_history > 0) { for (size_t i = 0; i < BleuScoreState::bleu_order; i++) - precision_pd *= m_match_history[i]/m_count_history[i]; + if (m_count_history[i] != 0) + precision_pd *= m_match_history[i]/m_count_history[i]; // take geometric mean precision_pd = pow(precision_pd, (float)1/4); |