How to find similar words with FastText?

前端 未结 5 1687
清酒与你
清酒与你 2021-02-08 18:41

I am playing around with FastText, https://pypi.python.org/pypi/fasttext,which is quite similar to Word2Vec. Since it seems to be a pretty new library

5条回答
  •  南笙
    南笙 (楼主)
    2021-02-08 19:04

    You can install and import gensim library and then use gensim library to extract most similar words from the model that you downloaded from FastText.

    Use this:

    import gensim
    model = gensim.models.KeyedVectors.load_word2vec_format('model.vec')
    similar = model.most_similar(positive=['man'],topn=10)
    

    And by topn parameter you get the top 10 most similar words.

提交回复
热议问题