如果我有中文单词列表:喜欢引用=‘我’,‘是’,‘好’,‘人’,假设=‘我’,‘是’,‘善良的’,‘人’。我能用: nltk.translate.bleu_score.sentence_bleu(references,假说翻译中文吗?它和英语一样吗?日本人怎么样?我的意思是,如果我有单词列表(中文和日语)喜欢英语。谢谢!
发布于 2017-09-27 10:39:45
TL;DR
是。
长时间
BLEU分数衡量的是n克和它对语言的不可知论,但它取决于语言句子可以分裂成符号的事实。所以是的,它可以比较中日.
请注意在句子水平上使用BLEU分数的注意事项。BLEU的创作从来没有考虑过句子级别的比较,这里有一个很好的讨论:https://github.com/nltk/nltk/issues/1838
很可能,当你有很短的句子时,你会看到警告。
>>> from nltk.translate import bleu
>>> ref = '我 是 好 人'.split()
>>> hyp = '我 是 善良的 人'.split()
>>> bleu([ref], hyp)
/usr/local/lib/python2.7/site-packages/nltk/translate/bleu_score.py:490: UserWarning:
Corpus/Sentence contains 0 counts of 3-gram overlaps.
BLEU scores might be undesirable; use SmoothingFunction().
warnings.warn(_msg)
0.7071067811865475您可以使用score.py#L425中的平滑函数来克服短句。
>>> from nltk.translate.bleu_score import SmoothingFunction
>>> smoothie = SmoothingFunction().method4
>>> bleu([ref], hyp, smoothing_function=smoothie)
0.2866227639866161https://stackoverflow.com/questions/46444656
复制相似问题