# Sentiment analysis does not handle neturals [closed]

I'm writing some financial tools, I've found highly performant models for question and answering but when it comes to sentiment analysis I haven't found anything that good. I'm trying to use huggingface:

from transformers import pipeline
classifier = pipeline('sentiment-analysis')
print(classifier("i'm good"))
print(classifier("i'm neutral"))
print(classifier("i'm okay"))
print(classifier("i'm indifferent"))


Which returns results

[{'label': 'POSITIVE', 'score': 0.999841034412384}]

[{'label': 'NEGATIVE', 'score': 0.9997877478599548}]

[{'label': 'NEGATIVE', 'score': 0.999396026134491}]

[{'label': 'POSITIVE', 'score': 0.9998164772987366}]

[{'label': 'NEGATIVE', 'score': 0.9997762441635132}]

The scores for all of the neutral words come up very high in a positive or negative direction, I would of figured the model would put the score lower.

I've looked at some of the more fine-tuned models yet they seem to perform the same.

I would assume there would be some pretrained models which could handle these use cases. If not, How can I find neutral sentiments?

• I closed this post because it seems you were mainly interested in a programming solution to your problem (given the accepted answer). However, if this was a conceptual question, i.e. you were interested in the approach rather than implementation, then let me know and I could re-open this post. – nbro Mar 10 at 13:42
• @nbro, I was fine with conceptually or programmatically, but you can leave this closed since I already found an answer which met my needs. – johnny 5 Mar 10 at 14:49

Yes, there is. You can try Spacy. Here you go.

import spacy
from spacytextblob.spacytextblob import SpacyTextBlob

spacy_text_blob = SpacyTextBlob()

text = "i'm good"
doc = nlp(text)
print(doc._.sentiment.polarity) # 0.7

doc = nlp(text)
print(doc._.sentiment.polarity) # -0.6999999999999998

text = "i'm neutral"
doc = nlp(text)
print(doc._.sentiment.polarity) # 0.0

text = "i'm okay"
doc = nlp(text)
print(doc._.sentiment.polarity) # 0.5

text = "i'm indifferent"
doc = nlp(text)
print(doc._.sentiment.polarity) # 0.0

• Thanks, this looks promising, I just need a few hours to check it out when im off work and then ill accept the answer! – johnny 5 Feb 17 at 14:25