Add question asking operator.
This commit is contained in:
parent
675a494723
commit
3cc1f9bcde
2 changed files with 26 additions and 1 deletions
|
@ -4,7 +4,7 @@ from modifiable_property import ModifiableProperty
|
|||
def resolve(knowledge_base, elements, value):
|
||||
if isinstance(value, int):
|
||||
return elements[value]
|
||||
elif isinstance(value, tuple):
|
||||
elif isinstance(value, tuple) or isinstance(value, list):
|
||||
return integrate_information(knowledge_base, {
|
||||
"elements": elements,
|
||||
"parsed": value,
|
||||
|
@ -89,10 +89,19 @@ def has_capacity(knowledge_base, elements, subj, capacity):
|
|||
)
|
||||
|
||||
|
||||
def question(knowledge_base, elements, subj):
|
||||
subj = resolve(knowledge_base, elements, subj)
|
||||
|
||||
if isinstance(subj, ModifiableProperty):
|
||||
return subj.getter()
|
||||
return subj
|
||||
|
||||
|
||||
knowledge_ingestion = {
|
||||
"exists-property-with-value": exists_property_with_value,
|
||||
"pertenence-to-group": pertenence_to_group,
|
||||
"has-capacity": has_capacity,
|
||||
"question": question,
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue