Use {set} notation for sets.
This commit is contained in:
parent
e6e8146478
commit
3cfc03373f
@ -43,7 +43,7 @@ def get_subquery_type(knowledge_base, atom):
|
|||||||
def property_for_value(knowledge_base, value):
|
def property_for_value(knowledge_base, value):
|
||||||
if value in knowledge_base:
|
if value in knowledge_base:
|
||||||
# Annotate the property as property
|
# Annotate the property as property
|
||||||
groups = knowledge_base[value].get('groups', set(['property']))
|
groups = knowledge_base[value].get('groups', {'property'})
|
||||||
groups.add('property')
|
groups.add('property')
|
||||||
knowledge_base[value]['groups'] = groups
|
knowledge_base[value]['groups'] = groups
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ def property_for_value(knowledge_base, value):
|
|||||||
if 'as_property' in knowledge_base[value]:
|
if 'as_property' in knowledge_base[value]:
|
||||||
return knowledge_base[value]['as_property']
|
return knowledge_base[value]['as_property']
|
||||||
|
|
||||||
return knowledge_base[value].get('groups', set(['property']))
|
return knowledge_base[value].get('groups', {'property'})
|
||||||
else:
|
else:
|
||||||
# Consider that any property is... a property
|
# Consider that any property is... a property
|
||||||
knowledge_base[value] = {'groups': {'property'}}
|
knowledge_base[value] = {'groups': {'property'}}
|
||||||
|
@ -55,51 +55,51 @@ examples = [
|
|||||||
|
|
||||||
base_knowledge = {
|
base_knowledge = {
|
||||||
'icecream': {
|
'icecream': {
|
||||||
"groups": set(['noun', 'object', 'comestible', 'sweet']),
|
"groups": {'noun', 'object', 'comestible', 'sweet'},
|
||||||
},
|
},
|
||||||
'lava': {
|
'lava': {
|
||||||
"groups": set(['noun', 'object']),
|
"groups": {'noun', 'object'},
|
||||||
},
|
},
|
||||||
'earth': {
|
'earth': {
|
||||||
"groups": set(['noun', 'object', 'planet']),
|
"groups": {'noun', 'object', 'planet'},
|
||||||
},
|
},
|
||||||
'io': {
|
'io': {
|
||||||
"groups": set(['noun', 'object']),
|
"groups": {'noun', 'object'},
|
||||||
},
|
},
|
||||||
'green': {
|
'green': {
|
||||||
"groups": set(['noun', 'color', 'concept']),
|
"groups": {'noun', 'color', 'concept'},
|
||||||
},
|
},
|
||||||
'plane': {
|
'plane': {
|
||||||
"groups": set(['noun', 'object', 'vehicle', 'fast']),
|
"groups": {'noun', 'object', 'vehicle', 'fast'},
|
||||||
},
|
},
|
||||||
'car': {
|
'car': {
|
||||||
"groups": set(['noun', 'object', 'vehicle', 'slow-ish']),
|
"groups": {'noun', 'object', 'vehicle', 'slow-ish'},
|
||||||
},
|
},
|
||||||
'wale': {
|
'wale': {
|
||||||
"groups": set(['noun', 'object', 'living-being']),
|
"groups": {'noun', 'object', 'living-being'},
|
||||||
},
|
},
|
||||||
'cold': {
|
'cold': {
|
||||||
"groups": set(['property', 'temperature']),
|
"groups": {'property', 'temperature'},
|
||||||
"as_property": "temperature",
|
"as_property": "temperature",
|
||||||
},
|
},
|
||||||
'dangerous': {
|
'dangerous': {
|
||||||
"groups": set(['property']),
|
"groups": {'property'},
|
||||||
"as_property": "safety",
|
"as_property": "safety",
|
||||||
},
|
},
|
||||||
'planet': {
|
'planet': {
|
||||||
"groups": set(['noun', 'group']),
|
"groups": {'noun', 'group'},
|
||||||
},
|
},
|
||||||
'moon': {
|
'moon': {
|
||||||
"groups": set(['noun', 'group']),
|
"groups": {'noun', 'group'},
|
||||||
},
|
},
|
||||||
'color': {
|
'color': {
|
||||||
"groups": set(['property', 'group']),
|
"groups": {'property', 'group'},
|
||||||
},
|
},
|
||||||
'fly': {
|
'fly': {
|
||||||
"groups": set(['verb']),
|
"groups": {'verb'},
|
||||||
},
|
},
|
||||||
'swim': {
|
'swim': {
|
||||||
"groups": set(['verb']),
|
"groups": {'verb'},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,25 +613,25 @@ examples = [
|
|||||||
|
|
||||||
base_knowledge = {
|
base_knowledge = {
|
||||||
'icecream': {
|
'icecream': {
|
||||||
"groups": set(['noun', 'object', 'comestible', 'sweet']),
|
"groups": {'noun', 'object', 'comestible', 'sweet'},
|
||||||
},
|
},
|
||||||
'cold': {
|
'cold': {
|
||||||
"groups": set(['property', 'temperature']),
|
"groups": {'property', 'temperature'},
|
||||||
},
|
},
|
||||||
'earth': {
|
'earth': {
|
||||||
"groups": set(['noun', 'object', 'planet']),
|
"groups": {'noun', 'object', 'planet'},
|
||||||
},
|
},
|
||||||
'planet': {
|
'planet': {
|
||||||
"groups": set(['noun', 'group']),
|
"groups": {'noun', 'group'},
|
||||||
},
|
},
|
||||||
'color': {
|
'color': {
|
||||||
"groups": set(['property', 'group']),
|
"groups": {'property', 'group'},
|
||||||
},
|
},
|
||||||
'green': {
|
'green': {
|
||||||
"groups": set(['noun', 'color', 'concept']),
|
"groups": {'noun', 'color', 'concept'},
|
||||||
},
|
},
|
||||||
'fly': {
|
'fly': {
|
||||||
"groups": set(['verb']),
|
"groups": {'verb'},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user