Sentiment analysis

Well, there are several methods,

I would start with checking Capital letter, usually, when referring to a name, first letter is capitalized.

Before doing sentiment analysis, I would use some Part-of-speech and Named Entity Recognition to tag the relevant words.

Stanford CoreNLP is a good text analysis project to start with, it will teach you the basic concepts.

Example from CoreNLP:

enter image description here

You can see how the tags can help you.

And check out more info


As described by Ofiris, NER is only one way to do solve your problem. I feel it's more effective to use word embedding to represent your words. In that way machine automatically recognize the context of the word. As an example "Apple" is mostly coming together with "eat" and But if the given input "Apple" is present with "mobile" or any other word in that domain, Machine will understand it's "iPhone apple" instead of "apple fruit". There are 2 popular ways to generate word embeddings such as word2vec and fasttext. Gensim provides more reliable implementations for both word2vec and fasttext.

https://radimrehurek.com/gensim/models/word2vec.html https://radimrehurek.com/gensim/models/fasttext.html