3

Is it possible to use context-sensitive grammar in sentiment analysis? If yes, then how? Basically, I want to do some phrase-level analysis.

Hemant
  • 619
  • 2
  • 6
  • 17
  • 2
    Are you sure you understand what a context-sensitive grammar formally is ? I agree with @AaronD, you should first try with a classic, easy to parse context-free grammar. – Blacksad Mar 15 '13 at 19:27
  • 1
    `Context-Sensitive Grammar` is has rather broad definitions, basically, it means non-`Context Free Grammar`. If you're looking at `parsing` sentences correctly, then grammar is important, but you're looking at an almost end-user app, so i suggest you look for `knowledge` that guide grammar or produce better parses. I suggest that you look for things specific topics, e.g. `framenet`, `light verbs`, `deep linguistic processing`, `constraint-based grammar`, `unification grammar`, `HPSG`, `LFG`, `propbank`. – alvas Mar 16 '13 at 01:33

1 Answers1

5

Phrase structure and syntactic analysis (via a context-free or context-sensitive grammar, a dependency parser, etc.) would generally be performed in an earlier stage and used as input to sentiment analysis. You'd usually extract features from the parse tree and use in your sentiment classification stage (for example features, see the papers referenced below).

Phrase structure (in the form of parse trees) has been shown to be effective for other downstream tasks (see, for example, Fisher and Roark, 2008, "The utility of parse-derived features for automatic discourse segmentation" and Punyakanok et al., 2008, "The importance of syntactic parsing and inference in semantic role labeling").

I don't know offhand how much difference parse structure makes for sentiment analysis, but intuitively, it seems like it ought to help.

One question: Why are you interested in context-sensitive grammars? Even mildly-context-sensitive formalisms are dramatically more expensive to process (often by orders of magnitude), and - in my opinion - don't generally seem to improve downstream performance enough to warrant that additional expense. But if you have an application that would benefit from context-sensitive analysis vs. context-free, that would be a worthy and interesting goal.

If you decide that context-free phrase structure is sufficient for your needs, I'd recommend you take a look at the Stanford Parser and the BUBS Parser. The Stanford toolkit is more flexible, and BUBS is faster (full disclosure - I'm one of the primary developers of BUBS). I don't have enough experience with any of the context-sensitive implementations to make a recommendation there.

AaronD
  • 1,701
  • 13
  • 12
  • hey.. Thanks for the answer.. I ll look through the links that you have given, and will ask more questions :P The reason why I think context-sensitive grammar can be used is because I thought since it depends upon the context (please correct if I am wrong with 'context-knowing' point) as in take into consideration the context, the parsing will be more effective and more accurate results can be found! But I don't know exactly whether my assumption is true or not. So, any help in making me understand this thing will appreciable :) – Hemant Mar 15 '13 at 16:49
  • 1
    'Context-free' grammars do incorporate some context, but differently than context-sensitive grammars. The terminology comes from the Chomsky Hierarchy (http://en.wikipedia.org/wiki/Chomsky_hierarchy). Wikipedia doesn't discuss the cost of inference, but Ch2 of Nate Bodenstab's thesis does a good job: http://www.csee.ogi.edu/~bodensta/thesis-bodenstab.pdf. My suspicion is that you'll find that context-free processing works fine for you - you can probably get more gain working on the sentiment classification stage than by substituting a more sophisticated parser. – AaronD Mar 15 '13 at 17:25
  • If you're interested in a full blown HPSG grammar parser, i strongly suggest http://sweaglesw.org/linguistics/ace/ or http://heartofgold.dfki.de/PET.html – alvas Mar 16 '13 at 01:36