Skip to content

Instantly share code, notes, and snippets.

@anmolj7
Created December 3, 2018 09:31
Show Gist options
  • Save anmolj7/a393b5c2c661f995a223308bd7c11f21 to your computer and use it in GitHub Desktop.
Save anmolj7/a393b5c2c661f995a223308bd7c11f21 to your computer and use it in GitHub Desktop.
#this code was tested and working on python 3.6.5
#The Module TextBlob Needs To Be Installed as it contains a predefined function that
#can calculate the polarities. It includes a list of words that has a list of certain value ..
from textblob import TextBlob
text = input("Enter The Text> ")
model = TextBlob(text)
print(model.sentiment.polarity)
#The Polarity ranges from -1 to 1
#where 0 indicates neutral, -1 indicates negative and 1 indicates positive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment