TextBlob
TextBlob is a Python library used for NLP. It has a simple API and is probably the easiest way to begin with sentiment analysis and other text analytic areas in Python. TextBlob is built on top of the NLTK library but is a bit easier to use. In the following sections, we will perform an exercise and an activity to get a better understanding of how TextBlob is used in sentiment analysis.
Exercise 63: Basic Sentiment Analysis Using the TextBlob Library
In this exercise, we will perform sentiment analysis on given text. For this, we will be using the TextBlob class of the textblob library. Follow these steps to implement this exercise:
- Open a Jupyter notebook.
- Insert a new cell and add the following code to implement to import the
TextBlobclass from thetextbloblibrary:from textblob import TextBlob
- Create a variable named
sentenceand assign it a string. Insert a new cell and add the following code to implement this:sentence = "but you are Late Flight...