I'll start with some examples. Think about a sentence like "Mazda CX5 is a good car.". NLTK sentiment analysis module "Vader" will give a positive polarity score on the sentence. Meanwhile a positive score will also be assigned to a sentence like "Mazda CX5 is a better car compared to Subaru Forester." However, the sentence in fact has a negative sentiment towards Subaru Forester. I wonder if there is any algorithm can actually identify such sentiment difference between the general sentiment and sentiment against a certain word in the sentence.
Aspect based analysis tried to solve above problem. It categorizes data by aspect and assign sentiment to it. Lets say you have a restaurant review :
Food was good and service was bad
It will create 2 categories :
- Aspect : Food Sentiment : Positive
- Aspect : Service Sentiment : Negative
I faced a similar problem. Here it is what I did
- Parts of speech tagging with spacy
- Extract relationship. In your case it will be object(Mazda) comparative (than) object (Subaru) .
- .label the data set using multi labels: positive object , negative object . Each sentence will have two labels. For example under positive write Mazda, under negative write Subaru.
- Train using word2vec approach.