Fixed #100 : SheerkaAdmin: Add builtins() command

Fixed #99 : SheerkaQueryManager: I can manage contains predicate when filtering objects
Fixed #97 : ERROR: list indices must be integers or slices, not Concept
Fixed #96 : SequenceNodeParser: SequenceNodeParser must correctly handle concept definition
Fixed #95 : ResolveAmbiguity must not remove concepts that do not require evaluation
Fixed #94 : Concepts with the same key are lost when new ontology
Fixed #93 : Introduce BuiltinConcepts.EVAL_GLOBAL_TRUTH_REQUESTED
Fixed #92 : ExpressionParser: Implement compile_disjunctions()
Fixed #91 : Implement get_concepts_complexity(context, concepts, concept_parts)
Fixed #90 : ResolveAmbiguity : where predicate is not used to resolve ambiguity
Fixed #89 : ResolveAmbiguityEvaluator: Concepts embedded in ConceptNode are not resolved
Fixed #88: SyaNodeParser: Parse multiple parameters when some of the are not recognized
Fixed #87: SyaNodeParser : Parse the multiple parameters
This commit is contained in:
2021-07-31 08:52:00 +02:00
parent 7dcaa9c111
commit e69745adc8
70 changed files with 1561 additions and 455 deletions
+20 -16
View File
@@ -7,9 +7,9 @@ from tests.TestUsingMemoryBasedSheerka import TestUsingMemoryBasedSheerka
class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
def test_i_can_add_concepts(self):
sheerka, context, man, human, male, driver, licence, car = self.init_concepts(
sheerka, context, man, human, male, driver, licence, car = self.init_test(global_truth=True).with_concepts(
"man", "human", "male",
"driver", "licence", "car")
"driver", "licence", "car").unpack()
sheerka.set_isa(context, sheerka.new("man"), human)
sheerka.set_isa(context, sheerka.new("man"), male)
@@ -23,8 +23,8 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
BuiltinConcepts.HASA: {car, licence}, }
def test_can_add_concepts_when_property_already_exist(self):
sheerka, context, man, human, king, male = self.init_concepts(
"man", "human", "king", "male")
sheerka, context, man, human, king, male = self.init_test(global_truth=True).with_concepts(
"man", "human", "king", "male").unpack()
sheerka.set_isa(context, sheerka.new("man"), human)
sheerka.set_isa(context, sheerka.new("king"), male)
@@ -35,9 +35,9 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
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(
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_test(global_truth=True).with_concepts(
"foo", "bar",
"isa1", "isa2", "has1", "has2")
"isa1", "isa2", "has1", "has2").unpack()
new_foo = sheerka.new("foo")
sheerka.set_isa(context, new_foo, isa1)
@@ -61,9 +61,10 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
BuiltinConcepts.HASA: {hasa2}, }
def test_i_can_recognize_myself_when_using_sdp_repository(self):
sheerka, context, foo, isa1, hasa1, = self.init_test(cache_only=False). \
with_concepts("foo", "isa1", "has1", create_new=True). \
unpack()
sheerka, context, foo, isa1, hasa1, = self.init_test(cache_only=False, global_truth=True).with_concepts(
"foo",
"isa1",
"has1", create_new=True).unpack()
sheerka.om.commit(context)
new_foo = sheerka.new("foo")
@@ -74,7 +75,10 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
assert sheerka.recognize(new_foo, all_scores=True) == [ConceptScore(1, new_foo, new_foo)]
def test_i_can_recognize_myself_when_not_using_sdp_repository(self):
sheerka, context, foo, isa1, hasa1, = self.init_concepts("foo", "isa1", "has1")
sheerka, context, foo, isa1, hasa1, = self.init_test(global_truth=True).with_concepts(
"foo",
"isa1",
"has1").unpack()
new_foo = sheerka.new("foo")
sheerka.set_isa(context, new_foo, isa1)
@@ -100,9 +104,9 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
assert sheerka.recognize(Concept(), all_scores=True) == []
def test_i_can_recognize_multiple_concepts_with_the_proper_score(self):
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_concepts(
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_test(global_truth=True).with_concepts(
"foo", "bar",
"isa1", "isa2", "has1", "has2")
"isa1", "isa2", "has1", "has2").unpack()
new_foo = sheerka.new("foo")
sheerka.set_isa(context, new_foo, isa1)
@@ -131,9 +135,9 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
ConceptScore(0.5, sheerka.new("bar"), to_recognize)]
def test_i_can_recognize_if_all_scores_is_disabled(self):
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_concepts(
sheerka, context, foo, bar, isa1, isa2, hasa1, hasa2 = self.init_test(global_truth=True).with_concepts(
"foo", "bar",
"isa1", "isa2", "has1", "has2")
"isa1", "isa2", "has1", "has2").unpack()
new_foo = sheerka.new("foo")
sheerka.set_isa(context, new_foo, isa1)
@@ -153,9 +157,9 @@ class TestSheerkaConceptsAlgebra(TestUsingMemoryBasedSheerka):
assert res == ConceptScore(1.0, sheerka.new("bar"), to_recognize)
def test_i_can_recognize_if_all_scores_is_disabled_but_multiple_high_scores(self):
sheerka, context, foo, bar, isa1, hasa1 = self.init_concepts(
sheerka, context, foo, bar, isa1, hasa1 = self.init_test(global_truth=True).with_concepts(
"foo", "bar",
"isa1", "has1")
"isa1", "has1").unpack()
new_foo = sheerka.new("foo")
sheerka.set_isa(context, new_foo, isa1)