first commit
This commit is contained in:
commit
0b13673bcc
10 changed files with 220 additions and 0 deletions
19
SentiTooter.py
Normal file
19
SentiTooter.py
Normal 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]
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue