python - How to print out the full distribution of words in an LDA topic in gensim? -


the lda.show_topics module following code prints distribution of top 10 words each topic, how print out full distribution of words in corpus?

from gensim import corpora, models  documents = ["human machine interface lab abc computer applications", "a survey of user opinion of computer system response time", "the eps user interface management system", "system , human system engineering testing of eps", "relation of user perceived response time error measurement", "the generation of random binary unordered trees", "the intersection graph of paths in trees", "graph minors iv widths of trees , quasi ordering", "graph minors survey"]  stoplist = set('for of , in'.split()) texts = [[word word in document.lower().split() if word not in stoplist]          document in documents]  dictionary = corpora.dictionary(texts) corpus = [dictionary.doc2bow(text) text in texts]  lda = models.ldamodel.ldamodel(corpus_tfidf, id2word=dictionary, num_topics=2)  in lda.show_topics():     print 

there variable call topn in show_topics() can specify number of top n words require words distribution on each topic. see http://radimrehurek.com/gensim/models/ldamodel.html

so instead of default lda.show_topics(). can use len(dictionary) full word distributions each topic:

for in lda.show_topics(topn=len(dictionary)):     print 

Comments