python.NLTK(WindowDiff 和 PK)与 python.Segeval(WindowDiff 和 PK)

标签 python nltk metrics text-segmentation

Beeferman 的 PK 和 WindowDIFF 的 Python NLTK 实现从两者的 python segeval 实现中得到完全不同的结果。

使用相同的参数。

hyp: 0100100000
ref: 0101000000
k=2
PK's SegEval:0.2222222
PK's NLTK:0.111111111

hyp: 111111
ref: 100100
k=2
PK's SegEval:0.4
PK's NLTK:0.64

对于使用它的人,这可能会导致不同的研究结果。
为什么我在这两个实现中使用 PK 得到不同的结果? PK必须只有一个结果。

最佳答案

可能是您调用 NLTK 函数的方式出了问题,或者您使用的是旧版本的 NLTK。

我得到的 NLTK 结果与您在 segeval 中显示的结果相同:

>>> from nltk.metrics.segmentation import pk
>>> hyp = '0100100000'
>>> ref = '0101000000'
>>> pk(hyp, ref, 2)
0.2222222222222222
>>> hyp = '111111'
>>> ref = '100100'
>>> pk(hyp, ref, 2)
0.4

我的 nltk 版本:

>>> nltk.__version__
'3.0.5'

这样做:

$ pip install -U nltk

关于python.NLTK(WindowDiff 和 PK)与 python.Segeval(WindowDiff 和 PK),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24456056/

相关文章:

python - WebView 组件忽略自定义字体

python-3.x - 如何从 Pandas 数据框创建语料库以使用 NLTK

.net - 计算包含 Visual Studio 解决方案的代码行数

algorithm - 如何确定指标分数的适当权重

python Pandas : Append rows of DataFrame and delete the appended rows

python - 使用 ffmpeg 从 Python : why the sound is cut only when streaming into a mp4 file ? 进行流式视频合成

python - QDialog - 防止在 Python 和 PyQt 中关闭

Python 地理无法找到美国的城市

nlp - 如何解读 NLTK Brill 标注器规则

java - 如何从命令行执行 Metrics2 插件?