Advertisement
Josif_tepe

Untitled

May 3rd, 2025
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. from textblob import TextBlob
  2.  
  3. def analyze_text(text):
  4.     analyzer = TextBlob(text)
  5.     polarity = analyzer.sentiment.polarity
  6.  
  7.     if polarity > 0:
  8.         print("POSITIVE")
  9.     elif polarity < 0:
  10.         print("NEGATIVE")
  11.     else:
  12.         print("NEUTRAL")
  13.  
  14.  
  15. if __name__ == "__main__":
  16.     text = input("Enter text:")
  17.     analyze_text(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement