#412·TextBlob

Modify TextBlob sentiment prediction algorithm

Author: Deepankar-98Created Aug 23, 2022Updated Aug 23, 2022

I am trying to work on a use-case which requires predicting the polarity but the result is not accurate. Our main focus is on the -ve inputs but it is unable to find it with confidence. I tried to go through the github code base and understand how exactly the sentiment is predicted by the algo but was unable to get a clear picture.

So I have 3 questions:

  1. Can we modify and retrain the the algorithm by passing more training data? If YES, then how can we do that?

  2. Textblob sentiment analysis using Naive Bayes but what I want to understand is what steps are happening after passing the data to tb = TextBlob(data) and then calling tb.sentiment on it. I would really appreciate if I can have a detailed steps including preprocessing, etc.

  3. I am performing the following preprocessing steps before passing the data to TextBlob:

    • removing numbers, dates, months, urls, hashtags, mentions, etc
    • lowercasing,
    • removing punctuation marks
    • stop word removal and converting -ve words like don't to just not as do is a stop word, etc

    Can you suggest if removing/ adding any of the above steps will lead to grater confidence & accuracy in polarity prediction?