Simple, Pythonic, text processing--Sentiment analysis, part-of-speech tagging, noun phrase extraction, translation, and more. https://textblob.readthedocs.io/
GitHub Link: https://github.com/sloria/TextBlob
In [1]:
!pip install -U TextBlob
In [2]:
!python -m textblob.download_corpora
In [3]:
from textblob import TextBlob
In [4]:
sample_text = 'Welcome to TextBlob! TextBlob is a Python (2 and 3) library for processing textual data. It provides a simple API for diving into common natural language processing (NLP) tasks such as part-of-speech tagging, noun phrase extraction, sentiment analysis, classification, translation, and more.'
In [5]:
blob = TextBlob(sample_text)
In [8]:
# lets check what all tokens it has
blob.words
Out[8]:
In [7]:
blob.word_counts
Out[7]:
In [9]:
blob.tags
Out[9]:
In [10]:
blob.sentiment
Out[10]:
In [11]:
# Text-Correction - Spell check
blob.correct()
Out[11]:
In [12]:
print(sample_text)
In [13]:
blob.parse()
Out[13]:
In [14]:
blob.translate(to="zh")
Out[14]: