0
votes

I am trying to build a feedback sentiment analyser based on a semantic approach. As an example: "I had safe journey" – assume this is feedback for a driver, provided by a passenger. I need to extract the following information from this sentence:

"I had safe journey" -> 
 SUBJECT= "driving"
 SENTIMENT= "positive"

I am using NLTK and I referred NLTK Book. I already followed the "Extracting Information from Text" section. That section talks about Chunking using a regular-expression based grammar. But I am confused, there are a number of different sentence patterns for the English language and I don't know how to cover all the possibilities.

Actually, I am new to NLP. I also found "Analyzing Sentence Structure" and "Analyzing the Meaning of Sentences" in the NLTK book. Is chunking enough to achieve my goal and what am I supposed to do?

2

2 Answers

0
votes

You don't necessarily have to do parsing or chunking. Both detection of the subject and of the sentiment polarity might be achieved with plain bag-of-words based clasifiers at a sufficient level of quality. It depends on the nature of your input text (how long they are, how many spelling/grammar errors there are, how many different subjects...) and on your needs (eg. if you are happy with 80% accuracy already).

What you most certainly need, however, is either a training set of already classified instances, or a good polarity lexicon. If you don't have either, parsing/chunking won't help you a lot.

0
votes

Two solutions:

  • Supervised learning: a Naive Bayes classifier would be appropriate. It is efficient but you need a training set.
  • Lexicon-based approach: if you don't have a training set, you can use a list of polarized words. You should do some reseach about SentiWordNet, MPQA or SentiStrength. (Bonus: you also can have a look at WordNet-Affect which provides a tree of emotions. It is quite old but you still can use it with the WNAffect interface)

But first of all you should tokenize your text. With NLTK, you can use Punkt calling nltk.word_tokenize().