我试图从这里加载 fastText 预训练模型Fasttext 模型。我正在使用wiki.simple.en
from gensim.models.keyedvectors import KeyedVectors
word_vectors = KeyedVectors.load_word2vec_format('wiki.simple.bin', binary=True)
但是,它显示以下错误
Traceback (most recent call last):
File "nltk_check.py", line 28, in <module>
word_vectors = KeyedVectors.load_word2vec_format('wiki.simple.bin', binary=True)
File "P:\major_project\venv\lib\sitepackages\gensim\models\keyedvectors.py",line 206, in load_word2vec_format
header = utils.to_unicode(fin.readline(), encoding=encoding)
File "P:\major_project\venv\lib\site-packages\gensim\utils.py", line 235, in any2unicode
return unicode(text, encoding, errors=errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 0: invalid start byte
问题 1如何使用 Gensim 加载 fasttext 模型?
问题2另外,加载模型后,我想找到两个单词之间的相似度
model.find_similarity('teacher', 'teaches')
# Something like this
Output : 0.99
我该怎么做呢?