def build_tfidf_base(self, corpus, bow_matrix):
## Description: Build and save objects common to TFIDF and LSA
## Params: Corpus, BOW matrix
## Returns: TF-IDF corpus and matrix
tfidf_model = models.TfidfModel(corpus)
tfidf_corpus= tfidf_model[corpus]
tfidf_matrix = bow_matrix.apply(lambda x: tfidf_model[x[0]], 1)
return tfidf_corpus, tfidf_matrix
#MODEL OBJECTS
#A model object consists of gensim similarity index and matrix containing transformed data
评论列表
文章目录