Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from textblob import TextBlob
- def analyze_text(text):
- analyzer = TextBlob(text)
- polarity = analyzer.sentiment.polarity
- if polarity > 0:
- print("POSITIVE")
- elif polarity < 0:
- print("NEGATIVE")
- else:
- print("NEUTRAL")
- if __name__ == "__main__":
- text = input("Enter text:")
- analyze_text(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement