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