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)
评论列表
文章目录