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.
16 lines
451 B
Python
16 lines
451 B
Python
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))
|
|
return rouge.get_scores(s1, s2)[0]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print('hello')
|
|
print(get_rouge_score("比亚迪秦PLUS-DMi是一款混合动力汽车。", "比亚迪秦PLUS-DMi是一款混动车。"))
|