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') | |
outfile.write(text) | |
outfile.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment