Il modulo lda.show_topics
dal seguente codice stampa solo la distribuzione delle prime 10 parole per ciascun argomento, come posso stampare la distribuzione completa di tutte le parole nel corpus?Come stampare la distribuzione completa delle parole in un argomento LDA in gensim?
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
Si potrebbe fare la cosa hacky, e cambiare il pacchetto lda in site-packages (o dovunque sia sul computer) per stampare tutti loro, o copiare il codice per esso nel vostro programma, e cambiarlo per stampare tutto invece di 10. – debianplebian
hai appena trovato la risposta, è una specie di nascosto nell'api =). Vedi risposta sotto – alvas
buon lavoro a trovare la tua risposta. – debianplebian