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 =
You should do it like so:
fd[word] += 1
But usually FreqDist is used like this:
fd = FreqDist(my_text)
Also look at the examples here:
http://www.nltk.org/book/ch01.html