TensorFlow-Examples
TensorFlow-Examples copied to clipboard
Word2Vec
It seems this code is written in python2. It may come across several problems.
- for reading data part.
using
text_words = (f.read(f.namelist()[0]).lower().decode('utf-8')).split()
ortext_words =tf.compat.as_str(f.read(f.namelist()[0])).split()
convert b string to str - xrange to range
thank you!
Very thanks!
in python3,
- I change xrange to range
- run, and occur the error, AttributeError: module 'urllib' has no attribute 'urlretrieve' Fixed by follow:
filename, _ = urllib.urlretrieve(url, data_path)
need to change
filename, _ = urllib.request.urlretrieve(url, data_path)