How to identify sentiment of a given word from a sentence [closed]

Use case is like this:

Suppose I have a sentence(review data): The staffs were very kind and helpful. The room is ok for its price. There did not seem to be a heater in the room. So, a bit for our January trip.

Now if I want to know the sentiment of a word for example room then how should I proceed.

I have designed sentiment analysis for a given sentence using bag of words model, but determining the sentiment for the given word from the sentence (review data) is kind of new to me. What approach should I take here ?

Providing some approach or any link is enough.

• Does "room" even have sentiment in this context? Feb 18 '18 at 7:31
• @DavidMarx From the given sentence I can easily figure out that room has appeared in these two line The room is ok for its price. There did not seem to be a heater in the room. Which might tell some clue to me about what can be sentiment of room. Only thing I do not understand is the right approach to do this. Feb 18 '18 at 7:36
• This is a valid clear question and should be re-opened. Suppose we have a review of 500 words and we just want to know the sentiment associated with a specific term (e.g. bathroom). What methods or techniques could do that? Sep 24 '18 at 14:40

One of the ways to do it is to build bag of words and apply a linear model for sentimental analysis. Then you can look at model's coefficients - positive coefficient means word is positive, negative coefficient - negative word.

You could use existing indices of positive and negative words. This link from Quora lists several such indices.

True sentiment analysis from a single word could be difficult. Words derive their meaning from the context in which they appear. Almost any word could be positive or negative depending on how it's used. Still, there are probabilities at play so it may be a viable approach.