neuralmonkey icon indicating copy to clipboard operation
neuralmonkey copied to clipboard

ChrF fails on division by zero

Open kasnerz opened this issue 6 years ago • 0 comments

In case len(tokens) == 0 (i.e. the input sentence is empty) ChrF crashes with ZeroDivisionError on line 89:

https://github.com/ufal/neuralmonkey/blob/master/neuralmonkey/evaluators/chrf.py#L89

  File "/lnet/spec/work/people/kasner/neuralmonkey-ctc-decoder/neuralmonkey/bin/neuralmonkey/evaluators/chrf.py", line 89, in chr_p
    return precision / float(self.max_ord)
ZeroDivisionError: float division by zero

kasnerz avatar Dec 27 '18 18:12 kasnerz