You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
483 B
Python
18 lines
483 B
Python
10 months ago
|
from rouge_chinese import Rouge
|
||
|
import jieba
|
||
|
|
||
|
|
||
|
# “f” 表示 f1_score, “p” 表示 precision, “r” 表示 recall.
|
||
|
def get_rouge_score(s1, s2):
|
||
|
rouge = Rouge()
|
||
|
s1 = " ".join(jieba.cut(s1))
|
||
|
s2 = " ".join(jieba.cut(s2))
|
||
9 months ago
|
# print(s1)
|
||
|
# print(s2)
|
||
10 months ago
|
return rouge.get_scores(s1, s2)[0]
|
||
|
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
print('hello')
|
||
9 months ago
|
print(get_rouge_score("比亚迪秦PLUS-DMi是一款混合动力汽车。", "比亚迪秦PLUS-DMi是一款混动车。"))
|