Merge branch 'main' of https://github.com/666ghj/Weibo_PublicOpinion_AnalysisSystem
This commit is contained in:
@@ -19,7 +19,7 @@ def getTopicPageCreatedAtCharData(topic):# 统计包含特定热词的评论在
|
||||
createdAt[i[1]] = 1
|
||||
return list(createdAt.keys()),list(createdAt.values())
|
||||
|
||||
def getCommentFilterData(topic):# 筛选包含特定热词的评论并返回这些评论的数据
|
||||
def getCommentFilterDataTopic(topic):# 筛选包含特定热词的评论并返回这些评论的数据
|
||||
commentsList = getAllCommentsData()
|
||||
commentData = []
|
||||
for i in commentsList:
|
||||
|
||||
+62
-32
@@ -1,18 +1,24 @@
|
||||
from flask import Flask,session,render_template,redirect,Blueprint,request
|
||||
from flask import Flask, session, render_template, redirect, Blueprint, request
|
||||
from snownlp import SnowNLP
|
||||
from utils.getHomePageData import *
|
||||
from utils.getHotWordPageData import *
|
||||
from utils.getTableData import *
|
||||
from utils.getPublicData import getAllHotWords
|
||||
from utils.getPublicData import getAllHotWords, getAllTopics
|
||||
from utils.getEchartsData import *
|
||||
pb = Blueprint('page',__name__,url_prefix='/page',template_folder='templates')
|
||||
from utils.getTopicPageData import *
|
||||
|
||||
pb = Blueprint('page',
|
||||
__name__,
|
||||
url_prefix='/page',
|
||||
template_folder='templates')
|
||||
|
||||
|
||||
@pb.route('/home')
|
||||
def home():
|
||||
username = session.get('username')
|
||||
articleLenMax,likeCountMaxAuthorName,cityMax = getHomeTagsData()
|
||||
articleLenMax, likeCountMaxAuthorName, cityMax = getHomeTagsData()
|
||||
commentsLikeCountTopFore = getHomeCommentsLikeCountTopFore()
|
||||
xData,yData = getHomeArticleCreatedAtChart()
|
||||
xData, yData = getHomeArticleCreatedAtChart()
|
||||
typeChart = getHomeTypeChart()
|
||||
createAtChart = getHomeCommentCreatedChart()
|
||||
# getUserNameWordCloud()
|
||||
@@ -25,17 +31,18 @@ def home():
|
||||
xData=xData,
|
||||
yData=yData,
|
||||
typeChart=typeChart,
|
||||
createAtChart=createAtChart
|
||||
)
|
||||
createAtChart=createAtChart)
|
||||
|
||||
|
||||
@pb.route('/hotWord')
|
||||
def hotWord():
|
||||
username = session.get('username')
|
||||
hotWordList = getAllHotWords()
|
||||
defaultHotWord = hotWordList[0][0]
|
||||
if request.args.get('hotWord'):defaultHotWord = request.args.get('hotWord')
|
||||
if request.args.get('hotWord'):
|
||||
defaultHotWord = request.args.get('hotWord')
|
||||
hotWordLen = getHotWordLen(defaultHotWord)
|
||||
xData,yData = getHotWordPageCreatedAtCharData(defaultHotWord)
|
||||
xData, yData = getHotWordPageCreatedAtCharData(defaultHotWord)
|
||||
sentences = ''
|
||||
value = SnowNLP(defaultHotWord).sentiments
|
||||
if value == 0.5:
|
||||
@@ -54,20 +61,45 @@ def hotWord():
|
||||
sentences=sentences,
|
||||
xData=xData,
|
||||
yData=yData,
|
||||
comments=comments
|
||||
)
|
||||
comments=comments)
|
||||
|
||||
|
||||
@pb.route('/hotTopic')
|
||||
def hotTopic():
|
||||
username = session.get('username')
|
||||
topicList = getAllTopics()
|
||||
defaultTopic = topicList[0][0]
|
||||
if request.args.get('topic'):
|
||||
defaultTopic = request.args.get('topic')
|
||||
topicLen = getTopicLen(defaultTopic)
|
||||
xData, yData = getTopicPageCreatedAtCharData()
|
||||
sentences = ''
|
||||
|
||||
# ... 这里要嵌入 topic 相关内容(热度?)来填充 sentences
|
||||
|
||||
comments = getCommentFilterDataTopic(defaultTopic)
|
||||
return render_template('hotWord.html',
|
||||
username=username,
|
||||
topicList=topicList,
|
||||
defaultTopic=defaultTopic,
|
||||
topicLen=topicLen,
|
||||
sentences=sentences,
|
||||
xData=xData,
|
||||
yData=yData,
|
||||
comments=comments)
|
||||
|
||||
|
||||
@pb.route('/tableData')
|
||||
def tableData():
|
||||
username = session.get('username')
|
||||
defaultFlag = False
|
||||
if request.args.get('flag'):defaultFlag = True
|
||||
if request.args.get('flag'): defaultFlag = True
|
||||
tableData = getTableDataList(defaultFlag)
|
||||
return render_template('tableData.html',
|
||||
username=username,
|
||||
tableData=tableData,
|
||||
defaultFlag=defaultFlag
|
||||
)
|
||||
defaultFlag=defaultFlag)
|
||||
|
||||
|
||||
@pb.route('/articleChar')
|
||||
def articleChar():
|
||||
@@ -75,9 +107,9 @@ def articleChar():
|
||||
typeList = getTypeList()
|
||||
defaultType = typeList[0]
|
||||
if request.args.get('type'): defaultType = request.args.get('type')
|
||||
xData,yData = getArticleCharLikeCount(defaultType)
|
||||
x1Data,y1Data = getArticleCharCommentsLen(defaultType)
|
||||
x2Data,y2Data = getArticleCharRepotsLen(defaultType)
|
||||
xData, yData = getArticleCharLikeCount(defaultType)
|
||||
x1Data, y1Data = getArticleCharCommentsLen(defaultType)
|
||||
x2Data, y2Data = getArticleCharRepotsLen(defaultType)
|
||||
return render_template('articleChar.html',
|
||||
username=username,
|
||||
typeList=typeList,
|
||||
@@ -87,8 +119,8 @@ def articleChar():
|
||||
x1Data=x1Data,
|
||||
y1Data=y1Data,
|
||||
x2Data=x2Data,
|
||||
y2Data=y2Data
|
||||
)
|
||||
y2Data=y2Data)
|
||||
|
||||
|
||||
@pb.route('/ipChar')
|
||||
def ipChar():
|
||||
@@ -98,27 +130,27 @@ def ipChar():
|
||||
return render_template('ipChar.html',
|
||||
username=username,
|
||||
articleRegionData=articleRegionData,
|
||||
commentRegionData=commentRegionData
|
||||
)
|
||||
commentRegionData=commentRegionData)
|
||||
|
||||
|
||||
@pb.route('/commentChar')
|
||||
def commentChar():
|
||||
username = session.get('username')
|
||||
xData,yData = getCommentCharDataOne()
|
||||
xData, yData = getCommentCharDataOne()
|
||||
genderPieData = getCommentCharDataTwo()
|
||||
return render_template('commentChar.html',
|
||||
username=username,
|
||||
xData=xData,
|
||||
yData=yData,
|
||||
genderPieData=genderPieData
|
||||
)
|
||||
genderPieData=genderPieData)
|
||||
|
||||
|
||||
@pb.route('/yuqingChar')
|
||||
def yuqingChar():
|
||||
username = session.get('username')
|
||||
xData,yData,bieData = getYuQingCharDataOne()
|
||||
bieData1,bieData2 = getYuQingCharDataTwo()
|
||||
x1Data,y1Data = getYuQingCharDataThree()
|
||||
xData, yData, bieData = getYuQingCharDataOne()
|
||||
bieData1, bieData2 = getYuQingCharDataTwo()
|
||||
x1Data, y1Data = getYuQingCharDataThree()
|
||||
return render_template('yuqingChar.html',
|
||||
username=username,
|
||||
xData=xData,
|
||||
@@ -127,12 +159,10 @@ def yuqingChar():
|
||||
bieData1=bieData1,
|
||||
bieData2=bieData2,
|
||||
x1Data=x1Data,
|
||||
y1Data=y1Data
|
||||
)
|
||||
y1Data=y1Data)
|
||||
|
||||
|
||||
@pb.route('/articleCloud')
|
||||
def articleCloud():
|
||||
username = session.get('username')
|
||||
return render_template('articleContentCloud.html',
|
||||
username=username
|
||||
)
|
||||
return render_template('articleContentCloud.html', username=username)
|
||||
|
||||
@@ -36,8 +36,6 @@ def register():
|
||||
if request.method == 'GET':
|
||||
return render_template('register.html')
|
||||
else:
|
||||
if request.form['password'] != request.form['checkPassword']:
|
||||
return errorResponse('两次密码不符合')
|
||||
|
||||
def filter_fn(user):
|
||||
return request.form['username'] in user
|
||||
|
||||
Reference in New Issue
Block a user