1from textblob import TextBlob
2
3text = '''
4The titular threat of The Blob has always struck me as the ultimate movie
5monster: an insatiably hungry, amoeba-like mass able to penetrate
6virtually any safeguard, capable of--as a doomed doctor chillingly
7describes it--"assimilating flesh on contact.
8Snide comparisons to gelatin be damned, it's a concept with the most
9devastating of potential consequences, not unlike the grey goo scenario
10proposed by technological theorists fearful of
11artificial intelligence run rampant.
12'''
13
14blob = TextBlob(text)
15blob.tags # [('The', 'DT'), ('titular', 'JJ'),
16 # ('threat', 'NN'), ('of', 'IN'), ...]
17
18blob.noun_phrases # WordList(['titular threat', 'blob',
19 # 'ultimate movie monster',
20 # 'amoeba-like mass', ...])
21
22for sentence in blob.sentences:
23 print(sentence.sentiment.polarity)
24# 0.060
25# -0.341
26
27blob.translate(to="es") # 'La amenaza titular de The Blob...'
28