I am trying to solve an NLP problem. For a given sentence like :

"The Pasta was delicious, the Pizza was average"

I want to extract the sentiment attached to food items. Having built my own NER model, I am able to extract Pasta and Pizza and hence the sentences containing them. But using a sentiment analyser on the entire sentence would be wrong in this case


Pasta - Good score Pizza - Average score


Pasta - Kinda Good Score Pizza - Kinda Good Score

I know I am getting this output because I am considering the same sentence for getting the sentiment attached to both the subjects in hand.

Is there a way to extract the sub sentence like "Pasta was good" and "Pizza was average" to associate sentence with each item instead of whole sentences which I am currently doing ?


1 Answer 1


If you would know the target(s) (pasta, pizza) and the sentiment features (good, bad, etc), you could try to catch the feature that is closest to the target in a sentence.

But to say more, it really is necessary to see more of your sentences to understand the structure.

  • $\begingroup$ I am trying to gather the sentiment around the food item from user reviews. For your reference you can check out restaurant reviews at yelp or similar website. Now it is not necessary that 'Pasta' will always be 'good' or 'Pizza' will always be 'average' for me to match these adjectives directly to my target words. Also if I build my own model to get sentiment feature I'll be looking at numerous possibilities like 'really really bad', 'bitter sweat experience' etc. which I don't want to dive into, I want to extract the sentence/sub sentence representing a particular target variable $\endgroup$ Nov 17, 2019 at 3:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.