Export Brown Corpus categories to text files using NLTK.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
|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')|