1 / introduction

Textblob is an extension package for English text analysis.  https://pypi.org/project/textblob/ https://textblob.readthedocs.io/en/latest/quickstart.html#quickstartCopy the code

2 / installation

pip install textblob
Copy the code

3 / function

4/ Specific application

<1> Emotion analysis

from textblob import TextBlob

text = "I am happy today. I feel sad today."

To initialize an instance object, pass in the initialization argument text
blob = TextBlob(text)

blob.sentences  Break the sentence into clauses

blob.sentences[0].sentiment  # Emotion of the first clause
blob.sentences[1].sentiment  # The emotion of the second clause

blob.sentiment # The emotion of the whole sentence

Copy the code

<2> For other functions, please refer to the official website documents

Textblob. Readthedocs. IO/en/latest/q…