Commit 67579b12 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko

Merge branch 'develop' into 'master'

Fixed null division for cases in which only exclude symbols are produced

See merge request !27
parents 2dec1bac 66d4211e
Pipeline #234036 passed with stages
in 5 minutes and 47 seconds
......@@ -144,7 +144,12 @@ class BLEU(mx.metric.EvalMetric):
if self._size_hyp >= self._size_ref:
return 1
else:
return math.exp(1 - (self._size_ref / self._size_hyp))
if self._size_hyp > 0:
size_hyp = self._size_hyp
else:
size_hyp = 1
return math.exp(1 - (self._size_ref / size_hyp))
@staticmethod
def _get_ngrams(sentence, n):
......
......@@ -143,7 +143,12 @@ class BLEU(mx.metric.EvalMetric):
if self._size_hyp >= self._size_ref:
return 1
else:
return math.exp(1 - (self._size_ref / self._size_hyp))
if self._size_hyp > 0:
size_hyp = self._size_hyp
else:
size_hyp = 1
return math.exp(1 - (self._size_ref / size_hyp))
@staticmethod
def _get_ngrams(sentence, n):
......
......@@ -143,7 +143,12 @@ class BLEU(mx.metric.EvalMetric):
if self._size_hyp >= self._size_ref:
return 1
else:
return math.exp(1 - (self._size_ref / self._size_hyp))
if self._size_hyp > 0:
size_hyp = self._size_hyp
else:
size_hyp = 1
return math.exp(1 - (self._size_ref / size_hyp))
@staticmethod
def _get_ngrams(sentence, n):
......
......@@ -143,7 +143,12 @@ class BLEU(mx.metric.EvalMetric):
if self._size_hyp >= self._size_ref:
return 1
else:
return math.exp(1 - (self._size_ref / self._size_hyp))
if self._size_hyp > 0:
size_hyp = self._size_hyp
else:
size_hyp = 1
return math.exp(1 - (self._size_ref / size_hyp))
@staticmethod
def _get_ngrams(sentence, n):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment