<reponame>ashwath92/MastersThesis<gh_stars>1-10
from gensim import corpora, models, similarities
from gensim.models.wrappers import LdaMallet
# If mallet doesn't work, use normal LDA.
from gensim.models.ldamodel import LdaModel
import subprocess

corpus = corpora.MmCorpus('/home/ashwath/Programs/ACLAAn/LDA/aclmag_bow_corpus.mm')
try:
    ldamallet = LdaMallet.load('/home/ashwath/Programs/ACLAAn/LDA/lda_model.model')
    #vec_bow_test = id2word_dictionary.doc2bow(['test'])
    #vec_ldamallet = ldamallet[vec_bow_test]
except subprocess.CalledProcessError:
    print("LDA MALLET COULDN'T READ INSTANCE FILE. USING NORMAL LDA INSTEAD")
    ldamallet = LdaModel.load('/home/ashwath/Programs/ACLAAn/LDA/ldanormal_acl.model')

index = similarities.MatrixSimilarity(ldamallet[corpus])
index.save("simIndexAcl.index")
