I found an (possible) issue with doubled instances (e.g. twice n / name instead a simple n in the second case) in a penman notation. Parsing the following graph
with
g = penman.decode(amr)
for x in g.triples:
print(x)
(a2 / and
:op1 (c2 / country
:name (n / name))
:op2 (c3 / country
:name (n / name))
)
returns
('a2', ':instance', 'and')
('a2', ':op1', 'c2')
('c2', ':instance', 'country')
('c2', ':name', 'n')
('n', ':instance', 'name')
('a2', ':op2', 'c3')
('c3', ':instance', 'country')
('c3', ':name', 'n')
('n', ':instance', 'name')
with ('n', ':instance', 'name') twice
If I want to re-encode this triples into penman with pm = penman.encode(penman.Graph(tr)); print(pm) I get the incorrect penman
(a2 / and
:op1 (c2 / country
:name (n / name
/ name))
I wonder where the bug is. I agree that the initial penman is at least suboptimal since n / name occurs twice ant should have only n in the second place. since n's concept is name in both cases that sould not be an fatal error.
Or is it the fact that ('n', ':instance', 'name') occurs twice which creates an incorrect penman.
So if the initial penman graph is acceptable, than there is clearly a problem in the decode/encode methods ?
I found an (possible) issue with doubled instances (e.g. twice
n / nameinstead a simplenin the second case) in a penman notation. Parsing the following graphwith
returns
with
('n', ':instance', 'name')twiceIf I want to re-encode this triples into penman with
pm = penman.encode(penman.Graph(tr)); print(pm)I get the incorrect penmanI wonder where the bug is. I agree that the initial penman is at least suboptimal since
n / nameoccurs twice ant should have onlynin the second place. sincen's concept isnamein both cases that sould not be an fatal error.Or is it the fact that
('n', ':instance', 'name')occurs twice which creates an incorrect penman.So if the initial penman graph is acceptable, than there is clearly a problem in the
decode/encodemethods ?