mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
issue5230 added unit test for dumping and loading knowledgebase
This commit is contained in:
parent
d2bb649227
commit
d60e2d3ebf
|
@ -115,6 +115,23 @@ def test_writer_with_path_py35():
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|
||||||
|
|
||||||
|
def test_save_and_load_knowledge_base():
|
||||||
|
nlp = Language()
|
||||||
|
kb = KnowledgeBase(nlp.vocab, entity_vector_length=1)
|
||||||
|
with make_tempdir() as d:
|
||||||
|
path = d / "kb"
|
||||||
|
try:
|
||||||
|
kb.dump(path)
|
||||||
|
except Exception as e:
|
||||||
|
pytest.fail(str(e))
|
||||||
|
|
||||||
|
try:
|
||||||
|
kb_loaded = KnowledgeBase(nlp.vocab, entity_vector_length=1)
|
||||||
|
kb_loaded.load_bulk(path)
|
||||||
|
except Exception as e:
|
||||||
|
pytest.fail(str(e))
|
||||||
|
|
||||||
|
|
||||||
class TestToDiskResourceWarningUnittest(TestCase):
|
class TestToDiskResourceWarningUnittest(TestCase):
|
||||||
def test_resource_warning(self):
|
def test_resource_warning(self):
|
||||||
scenarios = zip(*objects_to_test)
|
scenarios = zip(*objects_to_test)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user