Convert the linear exploration into a more tree-like.
This commit is contained in:
parent
ae8d717344
commit
393527590c
5 changed files with 120 additions and 166 deletions
|
@ -3,7 +3,7 @@ import copy
|
|||
import logging
|
||||
import parsing
|
||||
import knowledge_evaluation
|
||||
from modifiable_property import ModifiableProperty
|
||||
from modifiable_property import is_modifiable_property
|
||||
|
||||
|
||||
def diff_knowledge(before, after):
|
||||
|
@ -50,7 +50,8 @@ class KnowledgeBase(object):
|
|||
def process(self, row):
|
||||
knowledge_before = copy.deepcopy(self.knowledge)
|
||||
logging.debug("\x1b[7;32m> {} \x1b[0m".format(row))
|
||||
tokens, inferred_tree = parsing.get_fit(self, row)
|
||||
tokens = parsing.to_tokens(row)
|
||||
tokens, inferred_tree = parsing.get_fit(self, tokens)
|
||||
result = knowledge_evaluation.integrate_information(self.knowledge,
|
||||
{
|
||||
"elements": tokens,
|
||||
|
@ -65,13 +66,13 @@ class KnowledgeBase(object):
|
|||
return result, inferred_tree, knowledge_diff_getter
|
||||
|
||||
def get_value(self, result):
|
||||
if isinstance(result, ModifiableProperty):
|
||||
if is_modifiable_property(result):
|
||||
return result.getter()
|
||||
else:
|
||||
return result
|
||||
|
||||
def act_upon(self, result):
|
||||
if isinstance(result, ModifiableProperty):
|
||||
if is_modifiable_property(result):
|
||||
result.setter()
|
||||
else:
|
||||
logging.debug(result)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue