0
def generateTopics(corpus, dictionary):
# Build LDA model using the above corpus
lda = models.ldamodel.LdaModel(corpus, id2word=dictionary, num_topics=50)
corpus_lda = lda[corpus]
# Group topics with similar words together.
tops = set(lda.show_topics(50))
top_clusters = []
for l in tops:
top = []
for t in l.split(" + "):
top.append((t.split("*")[0], t.split("*")[1]))
top_clusters.append(top)
我想在本代碼中使用lda.but來獲取主題,當我嘗試將具有相似詞語的主題組合在一起時,我得到此錯誤。 for lsplit(「+」): AttributeError:'元組'對象沒有屬性'split'gettinf錯誤'元組'對象沒有屬性'拆分'
謝謝you.it工作 – user3778289