Closed arademaker closed 4 years ago
That is just the labeled tree. We've discussed these in the past (see here and here). Basically, PyDelphin cannot create the labeled tree from a derivation as it requires unification using the grammar, which it doesn't do. If the tree is already in a profile or if you're parsing with ACE and the grammar supports labeled trees, you can use the tree()
method of the delphin.interface.Result API to get the tree as a nested list, or the original string via dictionary-key access:
>>> from delphin import itsdb
>>> ts = itsdb.TestSuite('mrs')
>>> next(ts.processed_items()).result(0).tree() # method returns a list
['S', ['NP-X', ['it']], ['VP', ['VP', ['V', ['rained.']]]]]
>>> next(ts.processed_items()).result(0)['tree'] # key access returns raw string
'("S" ("NP-X" ("it")) ("VP" ("VP" ("V" ("rained.")))))'
I think the question is answered and there's nothing to do here. Closing.
From the http://moin.delph-in.net/ItsdbProfile I learned that the result file contains two syntactic structures: the derivation tree and the phrase structure tree. I know that Pydelphin can manipulate the derivation tree. What about the phrase structure tree? Maybe one is a subset of the other?
input: a club of people to play chess
derivation tree
phrase structure tree