我用GLEU NLTK比较了两个相同的句子,没有得到1.0。为什么?

2024-04-20 01:48:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用NLTK的GLEU分数来评估机器翻译的质量。我想用两个相同的句子来检查代码,我比较的是两个句子,而不是微粒。但结果是我得到了0.015152。我做错了什么?两个相同的句子得1.0分

我的代码:

from nltk.translate.gleu_score import sentence_gleu

hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which', 'ensures', 'that', 'the', 'military', 'always', 'obeys', 'the', 'commands', 'of', 'the', 'party']

ref1a = ['It', 'is', 'a', 'guide', 'to', 'action', 'which', 'ensures', 'that', 'the', 'military', 'always', 'obeys', 'the', 'commands', 'of', 'the', 'party']

gleu_score = sentence_gleu(ref1a, hyp1)

print(gleu_score)

我的结果是:

0.015152

进程已完成,退出代码为0

我弄错了吗?请帮忙