mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-22 18:12:00 +03:00
Drop generate_from_disk().
This commit is contained in:
parent
14b22b9d65
commit
f53dc46f65
|
@ -109,20 +109,6 @@ cdef class KnowledgeBase:
|
|||
Errors.E1045.format(parent="KnowledgeBase", method="from_disk", name=self.__name__)
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def generate_from_disk(
|
||||
cls: Type[_KBType], path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()
|
||||
) -> _KBType:
|
||||
"""
|
||||
Factory method for generating KnowledgeBase subclass instance from file.
|
||||
path (Union[str, Path]): Target file path.
|
||||
exclude (Iterable[str]): List of components to exclude.
|
||||
return (_KBType): Instance of KnowledgeBase subclass generated from file.
|
||||
"""
|
||||
raise NotImplementedError(
|
||||
Errors.E1044.format(parent="KnowledgeBase", method="generate_from_disk", name=cls.__name__)
|
||||
)
|
||||
|
||||
def is_empty(self) -> bool:
|
||||
"""Returns whether KnowledgeBase is empty.
|
||||
RETURNS (bool): Whether KnowledgeBase is empty.
|
||||
|
|
|
@ -49,14 +49,6 @@ cdef class InMemoryLookupKB(KnowledgeBase):
|
|||
def is_empty(self):
|
||||
return len(self) == 0
|
||||
|
||||
@classmethod
|
||||
def generate_from_disk(
|
||||
cls, path: Union[str, Path], exclude: Iterable[str] = SimpleFrozenList()
|
||||
) -> "InMemoryLookupKB":
|
||||
kb = InMemoryLookupKB(vocab=Vocab(strings=["."]), entity_vector_length=1)
|
||||
kb.from_disk(path)
|
||||
return kb
|
||||
|
||||
def __len__(self):
|
||||
return self.get_size_entities()
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user