Added first version of DebugManager. Implemented draft of the rule engine

This commit is contained in:
2020-11-20 13:41:45 +01:00
parent cd066881b4
commit 315f8ea09b
156 changed files with 8388 additions and 2852 deletions
+6 -6
View File
@@ -19,7 +19,7 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
res = sheerka.cadd(context, sheerka.new("man"), sheerka.new("driver"))
assert isinstance(res, Concept)
assert res.metadata.props == {BuiltinConcepts.ISA: {male, human},
assert res.get_metadata().props == {BuiltinConcepts.ISA: {male, human},
BuiltinConcepts.HASA: {car, licence}, }
def test_can_add_concepts_when_property_already_exist(self):
@@ -32,7 +32,7 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
res = sheerka.cadd(context, sheerka.new("man"), sheerka.new("king"))
assert isinstance(res, Concept)
assert res.metadata.props == {BuiltinConcepts.ISA: {male, human}}
assert res.get_metadata().props == {BuiltinConcepts.ISA: {male, human}}
def test_i_can_subtract_concepts(self):
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_concepts(
@@ -53,14 +53,14 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
res = sheerka.csub(context, new_foo)
assert isinstance(res, Concept)
assert res.metadata.props == res.metadata.props
assert res.get_metadata().props == res.get_metadata().props
res = sheerka.csub(context, new_foo, new_bar)
assert isinstance(res, Concept)
assert res.metadata.props == {BuiltinConcepts.ISA: {isa2},
assert res.get_metadata().props == {BuiltinConcepts.ISA: {isa2},
BuiltinConcepts.HASA: {hasa2}, }
def test_i_can_recognize_myself_when_cache_only_is_not_set(self):
def test_i_can_recognize_myself_when_using_sdp_repository(self):
sheerka, context, foo, isa1, hasa1, = self.init_concepts("foo", "isa1", "has1",
cache_only=False,
create_new=True)
@@ -73,7 +73,7 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
assert sheerka.recognize(new_foo, all_scores=True) == [ConceptScore(1, new_foo, new_foo)]
def test_i_can_recognize_myself_when_cache_only_is_set(self):
def test_i_can_recognize_myself_when_not_using_sdp_repository(self):
sheerka, context, foo, isa1, hasa1, = self.init_concepts("foo", "isa1", "has1")
new_foo = sheerka.new("foo")