Comment tests outside current development scope.

This commit is contained in:
kenkeiras 2017-05-13 20:28:27 +02:00
parent 0e19240720
commit c6eaf056aa

View File

@ -11,34 +11,34 @@ examples = [
"text": "is icecream cold?", "text": "is icecream cold?",
"parsed": ("question", ("exists-property-with-value", 'icecream', 'cold')) "parsed": ("question", ("exists-property-with-value", 'icecream', 'cold'))
}, },
{ # {
"text": "lava is dangerous", # "text": "lava is dangerous",
"parsed": ("exists-property-with-value", 'lava', 'dangerous') # "parsed": ("exists-property-with-value", 'lava', 'dangerous')
}, # },
{ # {
"text": "is lava dangerous?", # "text": "is lava dangerous?",
"parsed": ("question", ("exists-property-with-value", 'lava', 'dangerous')), # "parsed": ("question", ("exists-property-with-value", 'lava', 'dangerous')),
}, # },
{ # {
"text": "earth is a planet", # "text": "earth is a planet",
"parsed": ("pertenence-to-group", 'earth', 'planet'), # "parsed": ("pertenence-to-group", 'earth', 'planet'),
}, # },
{ # {
"text": "is earth a moon?", # "text": "is earth a moon?",
"parsed": ("question", ("pertenence-to-group", 'earth', 'moon')), # "parsed": ("question", ("pertenence-to-group", 'earth', 'moon')),
}, # },
{ # {
"text": "Green is a color", # "text": "Green is a color",
"parsed": ("pertenence-to-group", 'green', 'color'), # "parsed": ("pertenence-to-group", 'green', 'color'),
}, # },
{ # {
"text": "a plane can fly", # "text": "a plane can fly",
"parsed": ("has-capacity", 'plane', 'fly') # "parsed": ("has-capacity", 'plane', 'fly')
}, # },
{ # {
"text": "a wale can swim", # "text": "a wale can swim",
"parsed": ("has-capacity", 'wale', 'swim') # "parsed": ("has-capacity", 'wale', 'swim')
}, # },
] ]
base_knowledge = { base_knowledge = {
@ -100,25 +100,25 @@ def main():
) )
differences = knowledge.train(examples) differences = knowledge.train(examples)
print("----") # print("----")
print(differences()) # print(differences())
print("----") # print("----")
for test in [{'text': 'a bus can run'}, {'text': 'io is a moon'}]: # for test in [{'text': 'a bus can run'}, {'text': 'io is a moon'}]:
row = test['text'] # row = test['text']
result, inferred_tree, differences = knowledge.process(row) # result, inferred_tree, differences = knowledge.process(row)
print("result:", result) # print("result:", result)
print(differences()) # print(differences())
print() # print()
print('-----') # print('-----')
print(json.dumps(sorted(knowledge.knowledge.keys()), indent=4)) # print(json.dumps(sorted(knowledge.knowledge.keys()), indent=4))
print('-----') # print('-----')
queryTrue = { "text": "is io a moon?", "parsed": ("question", ("pertenence-to-group", "io", "moon")) } # queryTrue = { "text": "is io a moon?", "parsed": ("question", ("pertenence-to-group", "io", "moon")) }
queryFalse = { "text": "is io a planet?", "parsed": ("question", ("pertenence-to-group", "io", "planet")) } # queryFalse = { "text": "is io a planet?", "parsed": ("question", ("pertenence-to-group", "io", "planet")) }
test_assumption(True, knowledge, queryTrue) # test_assumption(True, knowledge, queryTrue)
test_assumption(False, knowledge, queryFalse) # test_assumption(False, knowledge, queryFalse)
if __name__ == '__main__': if __name__ == '__main__':
main() main()