- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我很好奇是否有人熟悉使用 NLTK's BLEU score calculation 之间的区别和 SacreBLEU library .
特别是,我使用了两个库的句子 BLEU 分数,对整个数据集进行平均。两者给出不同的结果:
>>> from nltk.translate import bleu_score
>>> from sacrebleu import sentence_bleu
>>> print(len(predictions))
256
>>> print(len(targets))
256
>>> prediction = "this is the first: the world's the world's the world's the \
... world's the world's the world's the world's the world's the world's the world \
... of the world of the world'"
...
>>> target = "al gore: so the alliance for climate change has launched two campaigns."
>>> print(bleu_score.sentence_bleu([target], prediction))
0.05422283394039736
>>> print(sentence_bleu(prediction, [target]).score)
0.0
>>> print(sacrebleu.corpus_bleu(predictions, [targets]).score)
0.678758518214081
>>> print(bleu_score.corpus_bleu([targets], [predictions]))
0
如您所见,存在许多令人困惑的不一致之处。我的 BLEU 分数不可能是 67.8%,但也不应该是 0%(有很多重叠的 n-gram,例如“the”)。
如果有人能阐明这一点,我将不胜感激。谢谢。
最佳答案
NLTK 和 SacreBLEU 使用不同的分词规则,主要是在它们处理标点符号的方式上。 NLTK 使用自己的标记化,而 SacreBLEU 复制了 2002 年的原始 Perl 实现。标记化规则在 NLTK 中可能更加详尽,但它们使数字与原始实现无法比较。
你从 SacreBLEU 得到的语料库 BLEU 不是 67.8%,而是 0.67%——与 NLTK 不同,SacreBLEU 的数字已经乘以 100。因此,我不会说分数之间存在巨大差异。
句子级别的 BLEU 可以使用不同的 smoothing techniques这应该确保即使 4 克精度的 3 克精度为零,分数也会得到合理的值。但是,请注意,BLEU 作为句子级别的指标非常不可靠。
关于nltk - NLTK 的 BLEU 分数和 SacreBLEU 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65454578/
我已经在 python 中导入了 nltk 来计算 Ubuntu 上的 BLEU 分数。我了解句子级 BLEU 分数的工作原理,但我不了解语料库级 BLEU 分数的工作原理。 下面是我的语料库级 BL
如果我有中文单词表:like reference = ['我' '是', '好' ,'人'],假设 = ['我', '是', '善良的','人]。我可以使用:nltk.translate.bleu_s
我对机器翻译的 BLUE Score 计算有一些疑问。我意识到他们对于 BLEU 可能有不同的指标。我发现代码报告了 BLEU 的五个值,即 BLEU-1、BLEU-2、BLEU-3、BLEU-4 和
我需要计算 BLEU 分数来识别两个句子是否相似。我读过一些文章,主要是关于测量机器翻译准确性的 BLEU 分数。但我需要 BLEU 分数来找出相似性在同一种语言的句子之间[英语]。(即)(两个句子都
根据两个不同摘要系统(sys1 和 sys2)的结果和相同的引用摘要,我使用 BLEU 和 ROUGE 对其进行了评估。问题是:sys1 的所有 ROUGE 分数均高于 sys2(ROUGE-1、RO
我需要创建一个单词对、三元组等列表,以便在 Bleu 指标中进行评估。 Bleu 从一元语法(单个单词)开始,一直到 N 元语法 - N 在运行时指定。 例如,给定句子“以色列官员负责机场安全” 对于
看完 Andrew Ng 关于 Bleu score 的视频后我想用 python 从头开始实现一个。我用 numpy 谨慎地用 python 编写了完整的代码。这是完整代码 import num
有一个测试句和一个引用句。我如何编写一个 Python 脚本,以自动机器翻译评估中使用的 BLEU 度量的形式测量这两个句子之间的相似性? 最佳答案 BLEU 分数由两部分组成,修改后的精度和简洁性惩
我很好奇是否有人熟悉使用 NLTK's BLEU score calculation 之间的区别和 SacreBLEU library . 特别是,我使用了两个库的句子 BLEU 分数,对整个数据集进
我读过的论文中对此并不太清楚。当模型在被分成子词的双语语料库上进行训练时,例如通过字节对编码,计算子词输出或重新加入子词后的完整词的 BLEU 分数是标准的吗? 最佳答案 BLEU 分数始终在完整标记
我在计算中文句子的 BLEU 分数时发现了零值。 候选句子是c,两个引用是r1和r2 c=[u'\u9274\u4e8e', u'\u7f8e\u56fd', u'\u96c6', u'\u7ecf\
Python NLTK中有BLEU评分的实现, nltk.translate.bleu_score.corpus_bleu 但我不确定它是否与 mtevalv13a.pl script 相同. 它们有
我是一名优秀的程序员,十分优秀!