def malletmodel2ldamodel(mallet_model, gamma_threshold=0.001, iterations=50):
 model_gensim = LdaModel(id2word=mallet_model.id2word, num_topics=mallet_model.num_topics, alpha=mallet_model.alpha, iterations=iterations, gamma_threshold=gamma_threshold)
 model_gensim.expElogbeta[:] = mallet_model.wordtopics
 return model_gensim

def malletmodel2ldamodel ( mallet_model , gamma_threshold = 0.001 , iterations = 50 ) : model_gensim = LdaModel ( id2word = mallet_model . id2word , num_topics = mallet_model . num_topics , alpha = mallet_model . alpha , iterations = iterations , gamma_threshold = gamma_threshold ) model_gensim . expElogbeta [ : ] = mallet_model . wordtopics return model_gensim
function to convert mallet model to gensim ldamodel .