sometimes the kind of the word is totally different from its real meaning, the situation must be clear in which a sentence is said, and another important thing is the exclamatory words, hopefully that might make a sense to the tones!!
Hard to give a more specific answer without more detail, but this kind of problem would generally be considered a kind of "sentiment analysis" in the NLP literature. That search term should give you some good starting points.