我正在点击此链接以查找句子级别bleu score
NLTK:语料库级别的 BLEU 与句子级别的 BLEU 分数
当我运行这个例子时:
import nltk
hypothesis = ['This', 'is', 'cat']
reference = ['This', 'is', 'a', 'cat']
references = [reference]
nltk.translate.bleu_score.sentence_bleu(references, hypothesis)
输出:
8.987727354491445e-155
输出是0
警告:
/home/mac/.local/lib/python3.6/site-packages/nltk/translate/bleu_score.py:516: UserWarning:
The hypothesis contains 0 counts of 3-gram overlaps.
Therefore the BLEU score evaluates to 0, independently of
how many N-gram overlaps of lower order it contains.
Consider using lower n-gram order or use SmoothingFunction()
warnings.warn(_msg)
/home/mac/.local/lib/python3.6/site-packages/nltk/translate/bleu_score.py:516: UserWarning:
The hypothesis contains 0 counts of 4-gram overlaps.
Therefore the BLEU score evaluates to 0, independently of
how many N-gram overlaps of lower order it contains.
Consider using lower n-gram order or use SmoothingFunction()
warnings.warn(_msg)
如何为具有 的句子运行相同的功能n-gram
for n<4
?
还有我可以在里面传递什么参数nltk.translate.bleu_score.sentence_bleu()
?