AttributeError: 'FreqDist' object has no attribute 'inc'

后端 未结 4 1257
鱼传尺愫
鱼传尺愫 2021-01-17 11:19

I am a beginner in Python and NLTK. I am trying to run the following code from a tutorial:

from nltk.corpus import gutenberg
from nltk import FreqDist

fd =          


        
4条回答
  •  醉话见心
    2021-01-17 11:36

    Some of the features have been deprecated.

    The code in question does work on version nltk 2.0.4

    https://pypi.python.org/pypi/nltk/2.0.4

    To install version 2.0.4 follow:

    wget https://pypi.python.org/packages/source/n/nltk/nltk-2.0.4.zip#md5=cbd04d8635f1358a69a38c4774be029c

    7z x nltk-2.0.4.zip

    cd nltk-2.0.4/

    python setup.py install

    To check which version is installed run the following:

    pip search nltk

    enter image description here

提交回复
热议问题