【发布时间】:2017-12-12 11:48:34
【问题描述】:
我在语料库上应用了来自 gensim 包的 LDA,我得到了每个术语的概率。我的问题是我如何只得到没有概率的条款。 这是我的代码:
K = ldamodel.num_topics
t = 0
topicWordProbMat = ldamodel.print_topics(K)
for topic_dist in topicWordProbMat:
print('Topic #',t,topic_dist)
t = t + 1
作为例子的输出是这样的:
Topic # 0 '0.181*things + 0.181*amazon + 0.181*good
Topic # 1 '0.031*nokia + 0.031*microsoft + 0.031*apple
我想要这样:
Topic # 0 things amazon good
Topic # 1 nokia microsoft apple
知道怎么做吗?提前致谢
【问题讨论】:
标签: python-3.x gensim lda