How to use word2vec to calculate the similarity distance by giving 2 words?

后端 未结 4 814
庸人自扰
庸人自扰 2020-12-12 18:12

Word2vec is a open source tool to calculate the words distance provided by Google. It can be used by inputting a word and output the ranked word lists according to the simil

4条回答
  •  旧时难觅i
    2020-12-12 18:53

    gensim has a Python implementation of Word2Vec which provides an in-built utility for finding similarity between two words given as input by the user. You can refer to the following:

    1. Intro: http://radimrehurek.com/gensim/models/word2vec.html
    2. Tutorial: http://radimrehurek.com/2014/02/word2vec-tutorial/

    The syntax in Python for finding similarity between two words goes like this:

    >> from gensim.models import Word2Vec
    >> model = Word2Vec.load(path/to/your/model)
    >> model.similarity('france', 'spain')
    

提交回复
热议问题