未验证 提交 a27bd4d5 编写于 作者: D dyning 提交者: GitHub

Merge pull request #1678 from littletomatodonkey/dyg/fix_space_eval

fix space eval
...@@ -26,6 +26,8 @@ class RecMetric(object): ...@@ -26,6 +26,8 @@ class RecMetric(object):
all_num = 0 all_num = 0
norm_edit_dis = 0.0 norm_edit_dis = 0.0
for (pred, pred_conf), (target, _) in zip(preds, labels): for (pred, pred_conf), (target, _) in zip(preds, labels):
pred = pred.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))
if pred == target: if pred == target:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册