first commit

This commit is contained in:
rnsrk 2023-01-03 00:40:59 +01:00
commit 0b13673bcc
10 changed files with 220 additions and 0 deletions

19
SentiTooter.py Normal file
View file

@ -0,0 +1,19 @@
from math import sqrt
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
import numpy as np
class SentiTooter():
""""""
def __init__(self):
self.sia = SentimentIntensityAnalyzer()
def analyze(self, toot):
compound = self.sia.polarity_scores(toot.content)['compound']
if (compound > (1/3)):
return ['positive', compound]
elif (compound < (-1/3)):
return ['negative', compound]
else:
return ['neutral', compound]