【发布时间】:2021-05-08 11:46:43
【问题描述】:
import numpy as np
%matplotlib notebook
import matplotlib.pyplot as plt
plt.style.use ('ggplot')
from sklearn.manifold import TSNE
from sklearn.decomposition import PCA
from gensim.test.utils import datapath, get_tmpfile
from gensim.models import KeyedVectors
from gensim.scripts.glove2word2vec import glove2word2vec
glove_file = datapath('c:\Users\Lenovo\AppData\glove.6B.100d.word2vec.txt')
word2vec_glove_file = get_tmpfile("glove.6B.100d.word2vec.txt")
glove2word2vec(glove_file, word2vec_glove_file)
我正在尝试使用 Glove 矢量。但它会产生如下语法错误:
File "<ipython-input-27-b7974d8ef44b>", line 1
glove_file = datapath('\Users\Lenovo\AppData\glove.6B.100d.word2vec.txt')
^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-1: truncated \UXXXXXXXX escape
有谁知道如何解决这个问题?谢谢。
【问题讨论】:
标签: nlp stanford-nlp word2vec