Skip to content

Commit

Permalink
指标计算: 更新删除类型的标签统计
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 18, 2022
1 parent 06d33a7 commit 80ffe09
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ def compute_detect_correct_label_list(src_text, trg_text):
correct_ref_list.append((src_i, trg_token))

elif tag == 'delete':
for count, src_i in enumerate(range(src_i1, src_i2)):
trg_token = ''
detect_ref_list.append(src_i)
correct_ref_list.append((src_i, trg_token))
trg_token = 'D'*(src_i2-src_i1)
detect_ref_list.append(src_i1)
correct_ref_list.append((src_i1, trg_token))

elif tag == 'insert':
trg_token = trg_text[trg_i1:trg_i2]
Expand Down Expand Up @@ -220,4 +219,4 @@ def final_f1_score(src_texts,
json.dump(json_data, _log_fp, indent=4)
logger.info('final f1:{}'.format(final_f1))
logger.info('f1 logfile saved at:{}'.format(log_fp))
return final_f1
return final_f1

0 comments on commit 80ffe09

Please sign in to comment.