sakthi
sakthi

Reputation: 29

stanford dependency parser

I have tried stanford dependency parser. I got the following parse tree and relation.But I need a dependency graph. How to get it. Is there any way to covert the dependencies to graph? Please help me. I am new to java and stanford tools.

Program is a set of instruction

(ROOT
  (S
    (NP (NNP Program))
    (VP (VBZ is)
      (NP
        (NP (DT a) (NN set))
        (PP (IN of)
          (NP (NN instruction)))))))

nsubj(set-4, Program-1)
cop(set-4, is-2)
det(set-4, a-3)
root(ROOT-0, set-4)
prep_of(set-4, instruction-6)

Upvotes: 2

Views: 4230

Answers (3)

Yang Zhou
Yang Zhou

Reputation: 31

You must have solved the problem, but i think this may help others. You may want to check the Stanford parser homepage.

You can find tydevi and DependenSee where

  • tydevi is typed Dependency Viewer that makes a picture of the Stanford Dependencies analysis of a sentence (By Bernard Bou), and

  • DependenSee is a Dependency Parse Visualisation Tool that makes pictures of Stanford Dependency output.

Upvotes: 3

Akash
Akash

Reputation: 119

I'm pretty sure you must have already found the answer but just in case. There is a method toDotFormat() that can be called on dependencies. This allows to store the result in DOT format which can be easily read as a graph using GraphViz. Using GV you can render it in many different formats such as png.

Upvotes: 0

srini.venigalla
srini.venigalla

Reputation: 5145

@Sakthi here is an implementation http://keithschwarz.com/interesting/code/?dir=topological-sort

You can also implement your own quick implementation using a Node class with left & right pointers.

XML DOM object also can be leveraged. Advantage with that is, you can use XPATH. Disadvantage is, it is a very costly implementation.

Upvotes: 0

Related Questions