Use reference parse to initialize parser moves (#9722)

This commit is contained in:
Adriane Boyd 2021-11-23 14:55:55 +01:00 committed by GitHub
parent 52b8c2d2e0
commit 36c7047946
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -585,7 +585,10 @@ cdef class ArcEager(TransitionSystem):
actions[RIGHT][label] = 1
actions[REDUCE][label] = 1
for example in kwargs.get('examples', []):
heads, labels = example.get_aligned_parse(projectivize=True)
# use heads and labels from the reference parse (without regard to
# misalignments between the predicted and reference)
example_gold_preproc = Example(example.reference, example.reference)
heads, labels = example_gold_preproc.get_aligned_parse(projectivize=True)
for child, (head, label) in enumerate(zip(heads, labels)):
if head is None or label is None:
continue