tensorflow icon indicating copy to clipboard operation
tensorflow copied to clipboard

word2vec_basic.py line 54, yield instead of return

Open fivejjs opened this issue 10 years ago • 3 comments

# 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() 

fivejjs avatar Jan 13 '16 08:01 fivejjs

(Feel free to send us a pull request to fix this if you'd like)

vrv avatar Jan 16 '16 19:01 vrv

@fivejjs: Would you be up for sending a PR? Your suggested code is indeed much better.

girving avatar Mar 08 '16 19:03 girving

this looks like it has been changed already by a different commit

itsmeolivia avatar May 10 '16 20:05 itsmeolivia