Xdocwords = [] Y = [] for category in brown.categories(): for fileid in brown.fileids(category): for word in brown.words(categories=category): word