小编use*_*487的帖子

AttributeError:'FreqDist'对象没有属性'inc'

我是Python和NLTK的初学者.我试图从教程中运行以下代码:

from nltk.corpus import gutenberg
from nltk import FreqDist

fd = FreqDist()

for word in gutenberg.words('austen-sense.txt'):
    fd.inc(word)
Run Code Online (Sandbox Code Playgroud)

如果我运行这个我收到以下错误:

AttributeError: 'FreqDist' object has no attribute 'inc'
Run Code Online (Sandbox Code Playgroud)

知道我做错了什么吗?

python attributes nltk python-2.7

13
推荐指数
2
解决办法
8907
查看次数

标签 统计

attributes ×1

nltk ×1

python ×1

python-2.7 ×1