Skip to content

Commit 593b331

Browse files
authored
Create sentiment_model.py
1 parent 8739881 commit 593b331

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎nlp_model/sentiment_model.py‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def predict_sentiment(text):
2+
positive_words = ["happy", "good", "great", "excellent", "love"]
3+
negative_words = ["bad", "sad", "hate", "terrible", "poor"]
4+
5+
text = text.lower()
6+
7+
if any(word in text for word in positive_words):
8+
return "positive"
9+
10+
if any(word in text for word in negative_words):
11+
return "negative"
12+
13+
return "neutral"

0 commit comments

Comments
 (0)