from textblob import TextBlob
doc = TextBlob(u"Let's make the U.S.A. great again! Whadya say, Bob? #blessed")
doc.words
doc.tags
review = TextBlob("It's the 21st century, and a group of space marines are sent to destroy a monster that terrorizes the entire galaxy, the ultimate threat... A Leprechaun! This was a very funny movie, with the Leprechaun teaming up with a dastardly space princess who wants the Leprechaun's gold. Together the killer their way through a group of hilarious characters (but not as hilarious as in Leprechaun 3). Especially the Doctor, which Dr. Evil (From Austin Powers) resembles. Altough this came out in February '97 while the first Austing came out in May '97. Anyway, this was the 4th highest renting horror movie of '97. This is the second best Lep movie, following behind #3. Both of this were directed by Brian Trenchard-Smith, and I think he should direct Leprechaun 5: Lep In The Hood (Which is going to be theatrical and have more comedy than horror, it will star Warwick Davis and Ice-T and will be set in an inner city Los Angeles neighborhood. It will film in late summer, '99.")
review.sentences
review.noun_phrases
The sentiment analyzer returns polarity (-1 negative, +1 positive) and subjectivity (0 objective, 1 subjective)
review.sentiment
review.sentiment.polarity
sentence = review.sentences[0]
print(sentence)
print(sentence.words)
print(sentence.words[10].singularize())
print(sentence.words[16].pluralize())
from textblob import Word
Word("terrorizes").lemmatize()
Word("cacti").lemmatize() # knows some odd ones
Word("fungi").lemmatize() # doesn't know 'em all
Word("sent").lemmatize() # doesn't work
Word("sent").lemmatize("v") # say it's a verb
sentence5 = review.sentences[5]
print(sentence5)
print(sentence5.correct())
en_blob = sentence
en_blob.translate(to='es')
b = TextBlob(u"بسيط هو أفضل من مجمع")
b.detect_language()
print(doc)
print(doc.parse())