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
@@ -46,10 +46,10 @@ class SheerkaEvaluateConcept(BaseService):
self.rule_evaluator = None
def initialize(self):
self.sheerka.bind_service_method(self.evaluate_concept, True)
self.sheerka.bind_service_method(self.call_concept, True)
self.sheerka.bind_service_method(self.call_concept, False, as_name="evaluate_question")
self.sheerka.bind_service_method(self.set_auto_eval, True)
self.sheerka.bind_service_method(self.NAME, self.evaluate_concept, True)
self.sheerka.bind_service_method(self.NAME, self.call_concept, True)
self.sheerka.bind_service_method(self.NAME, self.call_concept, False, as_name="evaluate_question")
self.sheerka.bind_service_method(self.NAME, self.set_auto_eval, True)
def initialize_deferred(self, context, is_first_time):
self.rule_evaluator = self.sheerka.services[SheerkaEvaluateRules.NAME]
@@ -499,9 +499,7 @@ class SheerkaEvaluateConcept(BaseService):
if current_prop in (ConceptParts.WHERE, ConceptParts.PRE):
sub_context.protected_hints.add(BuiltinConcepts.EVAL_UNTIL_SUCCESS_REQUESTED)
if current_prop == ConceptParts.WHERE:
sub_context.protected_hints.add(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
sub_context.protected_hints.add(BuiltinConcepts.EVALUATING_PRE_OR_WHERE_CLAUSE)
# when it's a concept, evaluate it
if isinstance(to_resolve, Concept) and \
@@ -642,6 +640,9 @@ class SheerkaEvaluateConcept(BaseService):
if context.sheerka.isa(concept, context.sheerka.new(BuiltinConcepts.AUTO_EVAL)):
sub_context.protected_hints.add(BuiltinConcepts.EVAL_BODY_REQUESTED)
if context.in_context(BuiltinConcepts.EVALUATING_PRE_OR_WHERE_CLAUSE):
sub_context.protected_hints.add(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
sub_context.add_to_short_term_memory(CURRENT_OBJ, concept)
try:
@@ -764,6 +765,13 @@ class SheerkaEvaluateConcept(BaseService):
:param kwargs:
:return:
"""
if concept.get_hints().use_copy or not concept.get_hints().is_instance:
concept = concept.copy()
concept.get_hints().use_copy = False
concept.get_hints().is_instance = True
concept.get_hints().is_evaluated = False # force evaluation
# TODO : update the variables before calling the concept
evaluated = self.evaluate_concept(context, concept)
if self.sheerka.has_error(context, evaluated):