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

c# - Validate object ID from GET to POST -

php - Find a regex to take part of Email -

javascript - Function overwritting -