analysis.py 文件源码

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

项目:my_bit_v1 作者: iSawyer 项目源码 文件源码
def text_rank():
    db = query_DB()
    stop_words = load_stopwords()
    for sample in db.get_one():
        author = sample[3]
        title = sample[1]
        content = sample[2]
        reply_number = sample[-1]
        if(author == 'mikki' or author == u'??'):
            continue
        if(reply_number >=3):
            title_seg = jieba.analyse.textrank(title,topK=5,withWeight=True,allowPOS=('ns','n','vn','v'))
            for word,weight in title_seg:
                weight *= 0.7 * (float(reply_number) / max_reply)
                db.write_textrank(word,weight)

        #content_seg = jieba.analyse.textrank(content,topK=8,withWeight=True,allowPOS=('ns','n','vn','v'))
        #for word,weight in content_seg:
            #weight *= 0.3 * (float(reply_number) / max_reply)
            #db.write_textrank(word,weight)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号