I'm familiar with the bag of words/Naive bayes sentiment analysis for text (e.g. http://streamhacker.com/2010/05/10/text-classification-sentiment-analysis-naive-bayes-classifier/)

I was curious to see if anyone here knows anything about computing sentiment of a sentence with respect to a subject. For example, with respect to the word 'Joe', the sentence

"I am happy" is neutral sentiment whereas "Joe is happy" is positive sentiment

Do the traditional bag of words features work for this type of sentiment classification? or is a more sophisticated feature set necessary?



1 Answer 1


What you are talking here is a context based sentiment analysis which is actually very hard problem, much more complex and deep then "simple" sentiment analysis. This is something requring much deeper analysis then simple bag of words.

In the most simple case, where you are only interested in sentences actually containing the subject (like "John is nice") it would require NLP tools:

  • parsing the sentence to obtain the grammar tree
  • analyzing the text and tree to find semantic relations (or dependency tree)
  • analyzing anaphoras to connect semantics between sentences (in more complex example)

And using this additional information to perform actual analysis (either rule based, or supported with naive bayes with for example - terms weighted with distance in constructed gramatic/semantic graph).

So this task will require lots of engineering, as most of the NLP problems.


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.