三種rouge測評方法

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"])

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章