You can download this code by clicking the button below.
This code is now available for download.
Detects the sentiment of a given text and returns a tuple containing polarity and subjectivity.
Technology Stack : TextBlob
Code Type : Function
Code Difficulty : Intermediate
def detect_sentiment(text):
from textblob import TextBlob
blob = TextBlob(text)
sentiment = blob.sentiment
return sentiment