def download_embedding():
"""
Download files from web
Seems cannot download by pgm
Download from: https://sites.google.com/site/rmyeid/projects/polyglot
Returns:
A tuple (word, embedding). Emebddings shape is (100004, 64).
"""
assert (tf.gfile.Exists(FLAGS.chr_embedding_dir)), (
"Embedding pkl don't found, please \
download the Chinese chr embedding from https://sites.google.com/site/rmyeid/projects/polyglot"
)
with open(FLAGS.chr_embedding_dir, 'rb') as f:
u = pickle._Unpickler(f)
u.encoding = 'latin1'
p = u.load()
return p
评论列表
文章目录