舆情预测函数定义

This commit is contained in:
juanboy
2024-07-04 14:44:17 +08:00
parent 70e82a2c29
commit f0449e7706
4 changed files with 145 additions and 5 deletions
@@ -39,7 +39,7 @@ def topicdefine():
for x in articleList:
label_article.append((x[0],predict_topic(x[5])))
for x in commentList:
label_comments.append((x[5],predict_topic(x[4])))
label_comments.append((x[8],predict_topic(x[4])))
return label_article,label_comments
# 更新数据库
@@ -53,7 +53,7 @@ def update_data():
params = [str(label),str(id)]
query(sql, params)
for row in label_comments:
label, id = row
id, label = row
sql = "UPDATE comments SET label = %s WHERE authorName = %s"
params = [str(label),str(id)]
query(sql, params)