TextBlob: Simple, Pythonic Text Processing
TextBlob is a Python library designed for processing textual data, providing a simplified API for common Natural Language Processing (NLP) tasks. It encompasses functionalities like sentiment analysis, part-of-speech tagging, noun phrase extraction, and more, building on top of NLTK and pattern libraries. The current version is 0.20.0, with a release cadence that indicates active maintenance and updates, as seen with recent releases in late 2025 and early 2026.
Warnings
- gotcha Failing to download NLTK corpora will result in `LookupError` when performing NLP tasks (e.g., sentiment analysis, POS tagging). This is a very common initial setup mistake.
- breaking The main package import path changed from `from text.blob import TextBlob` to `from textblob import TextBlob`.
- gotcha Naming your Python script file `textblob.py` can cause an import collision, leading to `AttributeError` or `ImportError` because Python will try to import your local file instead of the installed library.
- gotcha The main class is `TextBlob` (capital 'T' and 'B'). Using `textblob` (lowercase) in the import statement will result in an `ImportError` or `AttributeError`.
- breaking Support for Python 3.4 was officially dropped.
- deprecated The `clean_html` parameter has been deprecated. It was removed as it was also deprecated in NLTK.
- breaking The `TextBlob.json` property was changed to a method `TextBlob.json()`.
Install
-
pip install textblob -
python -m textblob.download_corpora
Imports
- TextBlob
from textblob import TextBlob
- TextBlob (legacy)
from textblob import TextBlob
- TextBlob (casing)
from textblob import TextBlob
Quickstart
from textblob import TextBlob
text = "TextBlob is amazingly simple to use. What great fun!"
blob = TextBlob(text)
print(f"Original text: {text}")
print(f"Sentiment Polarity: {blob.sentiment.polarity}") # Range [-1.0, 1.0]
print(f"Sentiment Subjectivity: {blob.sentiment.subjectivity}") # Range [0.0, 1.0]
print(f"Part-of-speech tags: {blob.tags}")
print(f"Noun phrases: {blob.noun_phrases}")
# Example of a common warning: not downloading corpora leads to LookupError
# Run `python -m textblob.download_corpora` if you get a LookupError.