Skip to content

Commit

Permalink
修复delete标签计算指标时的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Jul 18, 2022
1 parent 87d83df commit 06d33a7
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def compute_detect_correct_label_list(src_text, trg_text):
elif tag == 'delete':
for count, src_i in enumerate(range(src_i1, src_i2)):
trg_token = ''
detect_ref_list.append(src_i1)
correct_ref_list.append((src_i1, trg_token))
detect_ref_list.append(src_i)
correct_ref_list.append((src_i, trg_token))

elif tag == 'insert':
trg_token = trg_text[trg_i1:trg_i2]
Expand Down Expand Up @@ -221,10 +221,3 @@ def final_f1_score(src_texts,
logger.info('final f1:{}'.format(final_f1))
logger.info('f1 logfile saved at:{}'.format(log_fp))
return final_f1


if __name__ == '__main__':
s = final_f1_score(src_texts=['你号钟国', '我知道知道这件情了!'],
pred_texts=['你好中国', '我知道知道这件事情了!'],
trg_texts= ['你好中国', '我知道这件事情了!'])
print(s)

0 comments on commit 06d33a7

Please sign in to comment.