Skip to content

Instantly share code, notes, and snippets.

@siakon89
Created June 6, 2018 09:24
Show Gist options
  • Save siakon89/d6e9d07ae53492641d4fa9557080fdf9 to your computer and use it in GitHub Desktop.
Save siakon89/d6e9d07ae53492641d4fa9557080fdf9 to your computer and use it in GitHub Desktop.
# Import the TextBlob package
from textblob import TextBlob
# A negative text
negative_blob = TextBlob("This is an awful day!")
# Extract sentiment from blob
print(negative_blob.sentiment)
# Print: Sentiment(polarity=-1.0, subjectivity=1.0)
# A neutral text
neutral_blob = TextBlob("My day is neutral")
# Extract sentiment from blob
print(neutral_blob.sentiment)
# Print: Sentiment(polarity=0.0, subjectivity=0.0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment