(1) Steps to reproduce:
from nltk.metrics.agreement import AnnotationTask
atask = AnnotationTask(data=[('c1', '1', 1),('c2', '1', 1)])
atask.alpha()
(2) Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/sidorenko/.local/lib/python2.7/site-packages/nltk/metrics/agreement.py", line 316, in alpha
ret = 1.0 - (self.Do_alpha() / De)
ZeroDivisionError: float division by zero
(3) Expected return value:
1.
(4) System information:
nltk.__version__: '3.0.5'
python --version: Python 2.7.6
uname -srm: Linux 3.19.0-42-generic x86_64
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> nltk.__version__
'3.2.4'
>>> from nltk.metrics.agreement import AnnotationTask
>>> atask = AnnotationTask(data=[('c1', '1', 1),('c2', '1', 1)])
>>> atask.alpha()
1
no problem here.
was probably fixed here https://github.com/nltk/nltk/commit/f0f3c412e36e2a8b43066634b6d3462201d2e3ec or here https://github.com/nltk/nltk/commit/bec4e496d821710a21a59147e242ac84225c855e
Yep. Checked it on my computer---no error with NLTK 3.2.5. Has apparently been fixed in the previous versions.