mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-11 00:32:40 +03:00
Add abstract method KnowledgeBase.__len__().
This commit is contained in:
parent
ca915e1ae9
commit
4eb072fa91
|
@ -90,8 +90,7 @@ cdef class KnowledgeBase:
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_disk(self, path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()) -> None:
|
def to_disk(self, path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()) -> None:
|
||||||
"""
|
"""Write KnowledgeBase content to disk.
|
||||||
Write KnowledgeBase content to disk.
|
|
||||||
path (Union[str, Path]): Target file path.
|
path (Union[str, Path]): Target file path.
|
||||||
exclude (Iterable[str]): List of components to exclude.
|
exclude (Iterable[str]): List of components to exclude.
|
||||||
"""
|
"""
|
||||||
|
@ -100,11 +99,18 @@ cdef class KnowledgeBase:
|
||||||
)
|
)
|
||||||
|
|
||||||
def from_disk(self, path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()) -> None:
|
def from_disk(self, path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()) -> None:
|
||||||
"""
|
"""Load KnowledgeBase content from disk.
|
||||||
Load KnowledgeBase content from disk.
|
|
||||||
path (Union[str, Path]): Target file path.
|
path (Union[str, Path]): Target file path.
|
||||||
exclude (Iterable[str]): List of components to exclude.
|
exclude (Iterable[str]): List of components to exclude.
|
||||||
"""
|
"""
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
Errors.E1044.format(parent="KnowledgeBase", method="from_disk", name=self.__name__)
|
Errors.E1044.format(parent="KnowledgeBase", method="from_disk", name=self.__name__)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def __len__(self) -> int:
|
||||||
|
"""Returns number of entities in the KnowledgeBase.
|
||||||
|
RETURNS (int): Number of entities in the KnowledgeBase.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError(
|
||||||
|
Errors.E1044.format(parent="KnowledgeBase", method="__len__", name=self.__name__)
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user