Extract more contextual info from the words.
A property dictionary is now only to be considered equal to a word when it shares at least one group, or neither has groups.
This commit is contained in:
parent
d3b604efca
commit
0fbb9238eb
5 changed files with 36 additions and 6 deletions
|
@ -98,6 +98,12 @@ base_knowledge = {
|
|||
'fly': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
'bus': {
|
||||
"groups": {'noun'},
|
||||
},
|
||||
'run': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
'swim': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
from ..knowledge_base import KnowledgeBase
|
||||
from ..utils.visuals import show_progbar
|
||||
|
||||
|
@ -109,7 +110,7 @@ examples = [
|
|||
# },
|
||||
('text_example',
|
||||
{
|
||||
"question": "Is milk white?",
|
||||
"question": "is milk white?",
|
||||
"affirmation": "milk is white",
|
||||
"answer": True,
|
||||
}),
|
||||
|
@ -662,9 +663,15 @@ base_knowledge = {
|
|||
'planet': {
|
||||
"groups": {'noun', 'group'},
|
||||
},
|
||||
'white': {
|
||||
"groups": {'noun', 'color', 'concept', 'property'},
|
||||
},
|
||||
'green': {
|
||||
"groups": {'noun', 'color', 'concept'},
|
||||
},
|
||||
'milk': {
|
||||
"groups": {'noun'},
|
||||
},
|
||||
'fly': {
|
||||
"groups": {'verb'},
|
||||
},
|
||||
|
@ -713,11 +720,12 @@ def main():
|
|||
elif example_type == 'text_example':
|
||||
show_progbar(i, total, data['affirmation'])
|
||||
affirmation = data['affirmation']
|
||||
logging.debug("Processing affirmation: {}".format(affirmation))
|
||||
_, _, _ = knowledge.process(affirmation)
|
||||
|
||||
show_progbar(i, total, data['question'])
|
||||
question = data['question']
|
||||
|
||||
_, _, _ = knowledge.process(affirmation)
|
||||
logging.debug("Processing question : {}".format(question))
|
||||
result, _, _ = knowledge.process(question)
|
||||
|
||||
if result != data['answer']:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue