【getHowWordPageData.py】提取热词和相关函数定义

This commit is contained in:
juanboy
2024-07-02 18:54:21 +08:00
parent d5f19e9d73
commit 2af147fcb2
6 changed files with 2032 additions and 1 deletions
+17 -1
View File
@@ -1,4 +1,7 @@
from utils.query import query
import re
import sys
import pandas as pd
sys.path.append('model')
cityList = [
@@ -72,4 +75,17 @@ def getAllCommentsData():
def getAllArticleData():
articleList = query('select * from article',[],'select')
return articleList
return articleList
def getAllHotWords():
data = []
df = pd.read_csv('./model/cipingTotal.csv',encoding='utf8')
for i in df.values:
try:
data.append([
re.search('[\u4e00-\u9fa5]+',str(i)).group(),
re.search('\d+',str(i)).group()
])
except:
continue
return data