Commit dc0a21ff authored by WenmuZhou's avatar WenmuZhou
Browse files

fix divide zero error

parent 23df5bcf
...@@ -29,7 +29,7 @@ class RecMetric(object): ...@@ -29,7 +29,7 @@ class RecMetric(object):
pred = pred.replace(" ", "") pred = pred.replace(" ", "")
target = target.replace(" ", "") target = target.replace(" ", "")
norm_edit_dis += Levenshtein.distance(pred, target) / max( norm_edit_dis += Levenshtein.distance(pred, target) / max(
len(pred), len(target)) len(pred), len(target), 1)
if pred == target: if pred == target:
correct_num += 1 correct_num += 1
all_num += 1 all_num += 1
......
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