How to find similar words with FastText?

前端 未结 5 1747
清酒与你
清酒与你 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条回答
  •  Happy的楠姐
    2021-02-08 19:20

    You can install pyfasttext library to extract the most similar or nearest words to a particualr word.

    from pyfasttext import FastText
    model = FastText('model.bin')
    model.nearest_neighbors('dog', k=2000)
    

    Or you can get the latest development version of fasttext, you can install from the github repository :

    import fasttext
    model = fasttext.load_model('model.bin')
    model.get_nearest_neighbors('dog', k=100)
    

提交回复
热议问题