我正在尝试使用FastText Python API https://pypi.python.org/pypi/fasttext虽然,根据我的阅读,这个API不能像https://github.com/facebookresearch/fastText/blob/master/pretrained-vectors.md中建议的那样在https://github.com/salestock/fastText.py/issues/115加载更新的.bin模型文件
我已经尝试了在那个问题上提出的所有内容,而且https://github.com/Kyubyong/wordvectors没有英语的.bin,否则问题就会解决。有没有人知道这方面的解决方法?
请尝试以下步骤来解决此问题。在加载语言识别模型时,它与我一起使用Python 3.5。
git clone https://github.com/facebookresearch/fastText.git
cd fastText
pip install .
你不能使用pip安装的包fasttext
。您可以使用fastText
repo中的install fasttext
(capital T)。
你可以试试pyfasttext:
!pip3 install pyfasttext
from pyfasttext import FastText
model = FastText("./model_position")
有效,但有一些兼容性问题,例如你可以使用model.args [“dim”]来替换get_dimension()