Python | TextBlob.sentiment() method
With the help of TextBlob.sentiment() method, we can get the sentiments of the sentences by using TextBlob.sentiment() method.
Syntax :
TextBlob.sentiment()
Return : Return the tuple of sentiments.
Example #1 :
In this example we can say that by using TextBlob.sentiment() method, we are able to get the sentiments of a sentence.
# import TextBlob from textblob import TextBlob gfg = TextBlob("GFG is a good company and always value their employees.") # using TextBlob.sentiment method gfg = gfg.sentiment print(gfg) |
Output :
Sentiment(polarity=0.7, subjectivity=0.6000000000000001)
Example #2 :
# import TextBlob from textblob import TextBlob gfg = TextBlob("Sandeep Jain An IIT Roorkee alumnus and founder of GeeksforGeeks. He loves to solve programming problems in most efficient ways.") # using TextBlob.sentiment method gfg = gfg.sentiment print(gfg) |
Output :
Sentiment(polarity=0.5, subjectivity=0.5)
Recommended Posts:
- class method vs static method in Python
- Python | set() method
- Python | os.dup() method
- Python | next() method
- Python | os.fdatasync() method
- Python | os.sync() method
- Python | sympy.sec() method
- Python | os.fsdecode() method
- Python | os.pipe2() method
- Python | os.getloadavg() method
- Python | os.cpu_count() method
- Python | os.stat() method
- Python | os.set_inheritable() method
- Python | sympy.nC() method
- Python | sympy.nP() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


