Fix schemas import in Doc (#10898)

This commit is contained in:
Adriane Boyd 2022-06-02 15:53:03 +02:00 committed by GitHub
parent 8387ce4c01
commit 7e13652d36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -17,7 +17,6 @@ from thinc.api import get_array_module, get_current_ops
from thinc.util import copy_array from thinc.util import copy_array
import warnings import warnings
import spacy.schemas
from .span cimport Span from .span cimport Span
from .token cimport MISSING_DEP from .token cimport MISSING_DEP
from ._dict_proxies import SpanGroups from ._dict_proxies import SpanGroups
@ -34,6 +33,7 @@ from ..errors import Errors, Warnings
from ..morphology import Morphology from ..morphology import Morphology
from .. import util from .. import util
from .. import parts_of_speech from .. import parts_of_speech
from .. import schemas
from .underscore import Underscore, get_ext_args from .underscore import Underscore, get_ext_args
from ._retokenize import Retokenizer from ._retokenize import Retokenizer
from ._serialize import ALL_ATTRS as DOCBIN_ALL_ATTRS from ._serialize import ALL_ATTRS as DOCBIN_ALL_ATTRS
@ -1488,7 +1488,7 @@ cdef class Doc:
""" """
if validate: if validate:
schema_validation_message = spacy.schemas.validate(spacy.schemas.DocJSONSchema, doc_json) schema_validation_message = schemas.validate(schemas.DocJSONSchema, doc_json)
if schema_validation_message: if schema_validation_message:
raise ValueError(Errors.E1038.format(message=schema_validation_message)) raise ValueError(Errors.E1038.format(message=schema_validation_message))