Instantly share code, notes, and snippets.

@yaronv /
Last active Sep 5, 2018

What would you like to do?
stream documents one by one from the disc
class MyCorpus(object):
def __iter__(self):
for line in open('mycorpus.txt'):
# assume there's one document per line, tokens separated by whitespace
yield dictionary.doc2bow(line.lower().split())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment