mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-11 17:10:36 +03:00
Fix corpus when no raw text supplied
This commit is contained in:
parent
d9289712ba
commit
549164c31c
|
@ -201,7 +201,16 @@ class GoldCorpus(object):
|
||||||
):
|
):
|
||||||
""" Setting gold_preproc will result in creating a doc per sentence """
|
""" Setting gold_preproc will result in creating a doc per sentence """
|
||||||
for eg_dict in annotations:
|
for eg_dict in annotations:
|
||||||
example = Example.from_dict(eg_dict, doc=nlp.make_doc(eg_dict["text"]))
|
if eg_dict["text"]:
|
||||||
|
example = Example.from_dict(
|
||||||
|
eg_dict,
|
||||||
|
doc=nlp.make_doc(eg_dict["text"])
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
example = Example.from_dict(
|
||||||
|
eg_dict,
|
||||||
|
doc=Doc(nlp.vocab, words=eg_dict["words"])
|
||||||
|
)
|
||||||
example_docs = []
|
example_docs = []
|
||||||
if gold_preproc:
|
if gold_preproc:
|
||||||
split_examples = example.split_sents()
|
split_examples = example.split_sents()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user