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-04 22:56:17 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
82bf846b5b6ccc056649fef033dfca813482e9ea
82bf846b
1 parent
cc8468d9
摘虫
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
41 deletions
utils/getEchartsData.py
views/page/page.py
views/page/templates/yuqingChar.html
utils/getEchartsData.py
View file @
82bf846
...
...
@@ -93,14 +93,14 @@ def getArticleRepotsLen(type):
Y
[
11
]
+=
1
return
X
,
Y
def
getIP
Char
ByArticleRegion
():
def
getIPByArticleRegion
():
articleRegionDic
=
{}
for
i
in
articleList
:
if
i
[
4
]
!=
'无'
:
if
articleRegionDic
.
get
(
i
[
4
],
-
1
)
==
-
1
:
articleRegionDic
[
i
[
4
]]
=
1
else
:
if
i
[
4
]
in
articleRegionDic
.
keys
():
articleRegionDic
[
i
[
4
]]
+=
1
else
:
articleRegionDic
[
i
[
4
]]
=
1
resultData
=
[]
for
key
,
value
in
articleRegionDic
.
items
():
resultData
.
append
({
...
...
@@ -109,14 +109,14 @@ def getIPCharByArticleRegion():
})
return
resultData
def
getIP
Char
ByCommentsRegion
():
def
getIPByCommentsRegion
():
commentRegionDic
=
{}
for
i
in
commentList
:
if
i
[
3
]
!=
'无'
:
if
commentRegionDic
.
get
(
i
[
3
],
-
1
)
==
-
1
:
commentRegionDic
[
i
[
3
]]
=
1
else
:
if
i
[
3
]
in
commentRegionDic
.
keys
():
commentRegionDic
[
i
[
3
]]
+=
1
else
:
commentRegionDic
[
i
[
3
]]
=
1
resultData
=
[]
for
key
,
value
in
commentRegionDic
.
items
():
resultData
.
append
({
...
...
@@ -163,19 +163,19 @@ def getYuQingCharDataOne():
Y
[
2
]
+=
1
else
:
Y
[
1
]
+=
1
final
data
=
[{
bie
data
=
[{
'name'
:
x
,
'value'
:
Y
[
index
]
}
for
index
,
x
in
enumerate
(
X
)]
return
X
,
Y
,
final
data
return
X
,
Y
,
bie
data
def
getYuQingCharDataTwo
():
X
=
[
'正面'
,
'中性'
,
'负面'
]
final
data1
=
[{
bie
data1
=
[{
'name'
:
x
,
'value'
:
0
}
for
x
in
X
]
final
data2
=
[{
bie
data2
=
[{
'name'
:
x
,
'value'
:
0
}
for
x
in
X
]
...
...
@@ -183,20 +183,20 @@ def getYuQingCharDataTwo():
for
comment
in
commentList
:
emotionValue
=
SnowNLP
(
comment
[
4
])
.
sentiments
if
emotionValue
>
0.4
:
final
data1
[
0
][
'value'
]
+=
1
bie
data1
[
0
][
'value'
]
+=
1
elif
emotionValue
<
0.2
:
final
data1
[
2
][
'value'
]
+=
1
bie
data1
[
2
][
'value'
]
+=
1
else
:
final
data1
[
1
][
'value'
]
+=
1
bie
data1
[
1
][
'value'
]
+=
1
for
artile
in
articleList
:
emotionValue
=
SnowNLP
(
artile
[
5
])
.
sentiments
if
emotionValue
>
0.4
:
final
data2
[
0
][
'value'
]
+=
1
bie
data2
[
0
][
'value'
]
+=
1
elif
emotionValue
<
0.2
:
final
data2
[
2
][
'value'
]
+=
1
bie
data2
[
2
][
'value'
]
+=
1
else
:
finaldata2
[
1
][
'value'
]
+=
1
return
finaldata1
,
finaldata2
biedata2
[
1
][
'value'
]
+=
1
return
biedata1
,
biedata2
def
getYuQingCharDataThree
():
hotWordList
=
getAllHotWords
()
...
...
views/page/page.py
View file @
82bf846
...
...
@@ -28,8 +28,8 @@ def home():
likeCountMaxAuthorName
=
likeCountMaxAuthorName
,
cityMax
=
cityMax
,
commentsLikeCountTopFore
=
commentsLikeCountTopFore
,
X
=
X
,
Y
=
Y
,
xData
=
X
,
yData
=
Y
,
typeChart
=
typeChart
,
createAtChart
=
createAtChart
)
...
...
@@ -59,8 +59,8 @@ def hotWord():
defaultHotWord
=
defaultHotWord
,
hotWordLen
=
hotWordLen
,
sentences
=
sentences
,
X
=
X
,
Y
=
Y
,
xData
=
X
,
yData
=
Y
,
comments
=
comments
)
...
...
@@ -84,8 +84,8 @@ def hotTopic():
defaultTopic
=
defaultTopic
,
topicLen
=
topicLen
,
sentences
=
sentences
,
X
=
X
,
Y
=
Y
,
xData
=
X
,
yData
=
Y
,
comments
=
comments
)
...
...
@@ -114,8 +114,8 @@ def articleChar():
username
=
username
,
typeList
=
typeList
,
defaultType
=
defaultType
,
X
=
X
,
Y
=
Y
,
xData
=
X
,
yData
=
Y
,
x1Data
=
x1Data
,
y1Data
=
y1Data
,
x2Data
=
x2Data
,
...
...
@@ -125,8 +125,8 @@ def articleChar():
@pb.route
(
'/ipChar'
)
def
ipChar
():
username
=
session
.
get
(
'username'
)
articleRegionData
=
getIPCharByArticleRegion
()
commentRegionData
=
getIPCharByCommentsRegion
()
articleRegionData
=
getIPByArticleRegion
()
commentRegionData
=
getIPByCommentsRegion
()
return
render_template
(
'ipChar.html'
,
username
=
username
,
articleRegionData
=
articleRegionData
,
...
...
@@ -140,24 +140,24 @@ def commentChar():
genderPieData
=
getCommentDataTwo
()
return
render_template
(
'commentChar.html'
,
username
=
username
,
X
=
X
,
Y
=
Y
,
xData
=
X
,
yData
=
Y
,
genderPieData
=
genderPieData
)
@pb.route
(
'/yuqingChar'
)
def
yuqingChar
():
username
=
session
.
get
(
'username'
)
X
,
Y
,
finaldata
=
getYuQingCharDataOne
()
finaldata1
,
finaldata2
=
getYuQingCharDataTwo
()
X
,
Y
,
biedata
=
getYuQingCharDataOne
()
biedata1
,
biedata2
=
getYuQingCharDataTwo
()
x1Data
,
y1Data
=
getYuQingCharDataThree
()
return
render_template
(
'yuqingChar.html'
,
username
=
username
,
X
=
X
,
Y
=
Y
,
finaldata
=
finaldata
,
finaldata1
=
finaldata1
,
finaldata2
=
finaldata2
,
xData
=
X
,
yData
=
Y
,
biedata
=
biedata
,
biedata1
=
biedata1
,
biedata2
=
biedata2
,
x1Data
=
x1Data
,
y1Data
=
y1Data
)
...
...
views/page/templates/yuqingChar.html
View file @
82bf846
...
...
@@ -234,7 +234,7 @@
series
:
[
{
type
:
'treemap'
,
data
:
{{
final
data
|
tojson
}}
data
:
{{
bie
data
|
tojson
}}
}
]
};
...
...
@@ -272,7 +272,7 @@
labelLine
:
{
show
:
false
},
data
:
{{
final
data1
|
tojson
}}
data
:
{{
bie
data1
|
tojson
}}
},
{
name
:
'文章舆情结果'
,
...
...
@@ -313,7 +313,7 @@
}
}
},
data
:
{{
final
data2
|
tojson
}}
data
:
{{
bie
data2
|
tojson
}}
}
]
};
...
...
Please
register
or
login
to post a comment