gensim show_topics get topic code example
Example: gensim show_topics get topic
# 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]