Skip to content

Commit

Permalink
DMRS.scopal_arguments: return correct scope labels
Browse files Browse the repository at this point in the history
Fixes #249
  • Loading branch information
goodmami committed Aug 15, 2019
1 parent 023ec82 commit 0588020
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion delphin/dmrs/_dmrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def scopal_arguments(self, scopes=None):
continue
# get the label if scopes was given
target = id_to_lbl.get(link.end, link.end)
scargs[link.start].append((link.role, relation, label))
scargs[link.start].append((link.role, relation, target))

return scargs

Expand Down
22 changes: 22 additions & 0 deletions tests/dmrs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,25 @@ def test_arguments(self, dogs_bark):
10001: [],
10002: []
}

def test_scopal_arguments(self, dogs_bark):
d = dmrs.DMRS()
assert d.scopal_arguments() == {}

d = dmrs.DMRS(**dogs_bark)
assert d.scopal_arguments() == {
10000: [],
10001: [('RSTR', 'qeq', 10002)],
10002: []
}

_, scopes = d.scopes()
scopemap = {}
for lbl, nodes in scopes.items():
for node in nodes:
scopemap[node.id] = lbl
assert d.scopal_arguments(scopes=scopes) == {
10000: [],
10001: [('RSTR', 'qeq', scopemap[10002])],
10002: []
}

0 comments on commit 0588020

Please sign in to comment.