Sentiment analysis is a method for identifying expression in a oiece of text.
Here we are going to identify the sentiment of a text using textbob and categorize them into positive or negative.
Python Code :-
# Import TextBlob
from textblob import TextBlob
text = "Python is a great tool"
obj = TextBlob(text)
# returns the sentiment of text,
# value between -1.0 to 1.0
sentiment = obj.sentiment.polarity
print sentiment
' ' '
Output :-
0.8
+ve value indicates that the sentiment is positive.
' ' '
This method can be used to track the reaction of people on a particular topic on social media by mining their posts (textual data)
Here we are going to identify the sentiment of a text using textbob and categorize them into positive or negative.
Python Code :-
# Import TextBlob
from textblob import TextBlob
text = "Python is a great tool"
obj = TextBlob(text)
# returns the sentiment of text,
# value between -1.0 to 1.0
sentiment = obj.sentiment.polarity
print sentiment
' ' '
Output :-
0.8
+ve value indicates that the sentiment is positive.
' ' '
This method can be used to track the reaction of people on a particular topic on social media by mining their posts (textual data)
No comments:
Post a Comment