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