Skip to content

Commit

Permalink
Create sentiment_predictor.py
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Aug 19, 2024
1 parent f491db7 commit 9df1c33
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pandas as pd
from nltk.sentiment import SentimentIntensityAnalyzer

class SentimentPredictor:
def __init__(self, data):
self.data = data
self.sia = SentimentIntensityAnalyzer()

def predict(self, input_text):
sentiment = self.sia.polarity_scores(input_text)
return sentiment['compound']

0 comments on commit 9df1c33

Please sign in to comment.