It depends on the ML model you use and how it has been trained.
The standard would be nltk or textblob
textblob I believe should already be trained up for these language nuisances:
import re
x = ' '.join(re.sub('(@[A-Za-z0-9]+)|([^0-9A-Za-z \t])|(\w+:\/\/\S+)', ' ', 'That is not bad example').split())
from textblob import TextBlob
analysis = TextBlob(x)
sentiment = analysis.sentiment.polarity
the above code should yield the following sentiments:
'That is bad example' : -0.6999999999999998
'That is not bad example' : 0.3499999999999999
'That is good example' : 0.7
'That is not good example' : -0.35
already you can see that this sentiment analyzer has grasped some concept of double negative and negative positive. It can be trained further by invoking:
from textblob.classifiers import NaiveBayesClassifier
cl = NaiveBayesClassifier(training_Set)
and using cl
but effort would be better spent by you defining what is a positive sentiment by some arbitrary threshold (if > 0.1 then good). I mean the 'bad' and 'not good' are already negative... so why try to re-invent the wheel?
ML right now is "smart enough"... you often have to use your own intelligence to bridge the gap that the machine lacks...
you can also use sentiment = analysis.sentiment.subjectivity
to see how objective or subjective the text is to offer you more insight