Conditional frequency distribution

Let's going through O'Reilly's textbook chapter 2.2.

Already used ConditionalFreqDist in the previous chapters. ConditionalFreqDist receives "list of pairs", condition and object. This example is to get pairs of each genre and words in Brown corpus.

[code language="language="python'"]
>>> import nltk
>>> from nltk.corpus import brown
>>> cfd = nltk.ConditionalFreqDist(
... (genre, word)
... for genre in brown.categories()
... for word in brown.words(categories=genre))
|