输入代码如下:
import gensim
import gensim.corpora as corpora
from gensim.utils import simple_preprocess
from gensim.models import CoherenceModel
import os
os.environ.update({'MALLET_HOME':r'C:/Users/Pying/Downloads/mallet/mallet-2.0.8/'})
mallet_path = 'C:\\Users\\Pying\\Downloads\\mallet\\mallet-2.0.8\\bin\\mallet'
ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, num_topics=15, id2word=id2word)
报错如下:
AttributeError Traceback (most recent call last)
<ipython-input-14-e1a0fe67b1a6> in <module>
6
7 mallet_path = 'C:\\Users\\Pying\\Downloads\\mallet\\mallet-2.0.8\\bin\\mallet'
----> 8 ldamallet = gensim.models.wrappers.LdaMallet(mallet_path, corpus=corpus, num_topics=15, id2word=id2word)
AttributeError: module 'gensim.models' has no attribute 'wrappers'