📜  gensim show_topics 获取主题 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:13.045000             🧑  作者: Mango

代码示例1
# based on the answer given by user in the source link

from gensim.models import LdaModel

# lda = LdaModel(...)
# ... after training ...
x = lda.show_topics(num_topics=12, num_words=5, formatted=False)

# tp[0]: topic
# tp[1]: weight of the word for the corresponding topic
topics_words = [(tp[0], tp[1]) for tp in x]