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