Answers for "gensim show_topics get topic"

0

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]
Posted by: Guest on April-20-2021

Python Answers by Framework

Browse Popular Code Answers by Language