Last active
September 5, 2018 06:32
-
-
Save yaronv/e39156d4effb25709be98bb0cff1df7a to your computer and use it in GitHub Desktop.
stream documents one by one from the disc
This file contains 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
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