We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cecb9eb commit 5a7dd36Copy full SHA for 5a7dd36
udapi/block/ud/fixmultiobjects.py
@@ -0,0 +1,18 @@
1
+"""
2
+Block ud.FixMultiObjects will ensure that no node has more than one (direct) object child.
3
4
+from udapi.core.block import Block
5
+
6
7
+class FixMultiObjects(Block):
8
+ """
9
+ Make sure there is at most one object.
10
11
12
+ def process_node(self, node):
13
+ objects = [x for x in node.children if x.udeprel == 'obj']
14
+ # For the moment, we take the dummiest approach possible: The first object survives and all others are forced to a different deprel.
15
+ if len(objects) > 1:
16
+ objects = objects[1:]
17
+ for o in objects:
18
+ o.deprel = 'iobj'
0 commit comments