stanford dependency parser

廉价感情. 提交于 2019-12-07 22:34:20

问题


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)

回答1:


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.




回答2:


@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.




回答3:


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.



来源:https://stackoverflow.com/questions/12280467/stanford-dependency-parser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!