Work in progress.
* Test * More debugging * Base concept
This commit is contained in:
parent
aa7bee4c8b
commit
9d49d00688
4 changed files with 62 additions and 10 deletions
|
@ -91,6 +91,9 @@ examples = [
|
|||
"parsed": ("question",
|
||||
('perform-verb-over-object', 'computers', 'use', 'electricity')),
|
||||
"answer": True,
|
||||
"after_execution": [(
|
||||
lambda knowledge: print("->", knowledge.knowledge['computers'])
|
||||
),],
|
||||
}),
|
||||
# {
|
||||
# "text": "The dominant language in france is french?",
|
||||
|
@ -665,11 +668,14 @@ base_knowledge = {
|
|||
'fly': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
'computers': {
|
||||
"groups": {'object'},
|
||||
},
|
||||
'use': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
'electricity': {
|
||||
"groups": {},
|
||||
"groups": {'power'},
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -693,16 +699,17 @@ def main():
|
|||
|
||||
show_progbar(i, total, data['text'])
|
||||
differences = knowledge.train([question])
|
||||
print(differences())
|
||||
|
||||
result, _, _ = knowledge.process(data['text'])
|
||||
|
||||
if result != data['answer']:
|
||||
raise AssertionError('{} is not {}'.format(result, data['answer']))
|
||||
|
||||
if "after_execution" in data:
|
||||
for f in data["after_execution"]:
|
||||
f(knowledge)
|
||||
|
||||
if result != data['answer']:
|
||||
raise AssertionError('{} is not {}'.format(result, data['answer']))
|
||||
|
||||
elif example_type == 'text_example':
|
||||
show_progbar(i, total, data['affirmation'])
|
||||
affirmation = data['affirmation']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue