TextBlob icon indicating copy to clipboard operation
TextBlob copied to clipboard

information about sentiment analysis algorithm

Open DSLituiev opened this issue 3 years ago • 2 comments

Is any information available such as publication or corpus used for training?

DSLituiev avatar Jan 20 '23 17:01 DSLituiev

related to a question in issue #412

DSLituiev avatar Jan 30 '23 14:01 DSLituiev

Internal working of TextBlob Sentiment Analysis Library:

Pattern Sentiment Analysis library is used by Textblob internally for sentiment Analysis. Pattern is a rule based algorithm and it uses knowledge base defined in en-sentiment.xml file for English language.

You can refer this video for more details on how textblob sentiment score is calculated: https://www.youtube.com/watch?v=Y8iNez1tCx8

Sentiment score database -- https://github.com/sloria/TextBlob/blob/6396e24e85af7462cbed648fee21db5082a1f3fb/textblob/en/en-sentiment.xml

You can add new words into this XML file based on your use-case and the word will get included and corresponding sentiment will be visible on reloading the environment.

For example lets add the word expedite:

<word form="expedite" pos="VB" sense="" polarity="-0.3" subjectivity="0.8" intensity="1.0" confidence="0.9" />

Then on reloading and re-running textblob.TextBlob.sentiment.polarity you will get polarity of -0.3

Textblob Sentiment analysis source code: https://github.com/sloria/TextBlob/blob/6396e24e85af7462cbed648fee21db5082a1f3fb/textblob/_text.py#L661

Deepankar-98 avatar Feb 17 '23 13:02 Deepankar-98