Skip to content

Commit

Permalink
解决eval-dataset可能存在的个别错误
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 20, 2022
1 parent 5ae285b commit 481c2c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,20 @@ 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(
src_text, pred_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)
Expand Down

0 comments on commit 481c2c8

Please sign in to comment.