tensorflow
tensorflow copied to clipboard
word2vec_basic.py line 54, yield instead of return
# Read the data into a string.
def read_data(filename):
f = zipfile.ZipFile(filename)
for name in f.namelist():
return f.read(name).split() ### SHOULD BE: yeild f.read(name).split()?
f.close()
Oringial sample data got one big txt file in the zip file.
def read_data(filename):
with zipfile.ZipFile(filename) as f:
for name in f.namelist():
yield f.read(name).split()
(Feel free to send us a pull request to fix this if you'd like)
@fivejjs: Would you be up for sending a PR? Your suggested code is indeed much better.
this looks like it has been changed already by a different commit