forked from udapi/udapi-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse.py
More file actions
22 lines (19 loc) · 704 Bytes
/
parse.py
File metadata and controls
22 lines (19 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""tutorial.Parse block template.
Usage:
udapy read.Conllu zone=gold files=sample.conllu \
read.Conllu zone=pred files=sample.conllu \
transform.Flatten zones=pred \
tutorial.Parse zones=pred \
eval.Parsing gold_zone=gold \
util.MarkDiff gold_zone=gold \
write.TextModeTreesHtml marked_only=1 files=parse-diff.html
"""
from udapi.core.block import Block
class Parse(Block):
"""Dependency parsing."""
def process_tree(self, root):
# TODO: Your task: implement a better heuristics than "right chain"
for node in root.descendants:
if node.next_node:
node.parent = node.next_node
node.deprel = 'root'