Last active
October 16, 2016 11:34
-
-
Save ulgens/28d9f6bf59aa8adc3da14464045149e4 to your computer and use it in GitHub Desktop.
Export Brown Corpus tagged words by categories using NLTK. Based on: https://gist.github.com/JonathanReeve/ac543e9541d1647c1c3b
This file contains hidden or 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.tagged_words(categories=category) | |
text = '\n '.join('%s, %s' % word for word in words) | |
filename = category + '.txt' | |
with open(filename, 'w') as outfile: | |
outfile.write(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment