小编Ski*_*ish的帖子

Python 中的 Word Mover 距离

我正在尝试使用 WMD 计算 2 个文本的相似度。我尝试在 Python 3 中使用以下代码,使用 gensim:

word2vec_model = gensim.models.KeyedVectors.load_word2vec_format('GoogleNews-vectors-negative300.bin', binary=True)
word2vec_model.init_sims(replace=True) # normalizes vectors
distance = word2vec_model.wmdistance("string 1", "string 2")  # Compute WMD as normal.
Run Code Online (Sandbox Code Playgroud)

但是,我认为这并没有给我带来正确的价值。我应该如何在 python 中做到这一点?

python text nlp information-retrieval python-3.x

3
推荐指数
1
解决办法
4026
查看次数

标签 统计

information-retrieval ×1

nlp ×1

python ×1

python-3.x ×1

text ×1