From e43615d5aa65fc2c842373f754572685a013fd6c Mon Sep 17 00:00:00 2001 From: redhongx <1144981128@qq.com> Date: Thu, 4 Jul 2024 12:34:24 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90getEchartsData.py=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=AD=A3=E9=9D=A2/=E4=B8=AD=E6=80=A7/=E8=B4=9F?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=88=A4=E6=96=AD=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/getEchartsData.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/utils/getEchartsData.py b/utils/getEchartsData.py index d7c5847..d23ab3e 100644 --- a/utils/getEchartsData.py +++ b/utils/getEchartsData.py @@ -1,5 +1,5 @@ from utils.getPublicData import * -from snownlp import SnowNLP +from utils.mynlp 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():