from datetime import datetime
from gensim import corpora, models
import logging
start = datetime.now()
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
corpus = corpora.MmCorpus('corpus.mm')
dictionary = corpora.Dictionary.load('dict.dict')
path_to_mallet='C:/mallet/bin/mallet'
lda = models.LdaMallet(path_to_mallet, corpus, num_topics=100, id2word=dictionary)
corpus_lda= lda[corpus]
corpora.MmCorpus.serialize('corpusldamallet.mm', corpus_lda)
lda.save('ldamodelmallet.lda')
difference = datetime.now() - start
print difference
print model[bow]
sorted based on second column and finally got the result
(3425, 0.008556263269638363),
(3447, 0.008556263269638363),
(4477, 0.008556263269638363),
(704, 0.009971691436658773),
(1809, 0.01138711960367918),
(2055, 0.01704883227176081),
(1608, 0.01775654635527102),
(1974, 0.01846426043878122),
(1526, 0.02341825902335264),
(4944, 0.034033970276005694)]Thanks.Today i played with the topic word text file and i can now print top 10 topics sorted based on weight and printing them along with their topic.For the patch, Is the desired function would be to print topics on the right hand side with the command: print model[bow]Or maybe i should just try to keep same behavior as in 'model.show_topics()' of gensim lda.
----> 1 model.show_topic(1)
/home/test/software/gensim_dev/gensim/gensim/models/ldamallet.py in show_topic(self, topicid, topn)
150 bestn = np.argsort(topic)[::-1][:topn]
151 beststr = [(topic[id], self.id2word[id]) for id in bestn]
--> 152 return beststr
153
154 def convert_input(self, corpus, infer=False):
NameError: global name 'numpy' is not defined