NLP - Topic Modeling
Given the following Python code snippet using gensim LDA, what will
print(ldamodel.num_topics) output?from gensim import corpora, models texts = [['apple', 'banana', 'apple'], ['banana', 'orange'], ['apple', 'orange', 'banana']] dictionary = corpora.Dictionary(texts) corpus = [dictionary.doc2bow(text) for text in texts] ldamodel = models.LdaModel(corpus, num_topics=2, id2word=dictionary, passes=10) print(ldamodel.num_topics)
