欢迎来到尧图网

客户服务 关于我们

您的位置:首页 > 文旅 > 文化 > 评估指标rouge安装与测试

评估指标rouge安装与测试

2025/3/16 20:04:30 来源:https://blog.csdn.net/qq_45734745/article/details/140187875  浏览:    关键词:评估指标rouge安装与测试

github链接

  • https://github.com/pltrdy/rouge
git clone https://github.com/pltrdy/rouge
cd rouge
python setup.py install
  • 新建一个py文件进行测试
    • 注意:不能命名为rouge,否则导入相同的模块会因重名而报错!
  • 测试1(文本测试)
from rouge import Rouge hypothesis = "the #### transcript is a written version of each day 's cnn student news program use this transcript to he    lp students with reading comprehension and vocabulary use the weekly newsquiz to test your knowledge of storie s you     saw on cnn student news"reference = "this page includes the show transcript use the transcript to help students with reading comprehension and     vocabulary at the bottom of the page , comment for a chance to be mentioned on cnn student news . you must be a teac    her or a student age # # or older to request a mention on the cnn student news roll call . the weekly newsquiz tests     students ' knowledge of even ts in the news"rouge = Rouge()
scores = rouge.get_scores(hypothesis, reference)
  • 测试2(文件测试)
import json
from rouge import Rouge# Load some sentences
with open('./tests/data.json') as f:data = json.load(f)hyps, refs = map(list, zip(*[[d['hyp'], d['ref']] for d in data]))
rouge = Rouge()
scores = rouge.get_scores(hyps, refs)
# or
scores = rouge.get_scores(hyps, refs, avg=True)
  • 注意:“f”代表f1_score,“p”代表精度,“r”代表召回

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

热搜词