0

Given a bracket notation of constituent words, is there a way to convert it into its dependency tree?

[S [NP [Proper-Noun John]][VP [Verb saw][NP [Proper-Noun Mary]][PP [Preposition with][NP [Determiner a][Noun telescope]]]]]

into

nsubj(saw-2, John-1)
root(ROOT-0, saw-2)
dobj(saw-2, Mary-3)
case(telescope-6, with-4)
det(telescope-6, a-5)
nmod(saw-2, telescope-6)
arjun
  • 1,594
  • 16
  • 33

1 Answers1

0

There are many language/representation-specific decisions and heuristics involved in this kind of conversion, so you're not going to find any standard language-independent conversion tools. If you're working with PTB-style English trees there are several existing converters:

Your example doesn't look like a standard PTB tree so you might need to adapt an existing converter, in which case the Stanford converter is probably a good starting point.

aab
  • 10,858
  • 22
  • 38
  • So to get SVO triples as well, you need dependency parsing? Or is possible to extract this info from the above output only? – arjun Nov 16 '17 at 15:15
  • No, the dependency relations are extracted from a constituent parse tree similar to the one above. Take a look at the Stanford parser code in edu.stanford.nlp.trees.EnglishGrammaticalStructure and edu.stanford.nlp.trees.EnglishGrammaticalRelations. EnglishGrammaticalRelations shows the kind of tree patterns that are used to find relations like nsubj. You can see that it's very English/PTB-specific and there are a lot of heuristics. – aab Nov 20 '17 at 10:23