我正在尝试使用 Glove 对单词向量进行编码,但出现上述错误。数据由两个文本列组成,用于确定句子相似度。你能帮我解决这个错误吗?
[代码]
embeddings_index = {}
f = open(r'C:\Users\15084\Downloads\glove.840B.300d\glove.840B.300d.txt',errors =
'ignore',encoding='utf-8')
for line in f:
values = line.split()
word = values[0]
coefs = np.asarray(values[1:], dtype='float32')
embeddings_index[word] = coefs
f.close()
print('Found %s word vectors.' % len(embeddings_index))