1. 坑爹的rouge安装
2. rouge4chinese(不用安装,拿来直接用,中文)
https://github.com/hpzhao/nlp-metrics/tree/master/ROUGE4Chinese
3. sumeval(安装很简单,安完直接用,英文)
https://github.com/chakki-works/sumeval
我的使用过程:
1)安装:pip install sumeval
2)代码使用:
from sumeval.metrics.rouge import RougeCalculator
rouge = RougeCalculator(stopwords=True, lang="en")
rouge_1 = rouge.rouge_n(
summary="I went to the Mars from my living town.",
references="I went to Mars",
n=1)
rouge_2 = rouge.rouge_n(
summary="I went to the Mars from my living town.",
references=["I went to Mars", "It's my living town"],
n=2)
rouge_l = rouge.rouge_l(
summary="I went to the Mars from my living town.",
references=["I went to Mars", "It's my living town"])
版权声明:本文为ccbrid原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。