直接上代码 from rouge import FilesRouge files_rouge = FilesRouge() hyp1_path="name1.txt" ref_path="name2.txt" # 按照行计算,每行计算一个rouge scores = files_rouge.get_scores(hyp1_path, ref_path, avg=False) #对整个文本的rouge 分数做一个平均 scores = files_rouge.get_scores(hyp1_path, ref_path, avg=True)