def LSI_fit(self, data):
'''
Fits an LSI model and returns it with associated dictionary
'''
texts = [[tag for tag in sent] for sent in self.get_pos(data)]
dictionary = corpora.Dictionary(texts)
texts = map(dictionary.doc2bow, texts)
lsi = models.LsiModel(texts, id2word=dictionary,
num_topics=self.num_topics)
return dictionary, lsi
评论列表
文章目录