Drop generate_from_disk().

This commit is contained in:
Raphael Mitsch 2023-03-02 13:24:53 +01:00
parent 14b22b9d65
commit f53dc46f65
2 changed files with 0 additions and 22 deletions

View File

@ -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.

View File

@ -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()