(0,
'0.707*"उत्तरपश्चिमी" + 0.707*"यूरोप" + -0.000"बुद्ध" + -0.000*"जन्म" + '
'0.000*"बेल्जियम" + 0.000*"किंगडम" + 0.000*"नेपाल" + 0.000*"ऑफ़" + '
'-0.000"युन" + -0.000"स्थली"*')]
Where as the documentation says
show_topics(num_topics=-1, num_words=10, log=False, formatted=True)
Return num_topics most significant topics (return all by default).
For each topic, show num_words most significant words (10 words by default).
The topics are returned as a list – a list of strings if formatted is True, or a list of (word, probability) 2-tuples if False.
If log is True, also output this result to log.
def preprocessing(corpus):
for document in corpus:
doc = strip_short(document,3)
doc = strip_punctuation(doc)
yield word_tokenize(doc)
texts = preprocessing(corpus)
dictionary = corpora.Dictionary(texts)
dictionary.filter_extremes(no_below=1, keep_n=25000)
doc_term_matrix = [dictionary.doc2bow(tokens) for tokens in preprocessing(corpus)]
tfidf = models.TfidfModel(doc_term_matrix)
corpus_tfidf = tfidf[doc_term_matrix]
lsi = models.LsiModel(corpus_tfidf, id2word=dictionary)
pprint(lsi.show_topics(num_topics=4, num_words=10))
[(0,
'0.707*"उत्तरपश्चिमी" + 0.707*"यूरोप" + -0.000*"बुद्ध" + -0.000*"जन्म" + '
'0.000*"बेल्जियम" + 0.000*"किंगडम" + 0.000*"नेपाल" + 0.000*"ऑफ़" + '
'-0.000*"युन" + -0.000*"स्थली"'),
(1,
'0.577*"किंगडम" + 0.577*"बेल्जियम" + 0.577*"ऑफ़" + -0.000*"जन्म" + '
'-0.000*"बुद्ध" + -0.000*"भगवान" + -0.000*"स्थित" + -0.000*"लुंबिनी" + '
'-0.000*"उत्तरपश्चिमी" + -0.000*"यूरोप"'),
(2,
'0.354*"जन्म" + 0.354*"भगवान" + 0.354*"स्थित" + 0.354*"स्थली" + 0.354*"युन" '
'+ 0.354*"बुद्ध" + 0.354*"लुंबिनी" + 0.354*"नेपाल" + 0.000*"उत्तरपश्चिमी" + '
'0.000*"यूरोप"')]