iqss_interface.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:tRECS 作者: TeeOhh 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号