【发布时间】:2020-05-06 00:22:50
【问题描述】:
我已经标记了我的字符串并用它们制作了一个 Pandas 列,如果我打印列 df['word_splits'] 它看起来像这样。
0 ['explanation', 'why', 'the', 'edits', 'made',...
1 ["d'aww", '!', 'he', 'matches', 'this', 'backg...
2 ['hey', 'man', ',', "i'm", 'really', 'not', 't...
3 ['more', 'i', "can't", 'make', 'any', 'real', ...
4 ['you', ',', 'sir', ',', 'are', 'my', 'hero', ...
Name: word_splits, dtype: object
接下来,我正在运行 Word2Vec
model = gensim.models.Word2Vec(sentences=df["word_splits"])
当我打印出词汇时,使用
words = list(model.wv.vocab)
print(words)
我得到的是字符而不是一长串单词(词汇)。
['[', "'", 'e', 'x', 'p', 'l', 'a', 'n', 't', 'i', 'o', ',', ' ', 'w', 'h', 'y', 'd', 's', 'm', 'u', 'r', 'c', 'f', 'v', '?', '"', 'j', 'g', 'k', '.', ']', '!', 'b', '-', 'q', 'z']
不知道我做错了什么。
【问题讨论】: