I am exploring different types of parse tree structures. The two widely known parse tree structures are a) Constituency based parse tree and b) Dependency based parse tree structures.

I am able to use generate both types of parse tree structures using Stanford NLP package. However, I am not sure how to use these tree structures for my classification task.

For e.g If I want to do sentiment analysis and want to categorize text into positive and negative classes, what features can I derive from parse tree structures for my classification task?


2 Answers 2


By using a parse tree, you divide your sentence into parts. Suppose, in the example of sentiment analysis, you can use those parts to assign a positive/negative sentiment to each part and then take the cumulative effect of those parts.

sentiment analysis

This image will help you understand more. The first half has a negative sentiment(mainly because of the word "dry") but because of the word "but" and the usage of the word "enjoyed", the negative sentiment is turned into a positive sentiment.

As for using them, you can simply generate a word vector representation of the individual words in the sentence and use neurons in place of the parent nodes. Each neuron should be connected to another neuron through weights. All the leaf nodes will be the word vector representations of words of the sentence. The top parent neuron(in this case the top blue + symbol) should generate a positive/negative sentiment according to the sentence. This tree structure can be trained in a supervised manner.

Read this paper for a more through understanding.

Image credits: cs224.stanford.edu


I think dependencies can be used to improve the accurary of your sentiment classifier. Consider the following examples:

E1: Bill is not a scientist

and assume that the token "scientist" has a positive sentiment in a specific domain.

Knowing the dependency neg(scientist, not) we can see that the example above has a negative sentiment. Without knowing this dependency we would probably classify the sentence as positive.

Another types of dependencies can be used probably in the same way to improve the accuracy of the classifiers.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.