Support gold_preproc

This commit is contained in:
Matthew Honnibal 2020-06-22 17:48:38 +02:00
parent 2d34d2f24a
commit 03b3da26be

View File

@ -50,7 +50,11 @@ class Corpus:
def make_examples_gold_preproc(self, nlp, reference_docs): def make_examples_gold_preproc(self, nlp, reference_docs):
for whole_reference in reference_docs: for whole_reference in reference_docs:
for ref_sent in whole_reference.sents: if whole_reference.is_sentenced:
references = [sent.as_doc() for sent in whole_reference.sents]
else:
references = [whole_reference]
for ref_sent in references:
reference = ref_sent.as_doc() reference = ref_sent.as_doc()
predicted = Doc( predicted = Doc(
nlp.vocab, nlp.vocab,