UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 3136: illegal mult
作者:互联网
import codecs
def read_glove_vecs(glove_file):
with open(glove_file, 'r', encoding='utf-8') as f: # 修改这个
words = set()
word_to_vec_map = {}
for line in f:
line = line.strip().split()
curr_word = line[0]
words.add(curr_word)
word_to_vec_map[curr_word] = np.array(line[1:], dtype=np.float64)
return words, word_to_vec_map
重启jupyter
标签:map,curr,sequence,illegal,multibyte,vec,words,word,line 来源: https://www.cnblogs.com/douzujun/p/13210881.html