diff --git a/actions/__pycache__/actions.cpython-38.pyc b/actions/__pycache__/actions.cpython-38.pyc index 55c4db4..968a967 100644 Binary files a/actions/__pycache__/actions.cpython-38.pyc and b/actions/__pycache__/actions.cpython-38.pyc differ diff --git a/actions/actions.py b/actions/actions.py index e7e4c57..c38f6be 100644 --- a/actions/actions.py +++ b/actions/actions.py @@ -34,7 +34,6 @@ from rasa_sdk.forms import FormValidationAction - class ValidateRestaurantForm(FormValidationAction): """Example of a form validation action.""" @@ -231,149 +230,6 @@ def selectUtterStatment(self,location): else: return "utter_default" - -class FindRestaurant(Action): - def name(self): - return "find_restaurant" - - @staticmethod - def restaurant_db(): - """Database of restaurants.""" - - return [ - { - "name":"7th Block Night Canteen", - "cuisine":["north indian"], - "Outside":True, - "Non-Veg":True - }, - { - "name":"NITK Block 3 Night Canteen", - "cuisine":['continental' , 'south indian' ], - "Outside":False, - "Non-Veg":False - }, - - { - "name":"NITK Food Court (OM Caterers)", - "cuisine":["north indian","south indian"], - "Outside":False, - "Non-Veg":False - }, - { - "name":"Samudra Darshan cáfe NITK", - "cuisine":["north indain" , "south indian"], - "Outside":True, - "Non-Veg":False - }, - { - "name":"Red Rock Residency", - "cuisine":["north indian"], - "Outside":True, - "Non-Veg":True - }, - { - "name":"Red Rock's Bourbon Bakery & Cafe", - "cuisine":["north indian" , "italian","continental"], - "Outside":True, - "Non-Veg":True - - }, - { - "name":"Jyothi Prakash, Punjabi Dhaba", - "cuisine":["Punjabi" , "north indian"], - "Outside":True, - "Non-Veg":True - }, - { - "name":"Kalash Veg Restaurant", - "cuisine":["north indian"], - "Outside":True, - "Non-Veg":True - } - - ] - - async def run(self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]): - cuisine = tracker.get_slot('cuisine') - number_of_seats = tracker.get_slot('number_for_restaurant') - outdoor_seating = tracker.get_slot('outdoor_seating') - preferences = tracker.get_slot('preferences') - feedback = tracker.get_slot('feedback') - - # TODO: use above variables to find restaurant using places api - restaurants = self.restaurant_db() - eligible_restaurants = [] - - - dispatcher.utter_message(template="utter_parameters_values") - if cuisine!=None: - for r in restaurants: - # print(r["cuisine"]) - if cuisine in r["cuisine"]: - eligible_restaurants.append(r) - restaurants = eligible_restaurants - eligible_restaurants = [] - if outdoor_seating!=None: - if outdoor_seating: - for r in restaurants: - if r["Outside"]: - eligible_restaurants.append(r) - restaurants = eligible_restaurants - if len(restaurants): - dispatcher.utter_message(template="utter_found_restaurants") - for r in restaurants: - dispatcher.utter_message(text = r['name']) - - - events = [] - events.append(SlotSet('cuisine',None)) - events.append(SlotSet('number_for_restaurant',None)) - events.append(SlotSet('outdoor_seating',None)) - events.append(SlotSet('preferences',None)) - events.append(SlotSet('feedback',None)) - return events - -class FormDetails(Action): - def name(self): - return "return_form_details" - - @staticmethod - def cuisine_db() : - """Database of supported cuisines.""" - - return "south indian, north indian, continental, italian, punjabi, mexican and assamese" - - - async def run(self, dispatcher, tracker: Tracker, domain: Dict[Text, Any]): - cuisine = tracker.get_slot('cuisine') - number_of_seats = tracker.get_slot('number_for_restaurant') - outdoor_seating = tracker.get_slot('outdoor_seating') - required_details = next(tracker.get_latest_entity_values('restaurant_form_details'), None) - if required_details!=None : - if required_details == 'cuisine': - cuisines = self.cuisine_db() - dispatcher.utter_message(text = "Avaialble Cuisines are") - dispatcher.utter_message(text = cuisines) - if required_details == 'people': - dispatcher.utter_message(text = "number of people can range from 1 to 10") - else: - if cuisine == None: - cuisines = self.cuisine_db() - dispatcher.utter_message(text = "Avaialble Cuisines are") - dispatcher.utter_message(text = cuisines) - return [] - if number_of_seats == None: - dispatcher.utter_message(text = "Number of people can range from 1 to 10") - return[] - if outdoor_seating == None: - dispatcher.utter_message(text = "Enter Yes if u want to sit outside or no if you want to sit inside") - return[] - return [] - - - - class LocationQuery(Action): def name(self): return "location_query" @@ -471,4 +327,3 @@ def selectUtterStatment(self,department): return self.department_utter_mapping()[department] else: return "utter_default" - diff --git a/data/nlu.yml b/data/nlu.yml index 337b0ef..5d15027 100644 --- a/data/nlu.yml +++ b/data/nlu.yml @@ -678,33 +678,6 @@ nlu: - When does [hcc](Location) close? - Till when is the [ccc](Location) open? - What are the timings of the [health care centre](Location)? - - -- intent: form_details - examples: | - - which [cuisine](restaurant_form_details) are available ? - - how many [people](restaurant_form_details) are allowed? - - why do you need this? - - what should i enter here? - - I am not understanding what to enter - - I am lost could u help me fill the form - -- intent: skip - examples: | - - I want to skip this part - - you are wasting time just get on with it - - I dont have time just book a restaurant - - book asap - - I dont care about these details just finish. - - don't waste time. - - i am okay with anything - - leave the details - - i dont have time for this - - dont waste my time - - just get on with it - - you are asking too many questions - - these are irrelavant questions - - intent: purpose examples: | - how can you help me? @@ -2197,5 +2170,4 @@ nlu: - synonym: chem department examples: | - chemical department - - chemical engineering department - + - chemical engineering department \ No newline at end of file diff --git a/data/stories.yml b/data/stories.yml index 97a3e06..a7f95f7 100644 --- a/data/stories.yml +++ b/data/stories.yml @@ -166,19 +166,7 @@ stories: - action: restaurant_form - active_loop: null - action: utter_submit - - action: find_restaurant - -- story: happy form + form_details - steps: - - intent: request_restaurant - - action: restaurant_form - - active_loop: restaurant_form - - intent: form_details - - action: return_form_details - - action: restaurant_form - - active_loop: null - - action: utter_submit - - action: find_restaurant + - action: utter_slots_values - story: happy form + steps: @@ -187,7 +175,7 @@ stories: - active_loop: restaurant_form - active_loop: null - action: utter_submit - - action: find_restaurant + - action: utter_slots_values - story: stop form + stop steps: @@ -200,19 +188,6 @@ stories: - action: action_deactivate_loop - active_loop: null - -- story: skip form - steps: - - intent: request_restaurant - - action: restaurant_form - - active_loop: restaurant_form - - intent: skip - - action: action_deactivate_loop - - active_loop: null - - action: utter_submit - - action: find_restaurant - - - story: happy Central_Computer_Centre steps: - intent: Central_Computer_Centre diff --git a/domain.yml b/domain.yml index 82967e0..9b46a81 100644 --- a/domain.yml +++ b/domain.yml @@ -3,116 +3,102 @@ session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true intents: - - # - request_restaurant: - # use_entities: [] - # - chitchat: - # use_entities: [] - - greet - - goodbye - - affirm - - deny - - mood_great - - mood_unhappy - - bot_challenge - - request_restaurant - - cuisine - - snacks - - Academic_Building - - Printing - - Delivery - - Health_Care_Centre - - sports_complex - - bank - - number_for_restaurant - - Central_Computer_Centre - - Central_Library - - Indirect_Time_Query - - Direct_Time_Query - - how_to_get_started - - nlu_fallback - - chitchat - - stop - - form_details - - skip - - purpose - - creator - - pleasantry - - weather - - age - - annoying - - be_clever - - beautiful - - birth_date - - boring - - busy - - can_you_help - - clever - - crazy - - fired - - funny - - right - - sure - - talk_to_me - - there - - no_problem - - thank_you - - welcome - - ha_ha - - wow - - goodevening - - goodmorning - - goodnight - - nice_to_meet_you - - angry - - user_back - - bored - - user_busy - - can_not_sleep - - does_not_want_to_talk - - excited - - going_to_bed - - has_birthday - - my_friend - - hobby - - here - - joking - - lonely - - needs_advice - - will_be_back - - tired - - waits - - wants_to_see_agent_again - - wants_to_talk - - praise - - criticize - - hold_on - - sleepy - - residence - - origin - - Location_Query - - Department_Query - +- greet +- goodbye +- affirm +- deny +- mood_great +- mood_unhappy +- bot_challenge +- request_restaurant +- cuisine +- snacks +- Main_Building +- Printing +- Delivery +- Health_Care_Centre +- sports_complex +- bank +- number_for_restaurant +- Central_Computer_Centre +- Central_Library +- Indirect_Time_Query +- Direct_Time_Query +- how_to_get_started +- nlu_fallback +- stop +- purpose +- creator +- pleasantry +- weather +- age +- annoying +- be_clever +- beautiful +- birth_date +- boring +- busy +- can_you_help +- clever +- crazy +- fired +- funny +- right +- sure +- talk_to_me +- there +- no_problem +- thank_you +- welcome +- ha_ha +- wow +- goodevening +- goodmorning +- goodnight +- nice_to_meet_you +- angry +- user_back +- bored +- user_busy +- can_not_sleep +- does_not_want_to_talk +- excited +- going_to_bed +- has_birthday +- my_friend +- hobby +- here +- joking +- lonely +- needs_advice +- will_be_back +- tired +- waits +- wants_to_see_agent_again +- wants_to_talk +- praise +- criticize +- hold_on +- sleepy +- residence +- origin +- Location_Query +- Department_Query entities: - # - food - - number_for_restaurant - - cuisine - - snacks - - Academic_Building - - Printing - - Delivery - - Health_Care_Centre - - sports_complex - - name - - Central_Computer_Centre - - Central_Library - - Location - - bank - - restaurant_form_details - - Location - - Department - - +- Academic_Building +- Central_Computer_Centre +- Central_Library +- Delivery +- Health_Care_Centre +- Location +- Printing +- bank +- cuisine +- name +- number_for_restaurant +- snacks +- sports_complex +- Department slots: cuisine: type: text @@ -270,15 +256,15 @@ responses: utter_ask_feedback: - text: Please give your feedback on your experience so far utter_submit: - - text: "All done!" - utter_parameters_values: - - text: "I am going to run a restaurant search using the parameters:" - utter_found_restaurants: - - text: "Found Following restaurants:\n" - utter_not_found: - - text: "Not Found Restaurants for the above requirement" - - + - text: All done! + utter_slots_values: + - text: |- + I am going to run a restaurant search using the following parameters: + - cuisine: {cuisine} + - num_people: {number_for_restaurant} + - outdoor_seating: {outdoor_seating} + - preferences: {preferences} + - feedback: {feedback} utter_noworries: - text: You are welcome :) utter_chitchat: @@ -718,8 +704,6 @@ responses: actions: - direct_time_query - indirect_time_query -- find_restaurant -- return_form_details - location_query - department_query - set_context_location @@ -843,33 +827,29 @@ actions: - utter_location_cv_department - utter_location_chem_department forms: - restaurant_form: - cuisine: - - type: from_entity - entity: cuisine - not_intent: chitchat - number_for_restaurant: - - type: from_entity - entity: number_for_restaurant - intent: number_for_restaurant - outdoor_seating: - # - type: from_entity - # entity: seating - - type: from_intent - intent: affirm - value: true - - type: from_intent - intent: deny - value: false - preferences: - - type: from_intent - intent: deny - value: no additional preferences - - type: from_text - not_intent: skip - feedback: - - type: from_entity - entity: feedback - - type: from_text - not_intent: skip - + restaurant_form: + cuisine: + - type: from_entity + entity: cuisine + not_intent: chitchat + number_for_restaurant: + - type: from_entity + entity: number_for_restaurant + intent: number_for_restaurant + outdoor_seating: + - type: from_intent + intent: affirm + value: true + - type: from_intent + intent: deny + value: false + preferences: + - type: from_intent + intent: deny + value: no additional preferences + - type: from_text + not_intent: affirm + feedback: + - type: from_entity + entity: feedback + - type: from_text diff --git a/models/20210202-201138.tar.gz b/models/20210202-201138.tar.gz deleted file mode 100644 index d9b78af..0000000 Binary files a/models/20210202-201138.tar.gz and /dev/null differ diff --git a/models/20210206-101625.tar.gz b/models/20210206-101625.tar.gz deleted file mode 100644 index 4262ac2..0000000 Binary files a/models/20210206-101625.tar.gz and /dev/null differ diff --git a/models/20210209-210721.tar.gz b/models/20210209-210721.tar.gz deleted file mode 100644 index 345a1c2..0000000 Binary files a/models/20210209-210721.tar.gz and /dev/null differ diff --git a/models/20210209-212136.tar.gz b/models/20210209-212136.tar.gz deleted file mode 100644 index 49448d2..0000000 Binary files a/models/20210209-212136.tar.gz and /dev/null differ diff --git a/models/20210301-201642.tar.gz b/models/20210301-201642.tar.gz deleted file mode 100644 index db1c4ba..0000000 Binary files a/models/20210301-201642.tar.gz and /dev/null differ