-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature request: structured representation with layout information #37
Comments
Hi, thanks for your interest and for trying it out. I'm not quite seeing the problem. Perhaps you can explain a bit more what you are trying to do? The However you can get the information that was encoded by the from penman.layout import Push
def is_inverted(graph, triple):
for epi in graph.epidata.get(triple, []):
if isinstance(epi, Push) and epi.variable == triple[0]:
return True
return False Test it out: >>> from penman import decode
>>> g = decode('(a / alpha :ARG1 (b / beta) :ARG1-of (g / gamma))')
>>> for t in g.triples:
... print(t, is_inverted(g, t))
...
('a', ':instance', 'alpha') False
('a', ':ARG1', 'b') False
('b', ':instance', 'beta') False
('g', ':ARG1', 'a') True
('g', ':instance', 'gamma') False This is how the In any case, based on this I see a couple ways we could perhaps make Penman easier to use:
Does this sound reasonable to you? |
Entirely reasonable. I was concerned that a function such as this, while small, might (1) miss cases and (2) break when you make additional upstream changes. Your clarification addresses the first concern; inclusion would help with the second (and be most appreciated). |
Ok, then I'll see if I can put it into the next release. Let me address your concerns:
Finally, the main point is that edge inversion is just a symptom of decisions made when serializing the graph---they do not bear any semantic meaning. If you really care about having an accurate picture of inverted edges, I suggest you use the tree structure instead of the graph, which is available via the codec's |
@unendin I've now released v0.8.0 which includes the I did not add a function for retrieving epigraphical markers of a particular type. See #39 for that. |
Great to see the new work. I use the Graph.triples() output from the previous version of penman as an intermediate format when converting amr strings to, eg, networkx or igraph. This relies on the inverted attribute of Triples. With that attribute now gone, and no public interface to the epigraph logic, it's not clear how make use of the new version.
The text was updated successfully, but these errors were encountered: