hornwong 发表于 2020-7-27 21:39:17

gensim 做LDA主题分析出现错误

用gensim做LDA主题分析,提示属性错误
>>> from gensim import corpora,models
>>> dictionary=corpora.Dictionary(chaplist)
>>> corpus=

>>> from gensim.models.ldamodel import LdaModel
>>> lda=models.ldamodel.Ldamodel(corpus,id2word=dictionary,num_topics=10,passes=5)
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
    lda=models.ldamodel.Ldamodel(corpus,id2word=dictionary,num_topics=10,passes=5)
AttributeError: module 'gensim.models.ldamodel' has no attribute 'Ldamodel'

Twilight6 发表于 2020-7-27 22:56:25


后面两段代码,不应该这样的吗?

from gensim.models.ldamodel import LdaModel

lda=LdaModel(corpus,id2word=dictionary,num_topics=10,passes=5)
页: [1]
查看完整版本: gensim 做LDA主题分析出现错误