New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibly disconnected graph #141
Comments
Hi, thanks for submitting this report. I initially agreed that this was a bug, but after probing a bit I think it's just an edge case. The short answer or workaround is: make sure your nodes/variables all have When configuring a tree for PENMAN output from a Graph, the Penman library identifies the variables (or node identifiers) as the set of symbols appearing as the source in one or more Graph triples. Since >>> import penman
>>> penman.Graph([('a3', ':ARG0', 'p2'), ('a2', ':ARG1', 'p2')]).variables()
{'a2', 'a3'} Penman therefore treats it like a constant. It is therefore similar to something like this, which is more clearly a disconnected graph in AMR: >>> penman.Graph([('a3', ':polarity', '-'), ('a2', ':polarity', '-')]) Your example works if I give the conjunctive node >>> penman.encode(penman.Graph([('a3', ':ARG0', 'p2'), ('a2', ':ARG1', 'p2'), ('p2', ':instance', None)]))
'(a3 :ARG0 (p2 :ARG1-of a2))' Another option is to use an explicit >>> from penman.layout import Push
>>> penman.encode(
... penman.Graph(
... [('a3', ':ARG0', 'p2'), ('a2', ':ARG1', 'p2')],
... epidata={('a3', ':ARG0', 'p2'): [Push('p2')]}
... )
... )
'(a3 :ARG0 (p2 :ARG1-of a2))' You could argue that symbols like Does that help at all? |
Thank you very much for your answer and the examples.
Yesss! it's crystal clear why it caused the error and now I see how to handle those cases. Thank you very much and I'll close the issue. |
Hello,
First of all, I'd like to thank the contributors of Penman!
I have an example which causes 'possibly disconnected graph' error and I can't wrap my head around the cause of the error.
I expected it to encode something like this:
Instead, I have a 'possibly disconnected graph' error when encoding. Is this an expected behavior of penman, and If so, could you please help me understand why the encoding is failing? Your assistance would be greatly appreciated.
Thank you very much.
The text was updated successfully, but these errors were encountered: