mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-20 00:51:58 +03:00
further fixes to from_dict and to_dict
This commit is contained in:
parent
b68053c6c8
commit
c7c22a8dd5
|
@ -183,8 +183,8 @@ class Doc:
|
|||
) -> Doc: ...
|
||||
def to_bytes(self, *, exclude: Iterable[str] = ...) -> bytes: ...
|
||||
def from_bytes(self, bytes_data: bytes, *, exclude: Iterable[str] = ...) -> Doc: ...
|
||||
def to_dict(self, *, exclude: Iterable[str] = ...) -> bytes: ...
|
||||
def from_dict(self, msg: bytes, *, exclude: Iterable[str] = ...) -> Doc: ...
|
||||
def to_dict(self, *, exclude: Iterable[str] = ...) -> Dict[str, Any]: ...
|
||||
def from_dict(self, msg: Dict[str, Any], *, exclude: Iterable[str] = ...) -> Doc: ...
|
||||
def extend_tensor(self, tensor: Floats2d) -> None: ...
|
||||
def retokenize(self) -> Retokenizer: ...
|
||||
def to_json(self, underscore: Optional[List[str]] = ...) -> Dict[str, Any]: ...
|
||||
|
|
|
@ -1362,8 +1362,7 @@ cdef class Doc:
|
|||
"""Export the document contents to a dictionary for serialization.
|
||||
|
||||
exclude (Iterable[str]): String names of serialization fields to exclude.
|
||||
RETURNS (bytes): A losslessly serialized copy of the `Doc`, including
|
||||
all annotations.
|
||||
RETURNS (Dict[str, Any]): A dictionary representation of the `Doc`
|
||||
"""
|
||||
array_head = Doc._get_array_attrs()
|
||||
strings = set()
|
||||
|
@ -1409,13 +1408,11 @@ cdef class Doc:
|
|||
return util.to_dict(serializers, exclude)
|
||||
|
||||
def from_dict(self, msg, *, exclude=tuple()):
|
||||
"""Deserialize, i.e. import the document contents from a binary string.
|
||||
"""Deserialize the document contents from a dictionary representation.
|
||||
|
||||
data (bytes): The string to load from.
|
||||
exclude (list): String names of serialization fields to exclude.
|
||||
msg (Dict[str, Any]): The dictionary to load from.
|
||||
exclude (Iterable[str]): String names of serialization fields to exclude.
|
||||
RETURNS (Doc): Itself.
|
||||
|
||||
DOCS: https://spacy.io/api/doc#from_dict
|
||||
"""
|
||||
if self.length != 0:
|
||||
raise ValueError(Errors.E033.format(length=self.length))
|
||||
|
|
Loading…
Reference in New Issue
Block a user