Entries from 2013-05-12 to 1 day
20. >>> def word_freq(word, section): ... fdist = FreqDist([w for w in nltk.corpus.brown.words(categories=section)]) ... return fdist.__getitem__(word) ... >>> word_freq('love', 'romance') 32 >>> word_freq('city', 'government') 7 >>> word_…