Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
juanboy
2024-07-05 01:38:10 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2713bf9fe24c34d0b845cb6aeda72dfabb60f233
2713bf9f
1 parent
82bf846b
话题预测界面
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
665 additions
and
33 deletions
utils/cipingTotal.py
utils/getPublicData.py
utils/yuqingpredict.py
views/page/page.py
views/page/templates/articleChar.html
views/page/templates/articleContentCloud.html
views/page/templates/base_page.html
views/page/templates/commentChar.html
views/page/templates/hotWord.html
views/page/templates/ipChar.html
views/page/templates/tableData.html
views/page/templates/yuqingChar.html
views/page/templates/yuqingpredict.html
utils/cipingTotal.py
View file @
2713bf9
...
...
@@ -23,9 +23,10 @@ def main():
# 格式整理
list_count
=
sorted
(
word_count
.
items
(),
key
=
lambda
x
:
x
[
1
],
reverse
=
True
)
# list_count = [[key, str(value)] for key, value in list_count]
# return list_count
for
i
in
range
(
100
):
print
(
list_count
[
i
],
file
=
result
)
if
__name__
==
'__main__'
:
main
()
\ No newline at end of file
print
(
main
())
\ No newline at end of file
...
...
utils/getPublicData.py
View file @
2713bf9
...
...
@@ -93,3 +93,5 @@ def getAllHotWords():
def
getAllTopics
():
data
=
[]
return
data
if
__name__
==
'__main__'
:
print
(
getAllHotWords
())
\ No newline at end of file
...
...
utils/yuqingpredict.py
View file @
2713bf9
...
...
@@ -44,15 +44,22 @@ def mergeTopics(article_topics, comment_topics):# 合并话题
merged_dict
[
topic
[
'name'
]]
+=
topic
[
'value'
]
else
:
merged_dict
[
topic
[
'name'
]]
=
topic
[
'value'
]
merged_list
=
[{
'name'
:
key
,
'value'
:
value
}
for
key
,
value
in
merged_dict
.
items
()]
merged_dict
=
sorted
(
merged_dict
.
items
(),
key
=
lambda
item
:
item
[
1
],
reverse
=
True
)
merged_list
=
[[
key
,
str
(
value
)]
for
key
,
value
in
merged_dict
]
return
merged_list
def
getTopicData
():
# 读取合并文件 merge.csv # 取前十个话题
top_10_topics
=
pd
.
read_csv
(
'./merged_topics.csv'
)
.
head
(
10
)
# 获取话题名称和对应的值
X
=
top_10_topics
[
'name'
]
.
tolist
()
Y
=
top_10_topics
[
'value'
]
.
tolist
()
return
X
,
Y
def
getAllTopicData
():
# 读取合并文件 merge.csv
# data = []
# df = pd.read_csv('./merged_topics.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
mergeTopics
(
getTopicByArticle
(),
getTopicByComments
())
def
getTopicCreatedAtandpredictData
(
topic
):
# 统计特定话题的评论在每个日期的数量,并返回日期和对应的评论数量
createdAt
=
{}
...
...
@@ -71,9 +78,9 @@ def getTopicCreatedAtandpredictData(topic):# 统计特定话题的评论在每
createdAt
=
{
k
:
createdAt
[
k
]
for
k
in
sorted
(
createdAt
,
key
=
lambda
date
:
datetime
.
datetime
.
strptime
(
date
,
"
%
Y-
%
m-
%
d"
))}
createdAt
.
update
(
predict_future_values
(
createdAt
))
sorted_data
=
{
k
:
createdAt
[
k
]
for
k
in
sorted
(
createdAt
,
key
=
lambda
date
:
datetime
.
datetime
.
strptime
(
date
,
"
%
Y-
%
m-
%
d"
))}
result_list
=
[
0
]
*
(
len
(
sorted_data
)
-
5
)
+
[
1
]
*
5
return
topic
,
sorted_data
,
result_list
# return topic,list(createdAt.keys()),list(createdAt.values()),result_list
# result_list = [0] * (len(sorted_data) - 5) + [1] * 5
print
(
list
(
createdAt
.
keys
()),
list
(
createdAt
.
values
()))
return
list
(
createdAt
.
keys
()),
list
(
createdAt
.
values
())
def
writeTopicsToCSV
(
topics
,
file_name
):
# 检查文件是否存在,如果存在则附加写入,否则新建一个
...
...
@@ -91,6 +98,7 @@ def writeTopicsToCSV(topics, file_name):
writer
.
writerow
(
topic
)
if
__name__
==
'__main__'
:
# 将话题数据写入 CSV 文件
#
merged_topics = mergeTopics(getTopicByArticle(), getTopicByComments(
))
#
print(mergeTopics(getTopicByArticle(), getTopicByComments()
))
# writeTopicsToCSV(merged_topics, 'merged_topics.csv')
print
(
getTopicCreatedAtandpredictData
(
"生活"
))
print
(
getAllTopicData
())
...
...
views/page/page.py
View file @
2713bf9
...
...
@@ -6,6 +6,8 @@ from utils.getTableData import *
from
utils.getPublicData
import
getAllHotWords
,
getAllTopics
from
utils.getEchartsData
import
*
from
utils.getTopicPageData
import
*
from
utils.yuqingpredict
import
*
from
utils.getPublicData
import
getAllHotWords
pb
=
Blueprint
(
'page'
,
__name__
,
...
...
@@ -38,6 +40,7 @@ def home():
def
hotWord
():
username
=
session
.
get
(
'username'
)
hotWordList
=
getAllHotWords
()
print
(
hotWordList
)
defaultHotWord
=
hotWordList
[
0
][
0
]
if
request
.
args
.
get
(
'hotWord'
):
defaultHotWord
=
request
.
args
.
get
(
'hotWord'
)
...
...
@@ -51,7 +54,6 @@ def hotWord():
sentences
=
'正面'
elif
value
<
0.5
:
sentences
=
'负面'
comments
=
getCommentFilterData
(
defaultHotWord
)
return
render_template
(
'hotWord.html'
,
username
=
username
,
...
...
@@ -161,6 +163,34 @@ def yuqingChar():
x1Data
=
x1Data
,
y1Data
=
y1Data
)
@pb.route
(
'/yuqingpredict'
)
def
yuqingpredict
():
username
=
session
.
get
(
'username'
)
TopicList
=
getAllTopicData
()
defaultTopic
=
TopicList
[
0
][
0
]
if
request
.
args
.
get
(
'Topic'
):
defaultTopic
=
request
.
args
.
get
(
'Topic'
)
TopicLen
=
getTopicLen
(
defaultTopic
)
X
,
Y
=
getTopicCreatedAtandpredictData
(
defaultTopic
)
sentences
=
''
value
=
SnowNLP
(
defaultTopic
)
.
sentiments
if
value
==
0.5
:
sentences
=
'中性'
elif
value
>
0.5
:
sentences
=
'正面'
elif
value
<
0.5
:
sentences
=
'负面'
comments
=
getCommentFilterDataTopic
(
defaultTopic
)
return
render_template
(
'yuqingpredict.html'
,
username
=
username
,
hotWordList
=
TopicList
,
defaultHotWord
=
defaultTopic
,
hotWordLen
=
TopicLen
,
sentences
=
sentences
,
xData
=
X
,
yData
=
Y
,
comments
=
comments
)
@pb.route
(
'/articleCloud'
)
def
articleCloud
():
...
...
views/page/templates/articleChar.html
View file @
2713bf9
...
...
@@ -42,7 +42,7 @@
<li
class=
"px-3 pt-3 pb-2 "
>
<span
class=
"text-uppercase small font-weight-bold"
>
数据可视化
</span>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/articleChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -72,7 +72,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -82,6 +82,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/articleContentCloud.html
View file @
2713bf9
...
...
@@ -72,7 +72,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -82,10 +82,20 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/articleCloud"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
views/page/templates/base_page.html
View file @
2713bf9
...
...
@@ -38,7 +38,7 @@
<li
class=
"px-3 pt-3 pb-2 "
>
<span
class=
"text-uppercase small font-weight-bold"
>
首页
</span>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/home"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -101,7 +101,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -111,8 +111,18 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
机器学习预测
</span>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/articleCloud"
class=
"svg-icon"
>
...
...
views/page/templates/commentChar.html
View file @
2713bf9
...
...
@@ -63,7 +63,7 @@
<span
class=
"ml-2"
>
IP分析
</span>
</a>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/commentChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -72,7 +72,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -82,6 +82,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/hotWord.html
View file @
2713bf9
...
...
@@ -2,7 +2,6 @@
{% block title %}
热词统计
{% endblock %}
{% block nav %}
<nav
class=
"iq-sidebar-menu"
>
<ul
id=
"iq-sidebar-toggle"
class=
"side-menu"
>
...
...
@@ -19,7 +18,7 @@
<span
class=
"ml-2"
>
首页
</span>
</a>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/hotWord"
class=
"svg-icon "
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -72,7 +71,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -82,6 +81,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/ipChar.html
View file @
2713bf9
...
...
@@ -53,7 +53,7 @@
<span
class=
"ml-2"
>
文章分析
</span>
</a>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/ipChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
class=
"icon line"
width=
"18"
id=
"receipt"
xmlns=
"http://www.w3.org/2000/svg"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -73,8 +73,8 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
...
...
@@ -83,6 +83,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/tableData.html
View file @
2713bf9
...
...
@@ -29,7 +29,7 @@
<span
class=
"ml-2"
>
热词统计
</span>
</a>
</li>
<li
class=
"
active
sidebar-layout"
>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/tableData"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -72,7 +72,7 @@
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<li
class=
"
active
sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
...
...
@@ -82,6 +82,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/yuqingChar.html
View file @
2713bf9
...
...
@@ -81,6 +81,16 @@
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
...
...
views/page/templates/yuqingpredict.html
0 → 100644
View file @
2713bf9
{% extends 'base_page.html' %}
{% block title %}
舆情预测
{% endblock %}
{% block nav %}
<nav
class=
"iq-sidebar-menu"
>
<ul
id=
"iq-sidebar-toggle"
class=
"side-menu"
>
<li
class=
"px-3 pt-3 pb-2 "
>
<span
class=
"text-uppercase small font-weight-bold"
>
首页
</span>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/home"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
首页
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/hotWord"
class=
"svg-icon "
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
热词统计
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/tableData"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M7 7h.01M7 3h5c.512 0 1.024.195 1.414.586l7 7a2 2 0 010 2.828l-7 7a2 2 0 01-2.828 0l-7-7A1.994 1.994 0 013 12V7a4 4 0 014-4z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
微博舆情统计
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2 "
>
<span
class=
"text-uppercase small font-weight-bold"
>
数据可视化
</span>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/articleChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M3 3h2l.4 2M7 13h10l4-8H5.4M7 13L5.4 5M7 13l-2.293 2.293c-.63.63-.184 1.707.707 1.707H17m0 0a2 2 0 100 4 2 2 0 000-4zm-8 2a2 2 0 11-4 0 2 2 0 014 0z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
文章分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/ipChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
class=
"icon line"
width=
"18"
id=
"receipt"
xmlns=
"http://www.w3.org/2000/svg"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
d=
"M17,16V3L13,5,10,3,7,5,3,3V17.83A3.13,3.13,0,0,0,5.84,21,3,3,0,0,0,9,18V17a1,1,0,0,1,1-1H20a1,1,0,0,1,1,1v1a3,3,0,0,1-3,3H6"
style=
"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"
></path>
<line
x1=
"8"
y1=
"10"
x2=
"12"
y2=
"10"
style=
"fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2;"
></line>
</svg>
</i>
<span
class=
"ml-2"
>
IP分析
</span>
</a>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/commentChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"
></path>
</svg>
</i><span
class=
"ml-2"
>
评论分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingChar"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情分析
</span>
</a>
</li>
<li
class=
"active sidebar-layout"
>
<a
href=
"/page/yuqingpredict"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"
></path>
</svg>
</i>
<span
class=
"ml-2"
>
舆情预测
</span>
</a>
</li>
<li
class=
"px-3 pt-3 pb-2"
>
<span
class=
"text-uppercase small font-weight-bold"
>
词云图
</span>
</li>
<li
class=
" sidebar-layout"
>
<a
href=
"/page/articleCloud"
class=
"svg-icon"
>
<i
class=
""
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"18"
fill=
"none"
viewbox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z"
></path>
</svg>
</i><span
class=
"ml-2"
>
文章内容词云图
</span>
</a>
</li>
</ul>
</nav>
{% endblock %}
{% block content %}
<div
class=
"container-fluid"
>
<div
class=
"row"
>
<div
class=
"col-md-12 mb-4 mt-1"
>
<div
class=
"d-flex flex-wrap justify-content-between align-items-center"
>
<h4
class=
"font-weight-bold"
>
话题统计页
</h4>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"card card-block card-stretch card-height"
>
<div
class=
"card-body"
>
<div
class=
"collapse"
id=
"form-element-15"
>
<div
class=
"card"
><kbd
class=
"bg-dark"
><pre
id=
"select-size"
class=
"text-white"
><code>
<
div class="form-group"
>
<
label
>
Small
<
/label
>
<
select class="form-control form-control-sm mb-3"
>
<
option selected=""
>
Open this select menu
<
/option
>
<
option value="1"
>
One
<
/option
>
<
option value="2"
>
Two
<
/option
>
<
option value="3"
>
Three
<
/option
>
<
/select
>
<
/div
>
<
div class="form-group"
>
<
label
>
Default
<
/label
>
<
select class="form-control mb-3"
>
<
option selected=""
>
Open this select menu
<
/option
>
<
option value="1"
>
One
<
/option
>
<
option value="2"
>
Two
<
/option
>
<
option value="3"
>
Three
<
/option
>
<
/select
>
<
/div
>
<
div class="form-group"
>
<
label
>
Large
<
/label
>
<
select class="form-control form-control-lg"
>
<
option selected=""
>
Open this select menu
<
/option
>
<
option value="1"
>
One
<
/option
>
<
option value="2"
>
Two
<
/option
>
<
option value="3"
>
Three
<
/option
>
<
/select
>
<
/div
>
</code></pre></kbd></div>
</div>
<div
class=
"form-group"
>
<label>
话题选择
</label>
<select
onchange=
"hotWordChange(event)"
class=
"form-control mb-3"
>
{% for i in hotWordList %}
{% if defaultHotWord == i[0] %}
<option
selected
value=
"{{ i[0] }}"
>
{{ i[0] }}
</option>
{% else %}
<option
value=
"{{ i[0] }}"
>
{{ i[0] }}
</option>
{% endif %}
{% endfor %}
</select>
<script>
function
hotWordChange
(
e
){
window
.
location
.
href
=
'http://127.0.0.1:5000/page/yuqingpredict?Topic='
+
e
.
target
.
value
}
</script>
</div>
</div>
</div>
</div>
</div>
<div
class=
"row"
style=
"justify-content: center"
>
<div
class=
"col-md-6 col-xl-6"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<h4
class=
"card-title font-size-16 mt-0"
>
{{ defaultHotWord }}
</h4>
</div>
<ul
class=
"list-group list-group-flush"
>
<li
class=
"list-group-item"
>
话题名称:{{ defaultHotWord }}
</li>
<li
class=
"list-group-item"
>
出现次数:{{ hotWordLen }}次
</li>
<li
class=
"list-group-item"
>
话题情感:{{ sentences }}
</li>
</ul>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"card"
>
<div
class=
"card-body"
>
<h4
class=
"card-title font-size-16 mt-0"
>
话题年份变化趋势
</h4>
</div>
<div
id=
"main"
style=
"width:100%;height: 450px"
></div>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"col-lg-12"
>
<div
class=
"card"
>
<div
class=
"card-header d-flex justify-content-between"
>
<div
class=
"header-title"
>
<h4
class=
"card-title"
>
话题查询表格
</h4>
</div>
<div
class=
"header-action"
>
<i
data-toggle=
"collapse"
data-target=
"#datatable-1"
aria-expanded=
"false"
>
<svg
width=
"20"
xmlns=
"http://www.w3.org/2000/svg"
fill=
"none"
viewBox=
"0 0 24 24"
stroke=
"currentColor"
>
<path
stroke-linecap=
"round"
stroke-linejoin=
"round"
stroke-width=
"2"
d=
"M10 20l4-16m4 4l4 4-4 4M6 16l-4-4 4-4"
></path>
</svg>
</i>
</div>
</div>
<div
class=
"card-body"
>
<div
class=
"collapse"
id=
"datatable-1"
>
<div
class=
"card"
><kbd
class=
"bg-dark"
>
<pre
id=
"bootstrap-datatables"
class=
"text-white"
><code>
<
table id="datatable" class="table data-table table-striped table-bordered"
>
<
thead
>
<
tr
>
<
th
>
Name
<
/th
>
<
th
>
Position
<
/th
>
<
th
>
Office
<
/th
>
<
th
>
Age
<
/th
>
<
th
>
Start date
<
/th
>
<
th
>
Salary
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
<
tr
>
<
td
>
Tiger Nixon
<
/td
>
<
td
>
System Architect
<
/td
>
<
td
>
Edinburgh
<
/td
>
<
td
>
61
<
/td
>
<
td
>
2011/04/25
<
/td
>
<
td
>
$320,800
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Garrett Winters
<
/td
>
<
td
>
Accountant
<
/td
>
<
td
>
Tokyo
<
/td
>
<
td
>
63
<
/td
>
<
td
>
2011/07/25
<
/td
>
<
td
>
$170,750
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Ashton Cox
<
/td
>
<
td
>
Junior Technical Author
<
/td
>
<
td
>
San Francisco
<
/td
>
<
td
>
66
<
/td
>
<
td
>
2009/01/12
<
/td
>
<
td
>
$86,000
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Cedric Kelly
<
/td
>
<
td
>
Senior Javascript Developer
<
/td
>
<
td
>
Edinburgh
<
/td
>
<
td
>
22
<
/td
>
<
td
>
2012/03/29
<
/td
>
<
td
>
$433,060
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Airi Satou
<
/td
>
<
td
>
Accountant
<
/td
>
<
td
>
Tokyo
<
/td
>
<
td
>
33
<
/td
>
<
td
>
2008/11/28
<
/td
>
<
td
>
$162,700
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Brielle Williamson
<
/td
>
<
td
>
Integration Specialist
<
/td
>
<
td
>
New York
<
/td
>
<
td
>
61
<
/td
>
<
td
>
2012/12/02
<
/td
>
<
td
>
$372,000
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Herrod Chandler
<
/td
>
<
td
>
Sales Assistant
<
/td
>
<
td
>
San Francisco
<
/td
>
<
td
>
59
<
/td
>
<
td
>
2012/08/06
<
/td
>
<
td
>
$137,500
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Rhona Davidson
<
/td
>
<
td
>
Integration Specialist
<
/td
>
<
td
>
Tokyo
<
/td
>
<
td
>
55
<
/td
>
<
td
>
2010/10/14
<
/td
>
<
td
>
$327,900
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Colleen Hurst
<
/td
>
<
td
>
Javascript Developer
<
/td
>
<
td
>
San Francisco
<
/td
>
<
td
>
39
<
/td
>
<
td
>
2009/09/15
<
/td
>
<
td
>
$205,500
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Sonya Frost
<
/td
>
<
td
>
Software Engineer
<
/td
>
<
td
>
Edinburgh
<
/td
>
<
td
>
23
<
/td
>
<
td
>
2008/12/13
<
/td
>
<
td
>
$103,600
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Jena Gaines
<
/td
>
<
td
>
Office Manager
<
/td
>
<
td
>
London
<
/td
>
<
td
>
30
<
/td
>
<
td
>
2008/12/19
<
/td
>
<
td
>
$90,560
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Quinn Flynn
<
/td
>
<
td
>
Support Lead
<
/td
>
<
td
>
Edinburgh
<
/td
>
<
td
>
22
<
/td
>
<
td
>
2013/03/03
<
/td
>
<
td
>
$342,000
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Charde Marshall
<
/td
>
<
td
>
Regional Director
<
/td
>
<
td
>
San Francisco
<
/td
>
<
td
>
36
<
/td
>
<
td
>
2008/10/16
<
/td
>
<
td
>
$470,600
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Haley Kennedy
<
/td
>
<
td
>
Senior Marketing Designer
<
/td
>
<
td
>
London
<
/td
>
<
td
>
43
<
/td
>
<
td
>
2012/12/18
<
/td
>
<
td
>
$313,500
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Tatyana Fitzpatrick
<
/td
>
<
td
>
Regional Director
<
/td
>
<
td
>
London
<
/td
>
<
td
>
19
<
/td
>
<
td
>
2010/03/17
<
/td
>
<
td
>
$385,750
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Michael Silva
<
/td
>
<
td
>
Marketing Designer
<
/td
>
<
td
>
London
<
/td
>
<
td
>
66
<
/td
>
<
td
>
2012/11/27
<
/td
>
<
td
>
$198,500
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Paul Byrd
<
/td
>
<
td
>
Chief Financial Officer (CFO)
<
/td
>
<
td
>
New York
<
/td
>
<
td
>
64
<
/td
>
<
td
>
2010/06/09
<
/td
>
<
td
>
$725,000
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Gloria Little
<
/td
>
<
td
>
Systems Administrator
<
/td
>
<
td
>
New York
<
/td
>
<
td
>
59
<
/td
>
<
td
>
2009/04/10
<
/td
>
<
td
>
$237,500
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Bradley Greer
<
/td
>
<
td
>
Software Engineer
<
/td
>
<
td
>
London
<
/td
>
<
td
>
41
<
/td
>
<
td
>
2012/10/13
<
/td
>
<
td
>
$132,000
<
/td
>
<
/tr
>
<
tr
>
<
td
>
Dai Rios
<
/td
>
<
td
>
Personnel Lead
<
/td
>
<
td
>
Edinburgh
<
/td
>
<
td
>
35
<
/td
>
<
td
>
2012/09/26
<
/td
>
<
td
>
$217,500
<
/td
>
<
/tr
>
<
/table
>
</code></pre></kbd></div>
</div>
<p>
根据选择的话题从而查询出评论数据
</p>
<div
class=
"table-responsive"
>
<div
id=
"datatable-1_wrapper"
class=
"dataTables_wrapper dt-bootstrap4"
>
<div
class=
"row"
><div
class=
"col-sm-12"
><table
id=
"datatable-1"
class=
"table data-table table-striped table-bordered dataTable"
role=
"grid"
aria-describedby=
"datatable-1_info"
>
<thead>
<tr
role=
"row"
>
<th
class=
"sorting sorting_asc"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-sort=
"ascending"
aria-label=
"Name: activate to sort column descending"
style=
"width: 250.844px;"
>
文章ID
</th>
<th
class=
"sorting"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-label=
"Position: activate to sort column ascending"
style=
"width: 392.094px;"
>
评论用户
</th>
<th
class=
"sorting"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-label=
"Office: activate to sort column ascending"
style=
"width: 190.75px;"
>
评论性别
</th>
<th
class=
"sorting"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-label=
"Age: activate to sort column ascending"
style=
"width: 84.2656px;"
>
评论话题
</th>
<th
class=
"sorting"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-label=
"Start date: activate to sort column ascending"
style=
"width: 172.594px;"
>
评论内容
</th>
<th
class=
"text-right sorting"
tabindex=
"0"
aria-controls=
"datatable-1"
rowspan=
"1"
colspan=
"1"
aria-label=
"Salary: activate to sort column ascending"
style=
"width: 158.453px;"
>
点赞量
</th></tr>
</thead>
<tbody>
{% for i in comments %}
<tr
class=
"odd"
>
<td
class=
"sorting_1"
>
{{ i[0] }}
</td>
<td>
{{ i[5] }}
</td>
<td>
{% if i[6] =='f' %}
女生
{% else %}
男生
{% endif %}
</td>
<td>
{{ i[9] }}
</td>
<td>
{{ i[4] }}
</td>
<td
class=
"text-right"
>
👍{{ i[2] }}
</td>
</tr>
{% endfor %}
</tbody>
</table></div></div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block echarts %}
<script>
var
yData
=
{{
yData
|
tojson
}};
var
xData
=
{{
xData
|
tojson
}};
var
chartDom
=
document
.
getElementById
(
'main'
);
var
myChart
=
echarts
.
init
(
chartDom
);
var
option
;
var
lastFiveStartIndex
=
yData
.
length
-
5
;
// 最后五个数据点的开始索引
option
=
{
tooltip
:
{
trigger
:
'axis'
},
legend
:
{
data
:
[
'话题出现时间分布个数'
,
'话题预测时间分布个数'
]
},
toolbox
:
{
show
:
true
,
feature
:
{
dataView
:
{
show
:
true
,
readOnly
:
false
},
magicType
:
{
show
:
true
,
type
:
[
'line'
,
'bar'
]
},
restore
:
{
show
:
true
},
saveAsImage
:
{
show
:
true
}
}
},
calculable
:
true
,
xAxis
:
[
{
type
:
'category'
,
data
:
xData
}
],
yAxis
:
[
{
type
:
'value'
}
],
dataZoom
:
[
{
show
:
true
,
start
:
10
,
end
:
60
},
{
type
:
'inside'
,
start
:
10
,
end
:
60
}
],
series
:
[
{
name
:
'话题预测时间分布个数'
,
type
:
'bar'
,
data
:
yData
.
map
((
value
,
index
)
=>
({
value
:
value
,
itemStyle
:
{
color
:
index
>=
lastFiveStartIndex
?
'orange'
:
'blue'
}
})),
markPoint
:
{
data
:
[
{
type
:
'max'
,
name
:
'Max'
},
{
type
:
'min'
,
name
:
'Min'
}
]
},
markLine
:
{
data
:
[{
type
:
'average'
,
name
:
'Avg'
}]
}
}
]
};
myChart
.
setOption
(
option
);
</script>
{% endblock %}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment