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 = FreqDist()
for word in gutenberg.words('austen-sense.txt'):
fd.inc(word)
If I run this I get the following error:
AttributeError: 'FreqDist' object has no attribute 'inc'
Any idea what I am doing wrong?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…