From 481c2c85e39849d11f4017c230c4963148b31df6 Mon Sep 17 00:00:00 2001 From: "ligen1@miduchina.com" Date: Wed, 20 Jul 2022 14:39:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3eval-dataset=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E5=AD=98=E5=9C=A8=E7=9A=84=E4=B8=AA=E5=88=AB=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/metric.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/metric.py b/src/metric.py index bab694e..e13959b 100644 --- a/src/metric.py +++ b/src/metric.py @@ -150,6 +150,12 @@ def compute_detect_correct_label_list(src_text, trg_text): for src_text, pred_text, trg_text in zip(src_texts, pred_texts, trg_texts): # 先统计检测和纠正标签 + try: + detect_ref_list, correct_ref_list = compute_detect_correct_label_list( + src_text, trg_text) + except Exception as e: + # 可能Eval dataset有个别错误,暂时跳过 + continue try: # 处理bad case detect_pred_list, correct_pred_list = compute_detect_correct_label_list( @@ -157,8 +163,7 @@ def compute_detect_correct_label_list(src_text, trg_text): except Exception as e: logger.exception(e) detect_pred_list, correct_pred_list = [], [] - detect_ref_list, correct_ref_list = compute_detect_correct_label_list( - src_text, trg_text) + detect_ref_num += len(detect_ref_list) detect_pred_num += len(detect_pred_list)