【发布时间】:2019-08-09 09:01:22
【问题描述】:
我真正想要的是对单词和短语进行聚类,例如 针织/针织织机/织机针织/织布机/彩虹织机/家居装饰配件/织机针织/针织织机/......我没有语料库,而我只有单词/短语。我可以使用像 GoogleNews/Wikipedia/... 这样的预训练模型来实现它吗?
我现在正在尝试使用 Gensim 加载 GoogleNews 预训练模型以获取短语相似度。有人告诉我,GoogleNews 模型包括短语和单词的向量。但是我发现我只能获得单词相似性,而短语相似性失败并显示该短语不在词汇表中的错误消息。请给我提意见。谢谢。
import gensim
from gensim.models import Word2Vec
from gensim.models.keyedvectors import KeyedVectors
GOOGLE_MODEL = '../GoogleNews-vectors-negative300.bin'
model = gensim.models.KeyedVectors.load_word2vec_format(GOOGLE_MODEL, binary=True)
# done well
model.most_similar("computer", topn=3)
# done with error message "computer_software" is not in the vocabulory.
model.most_similar("computer_software", topn=3)
【问题讨论】: