juanboy

舆情函数定义

1 from utils.query import query 1 from utils.query import query
2 from utils.getPublicData import * 2 from utils.getPublicData import *
  3 +from model2.model_use import *
3 articleList = getAllArticleData() 4 articleList = getAllArticleData()
4 commentList = getAllCommentsData() 5 commentList = getAllCommentsData()
5 6
@@ -31,22 +32,14 @@ def drop_label1():# 删除标注列 @@ -31,22 +32,14 @@ def drop_label1():# 删除标注列
31 params = [] 32 params = []
32 query(sql, params) 33 query(sql, params)
33 34
34 -  
35 # 处理数据并添加标注 35 # 处理数据并添加标注
36 -def process_data(data):  
37 - processed_data =testmodel(data)  
38 - return processed_data  
39 -  
40 -def testmodel(test):  
41 - return "wicao"  
42 -  
43 def topicdefine(): 36 def topicdefine():
44 label_article=[] 37 label_article=[]
45 label_comments=[] 38 label_comments=[]
46 for x in articleList: 39 for x in articleList:
47 - label_article.append((x[0],process_data(x[5]))) 40 + label_article.append((x[0],predict_topic(x[5])))
48 for x in commentList: 41 for x in commentList:
49 - label_comments.append((x[5],process_data(x[4]))) 42 + label_comments.append((x[5],predict_topic(x[4])))
50 return label_article,label_comments 43 return label_article,label_comments
51 44
52 # 更新数据库 45 # 更新数据库