python - Printing Simplified Corpus to Json File -


i'm trying print out brown corpus simplified tagset file. code i'm using, , ending blank file.

import json import nltk nltk.corpus import brown  brown_sents = nltk.corpus.brown.tagged_sents(tagset="universal")  sent in brown_sents:   open('brown_corpus.txt', 'a') outfile:      json.dumps(sent, outfile) 

json.dumps() meant returning str, not writing open file. use

json.dump(sent, outfile) 

instead, , should fine.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -