siddhantuniyal commited on
Commit
95c55d3
1 Parent(s): 191139c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -28,12 +28,20 @@ def spam_detection(input_text):
28
  def sentiment_analysis(input_text):
29
 
30
  score = SentimentIntensityAnalyzer().polarity_scores(input_text)
 
 
 
 
 
 
 
 
31
 
32
- if score['neg']>score['pos']:
33
 
34
  return ["Negative Feedback" , score['neg']]
35
 
36
- elif score['neg']<score['pos']:
37
 
38
  return ["Positive Feedback" , -1]
39
 
 
28
  def sentiment_analysis(input_text):
29
 
30
  score = SentimentIntensityAnalyzer().polarity_scores(input_text)
31
+
32
+
33
+ del score['compound']
34
+
35
+ label = list(filter(lambda x: score[x] == max(score.values()), score))[0]
36
+
37
+
38
+
39
 
40
+ if label == 'neg':
41
 
42
  return ["Negative Feedback" , score['neg']]
43
 
44
+ elif label == 'pos':
45
 
46
  return ["Positive Feedback" , -1]
47