Integrate the knowledge ASAP.

If we do this before the parsing we can leverage that semantics
in the matching phase.
This commit is contained in:
kenkeiras 2017-05-24 22:02:32 +02:00
parent 02f909269a
commit 2bfe676b2d
2 changed files with 17 additions and 5 deletions

View file

@ -123,12 +123,17 @@ def pertenence_to_group(knowledge_base, elements, subj, group):
if "groups" not in knowledge_base[subj]:
knowledge_base[subj]["groups"] = set()
return modifiable_element_for_existance_in_set(
container=knowledge_base[subj],
set_name="groups",
element=group
)
if group not in knowledge_base:
knowledge_base[group] = {}
if "groups" not in knowledge_base[group]:
knowledge_base[group]["groups"] = set()
return modifiable_element_for_existance_in_group(
container=knowledge_base[subj],
element=group,
backlink=knowledge_base[group],
)
def has_capacity(knowledge_base, elements, subj, capacity):
subj = resolve(knowledge_base, elements, subj)