我正在尝试使用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
我弄错了吗?请帮忙
sentence_gleu
的第一个参数应该是列表列表(参考句子列表,其中每个句子都是单词列表)试着这样称呼它:
相关问题 更多 >
编程相关推荐