Closed brandonbell11 closed 2 years ago
Since you closed this I assume you've figured it out, but in case anybody else has a similar issue later, I'll explain a bit. Something like (a / alpha :ARG0-of (b / beta))
is a serialization of the graph with an :ARG0
edge from b
to a
:
>>> import penman
>>> g = penman.decode('(a / alpha :ARG0-of (b / beta))')
>>> g.triples
[('a', ':instance', 'alpha'), ('b', ':ARG0', 'a'), ('b', ':instance', 'beta')]
Users of AMR data have a tendency to prefer the tree-like graph where :ARG0-of
is the branch label from a
to b
. If you fall into this group, you have two options in the Penman library. You can either work with the tree, e.g., as returned by penman.parse() (instead of the graph from penman.decode()):
>>> t = penman.parse('(a / alpha :ARG0-of (b / beta))')
>>> t
Tree(('a', [('/', 'alpha'), (':ARG0-of', ('b', [('/', 'beta')]))]))
... or decode the graph with a model that pretends that no edges are inverted and all edge labels are canonical, namely the NoOpModel:
>>> from penman.models import noop
>>> g = penman.decode('(a / alpha :ARG0-of (b / beta))', model=noop.model)
>>> g.triples
[('a', ':instance', 'alpha'), ('a', ':ARG0-of', 'b'), ('b', ':instance', 'beta')]
Example sentence:
He found a loophole in her request
Has an AMR of:
steps to reproduce:
This returns
I am trying to comb through the source code to try and correct this but I am very new to the project. So any assistance would be helpful