成功解决AttributeError: 'Word2Vec' object has no attribute 'index2word'





目录

​解决问题​

​解决思路​

​解决方法​








解决问题

AttributeError: 'Word2Vec' object has no attribute 'index2word'





解决思路

from gensim.models import word2vec

python的Gensim包升级版本后,里面很多调用方法已经发生了改变,所以要查看API,对于以前使用的方法,查看升级后,改进的调用方法。





解决方法

model.index2word

改为

model.wv.index2word

哈哈,大功告成!