improved building intents to more acturately predict buildings and added confirmation before continuing navigation

This commit is contained in:
snbenge
2020-04-20 13:42:20 -04:00
parent 0595525203
commit cba991bfbe
9 changed files with 27 additions and 8 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
{"intents": [
{"tag": "Bob and Betty Beyster",
"patterns": ["BBB", "CSE", "CS","Computer Science", "Bob", "Bob and Betty Beyster", "Betty"],
"patterns": ["BBB", "CSE", "CS","Computer Science", "Computer", "Bob", "Bob and Betty Beyster", "Betty"],
"responses": ["Bob and Betty Beyster"],
"context": [""]
},
@@ -15,7 +15,7 @@
"context": [""]
},
{"tag": "Electrical and Computer Engineering",
"patterns": ["Electrical and Computer Engineering","Electrical", "Electrical Engineering", "Computer Engineering", "Computer", "EECS", "ECE"],
"patterns": ["Electrical and Computer Engineering","Electrical", "Electrical Engineering", "Computer Engineering", "EECS", "ECE"],
"responses": ["Electrical and Computer Engineering"],
"context": [""]
},

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -18,6 +18,7 @@ classes = pickle.load(open('classes.pkl','rb'))
buildingsIntents = json.loads(open('buildingIntents.json').read())
building_words = pickle.load(open('building_words.pkl','rb'))
buildings = pickle.load(open('buildings.pkl','rb'))
confirmation = 0
def clean_up_sentence(sentence):
# tokenize the pattern - splitting words into array
@@ -115,7 +116,15 @@ def send():
ChatBox.config(foreground="#446665", font=("Verdana", 12 ))
ints = predict_class(msg)
if ints[0]['intent'] == "navigation":
global confirmation
if (ints[0]['intent'] == "yes" or ints[0]['intent'] == "no") and confirmation == 1:
if ints[0]['intent'] == "yes":
res = "Starting navigation"
elif ints[0]['intent'] == "no":
res = "Cancelled operation"
confirmation = 0
#TODO: START CONVERSION TO GPS COORDINATES
elif ints[0]['intent'] == "navigation":
currbuilding = getBuildingInfo(msgClean)
if currbuilding[0] == 'random location':
currbuilding[0] = buildings[random.randint(0, len(buildings)-1)]
@@ -127,11 +136,11 @@ def send():
currbuilding[1] = buildings[random.randint(0, len(buildings)-1)]
fromBuild = predict_building(currbuilding[0])
toBuild = predict_building(currbuilding[1])
res = "Now navigating to " + toBuild[0]['buildingIntents'] + " from " + fromBuild[0]['buildingIntents']
#TODO: START CONVERSION TO GPS COORDINATES
res = "You chose navigating to " + toBuild[0]['buildingIntents'] + " from " + fromBuild[0]['buildingIntents'] + ". Is this correct?"
confirmation = 1
elif ints[0]['intent'] == "exit":
res = getResponse(ints, intents)
#TODO: STOP EVERYTHING
#TODO: OPTIONAL STOP EVERYTHING
else:
res = getResponse(ints, intents)
ChatBox.insert(END, "Belatrix: " + res + '\n\n')

View File

@@ -25,14 +25,24 @@
"context": [""]
},
{"tag": "navigation",
"patterns": ["Can you take me to the ", "Open adverse drugs module", "Give me a list of drugs causing adverse behavior", "List all drugs suitable for patient with adverse reaction", "Which drugs dont have adverse reaction?" ],
"responses": ["Navigating to Adverse drug reaction module"],
"patterns": ["Can you take me to the ", "Take me to the building", "Map me to the location", "Navigate me to the building from the building"],
"responses": ["Starting Navigation"],
"context": ["navigation_to_building"]
},
{"tag": "exit",
"patterns": ["stop", "quit", "end", "I want to stop navigation"],
"responses": ["Ending current navigation"],
"context": ["navigation_to_building"]
},
{"tag": "yes",
"patterns": ["yes", "y", "sure", "right", "correct"],
"responses": ["I am sorry. I don't understand"],
"context": ["navigation_to_building"]
},
{"tag": "no",
"patterns": ["no", "nope", "n", "wrong", "incorrect"],
"responses": ["I am sorry. I don't understand"],
"context": ["navigation_to_building"]
}
]
}

Binary file not shown.