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
redhongx
2024-07-04 12:34:24 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e43615d5aa65fc2c842373f754572685a013fd6c
e43615d5
1 parent
35b908e0
【getEchartsData.py】修改正面/中性/负面的判断值
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
utils/getEchartsData.py
utils/getEchartsData.py
View file @
e43615d
from
utils.getPublicData
import
*
from
snow
nlp
import
SnowNLP
from
utils.my
nlp
import
SnowNLP
articleList
=
getAllArticleData
()
commentList
=
getAllCommentsData
()
...
...
@@ -157,12 +157,12 @@ def getYuQingCharDataOne():
yData
=
[
0
,
0
,
0
]
for
word
in
hotWordList
:
emotionValue
=
SnowNLP
(
word
[
0
])
.
sentiments
if
emotionValue
>
0.
5
:
if
emotionValue
>
0.
4
:
yData
[
0
]
+=
1
elif
emotionValue
==
0.5
:
yData
[
1
]
+=
1
elif
emotionValue
<
0.5
:
elif
emotionValue
<
0.2
:
yData
[
2
]
+=
1
else
:
yData
[
1
]
+=
1
bieData
=
[{
'name'
:
x
,
'value'
:
yData
[
index
]
...
...
@@ -182,20 +182,20 @@ def getYuQingCharDataTwo():
for
comment
in
commentList
:
emotionValue
=
SnowNLP
(
comment
[
4
])
.
sentiments
if
emotionValue
>
0.
5
:
if
emotionValue
>
0.
4
:
bieData1
[
0
][
'value'
]
+=
1
elif
emotionValue
==
0.5
:
bieData1
[
1
][
'value'
]
+=
1
elif
emotionValue
<
0.5
:
elif
emotionValue
<
0.2
:
bieData1
[
2
][
'value'
]
+=
1
else
:
bieData1
[
1
][
'value'
]
+=
1
for
artile
in
articleList
:
emotionValue
=
SnowNLP
(
artile
[
5
])
.
sentiments
if
emotionValue
>
0.
5
:
if
emotionValue
>
0.
4
:
bieData2
[
0
][
'value'
]
+=
1
elif
emotionValue
==
0.5
:
bieData2
[
1
][
'value'
]
+=
1
elif
emotionValue
<
0.5
:
elif
emotionValue
<
0.2
:
bieData2
[
2
][
'value'
]
+=
1
else
:
bieData2
[
1
][
'value'
]
+=
1
return
bieData1
,
bieData2
def
getYuQingCharDataThree
():
...
...
Please
register
or
login
to post a comment