Monday, May 25, 2009

Menghitung jumlah huruf pada tiap genre

>>> from nltk.corpus import brown
>>> cfd = nltk.ConditionalFreqDist(
... (genre, word)
... for genre in brown.categories()
... for word in brown.words(categories=genre))


>>> genre_word = [(genre, word)
... for genre in ['news', 'romance']
... for word in brown.words(categories=genre)]
>>> len(genre_word)
170576

No comments:

Post a Comment