作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试从 fastext - wiki word vectors 加载预训练的 FastText 向量.
我的代码在下面,它运行良好。
from gensim.models import FastText
model = FastText.load_fasttext_format('./wiki.en/wiki.en.bin')
gensim_fasttext_pretrained_vector.py:13: DeprecationWarning: Call to deprecated `load_fasttext_format` (use load_facebook_vectors (to use pretrained embeddings)
load_fasttext_format
将被弃用,因此最好使用
load_facebook_vectors
.
from gensim.models import FastText
model = FastText.load_facebook_vectors('./wiki.en/wiki.en.bin')
Traceback (most recent call last):
File "gensim_fasttext_pretrained_vector.py", line 13, in <module>
model = FastText.load_facebook_vectors('./wiki.en/wiki.en.bin')
AttributeError: type object 'FastText' has no attribute 'load_facebook_vectors'
最佳答案
你快到了,你需要改变两件事:
fasttext
所有小写字母,而不是 Fasttext
. load_facebook_vectors
,您需要先创建一个 datapath
对象之前使用它。 from gensim.models import fasttext
from gensim.test.utils import datapath
wv = fasttext.load_facebook_vectors(datapath("./wiki.en/wiki.en.bin"))
关于python - gensim - fasttext - 为什么 `load_facebook_vectors` 不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62059196/
我尝试从 fastext - wiki word vectors 加载预训练的 FastText 向量. 我的代码在下面,它运行良好。 from gensim.models import FastTe
我是一名优秀的程序员,十分优秀!