pip install textblob
python
from textblob import TextBlob
text = "TextBlob makes it easy to perform sentiment analysis on text."
blob = TextBlob(text)
sentences = blob.sentences
words = blob.words
noun_phrases = blob.noun_phrases
print(sentences)
print(words)
print(noun_phrases)
python
from textblob import TextBlob
text = "TextBlob is a simple and easy-to-use library for NLP."
blob = TextBlob(text)
tags = blob.tags
print(tags)
python
from textblob import TextBlob
text = "I love this library!"
blob = TextBlob(text)
sentiment = blob.sentiment.polarity
print(sentiment)
python
from textblob import TextBlob
text = "TextBlob is a great library for natural language processing."
blob = TextBlob(text)
translated = blob.translate(to='zh-CN')
print(translated)