請原諒我在這裏的新鮮感,但是fasttext在Python上並不適合我。我正在使用運行python 3.6的anaconda。我的代碼如下(只是一個例子):Fasttext for Python - 模塊'fasttext'沒有屬性'load_model'
import fasttext
model = fasttext.load_model('/home/sproc/share/fastText/model.bin')
print(model.words)
這將返回以下錯誤:
Traceback (most recent call last):
File "/media/sf_VBoxShare/LiClipseWorkspace/test/testpack/fasttext.py", line 1, in <module>
import fasttext
File "/media/sf_VBoxShare/LiClipseWorkspace/test/testpack/fasttext.py", line 3, in <module>
model = fasttext.load_model('/home/sproc/share/fastText/model.bin')
AttributeError: module 'fasttext' has no attribute 'load_model'
試圖創建詞矢量時做同樣的事情與cbow和skipgram。我檢查.../site-packages/fasttext目錄中的init .py文件,並且它會導入所述屬性,但它們不是model.py模塊的一部分。我猜這與共享對象文件有關,但我不確定。任何幫助是極大的讚賞。
它看起來像一些二進制文件丟失 – Akshay
@akshay任何想法可能是什麼?我在'〜/ share/fasttext'下安裝了fasttext(標準c工具),並且我使用'pip install fasttext'安裝了fasttext,所以我不確定可能是什麼問題。 – spencerktm30
您是否在使用Anaconda。如果是這樣的話,Cython應該能夠編譯它。如果不嘗試安裝Anaconda,然後用pip – Akshay