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)