diff --git a/src/semantic/__pycache__/pickleManage.cpython-35.pyc b/src/semantic/__pycache__/pickleManage.cpython-35.pyc new file mode 100644 index 0000000..b62e1c2 Binary files /dev/null and b/src/semantic/__pycache__/pickleManage.cpython-35.pyc differ diff --git a/src/semantic/__pycache__/pickleManage.cpython-38.pyc b/src/semantic/__pycache__/pickleManage.cpython-38.pyc new file mode 100644 index 0000000..ad2fba5 Binary files /dev/null and b/src/semantic/__pycache__/pickleManage.cpython-38.pyc differ diff --git a/src/semantic/buildingIntents.json b/src/semantic/buildingIntents.json index 25284fc..6e8377b 100644 --- a/src/semantic/buildingIntents.json +++ b/src/semantic/buildingIntents.json @@ -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": [""] }, diff --git a/src/semantic/buildings_model.h5 b/src/semantic/buildings_model.h5 index 3cfbdd2..16fd97e 100644 Binary files a/src/semantic/buildings_model.h5 and b/src/semantic/buildings_model.h5 differ diff --git a/src/semantic/chatbot_model.h5 b/src/semantic/chatbot_model.h5 index 035945f..6c0ae6f 100644 Binary files a/src/semantic/chatbot_model.h5 and b/src/semantic/chatbot_model.h5 differ diff --git a/src/semantic/classes.pkl b/src/semantic/classes.pkl index e670d60..f2d1ca3 100644 Binary files a/src/semantic/classes.pkl and b/src/semantic/classes.pkl differ diff --git a/src/semantic/gui_chatbot.py b/src/semantic/gui_chatbot.py index c4d5889..00eab88 100644 --- a/src/semantic/gui_chatbot.py +++ b/src/semantic/gui_chatbot.py @@ -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') diff --git a/src/semantic/intents.json b/src/semantic/intents.json index f8de93e..3f7d586 100644 --- a/src/semantic/intents.json +++ b/src/semantic/intents.json @@ -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"] } ] } diff --git a/src/semantic/words.pkl b/src/semantic/words.pkl index 0397e80..d712d26 100644 Binary files a/src/semantic/words.pkl and b/src/semantic/words.pkl differ