Das lda.show_topics
Modul aus dem folgenden Code druckt nur die Verteilung der Top 10 Wörter für jedes Thema, wie drucke ich die vollständige Verteilung aller Wörter im Korpus aus?Wie wird die vollständige Verteilung von Wörtern in einem LDA-Thema in Gensim ausgedruckt?
from gensim import corpora, models
documents = ["Human machine interface for lab abc computer applications",
"A survey of user opinion of computer system response time",
"The EPS user interface management system",
"System and human system engineering testing of EPS",
"Relation of user perceived response time to error measurement",
"The generation of random binary unordered trees",
"The intersection graph of paths in trees",
"Graph minors IV Widths of trees and well quasi ordering",
"Graph minors A survey"]
stoplist = set('for a of the and to in'.split())
texts = [[word for word in document.lower().split() if word not in stoplist]
for document in documents]
dictionary = corpora.Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
lda = models.ldamodel.LdaModel(corpus_tfidf, id2word=dictionary, num_topics=2)
for i in lda.show_topics():
print i
Sie könnten die Hacky Sache, und das LDA-Paket in Website-Paketen ändern (oder wo auch immer Sie es auf Ihrem Computer gespeichert ist), sie alle drucken oder kopieren, ihren Code für sie in Ihr Programm, und ändern um alle anstelle von 10 auszudrucken. – debianplebian
habe gerade die Antwort gefunden, sie ist irgendwie in der API versteckt =). Siehe Antwort unter – alvas
gute Arbeit finden Sie Ihre eigene Antwort. – debianplebian