Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Export Brown Corpus categories to text files using NLTK.
import nltk
from nltk.corpus import brown
for category in brown.categories():
words = brown.words(categories=category)
text = " ".join(words)
filename = category + '.txt'
outfile = open(filename, 'w')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment