Update GoldParse

This commit is contained in:
Matthew Honnibal 2020-06-13 23:11:29 +02:00
parent 3a0bbcfb4c
commit 8f941ef527

View File

@ -35,7 +35,7 @@ def get_parses_from_example(
else: else:
# not merging: one GoldParse per sentence, defining docs with the words # not merging: one GoldParse per sentence, defining docs with the words
# from each sentence # from each sentence
examples = eg.split_sents() examples = example.split_sents()
outputs = [] outputs = []
for eg in examples: for eg in examples:
eg_dict = eg.to_dict() eg_dict = eg.to_dict()
@ -62,18 +62,21 @@ cdef class GoldParse:
""" """
@classmethod @classmethod
def from_annotation(cls, doc, doc_annotation, token_annotation, make_projective=False): def from_annotation(cls, doc, doc_annotation, token_annotation, make_projective=False):
return cls(doc, words=token_annotation.words, return cls(
tags=token_annotation.tags, doc,
pos=token_annotation.pos, words=token_annotation["words"],
morphs=token_annotation.morphs, tags=token_annotation["tags"],
lemmas=token_annotation.lemmas, pos=token_annotation["pos"],
heads=token_annotation.heads, morphs=token_annotation["morphs"],
deps=token_annotation.deps, lemmas=token_annotation["lemmas"],
entities=token_annotation.entities, heads=token_annotation["heads"],
sent_starts=token_annotation.sent_starts, deps=token_annotation["deps"],
cats=doc_annotation.cats, entities=token_annotation["entities"],
links=doc_annotation.links, sent_starts=token_annotation["sent_starts"],
make_projective=make_projective) cats=doc_annotation["cats"],
links=doc_annotation["links"],
make_projective=make_projective
)
def get_token_annotation(self): def get_token_annotation(self):
ids = None ids = None