Skip to content
Snippets Groups Projects
Commit ec7f3ef2 authored by zqwerty's avatar zqwerty Committed by zhuqi
Browse files

add 'the same area/pricerange/people/day' in agenda with 0.3 probability

parent 0f509d6e
Branches
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
"I would like to visit on in town #ATTRACTION-INFORM-AREA# please .", "I would like to visit on in town #ATTRACTION-INFORM-AREA# please .",
"Are there anything fun to do in city #ATTRACTION-INFORM-AREA# ?", "Are there anything fun to do in city #ATTRACTION-INFORM-AREA# ?",
"I ' m looking for some attractions in the #ATTRACTION-INFORM-AREA# .", "I ' m looking for some attractions in the #ATTRACTION-INFORM-AREA# .",
"I am also looking for suggestions on places to go in the #ATTRACTION-INFORM-AREA# of town . Can you help me with that ?", "I am also looking for suggestions on places to go in the #ATTRACTION-INFORM-AREA# . Can you help me with that ?",
"I am also looking for places to go in town . Maybe something in the #ATTRACTION-INFORM-AREA# .", "I am also looking for places to go in town . Maybe something in the #ATTRACTION-INFORM-AREA# .",
"I also need a place to go in the #ATTRACTION-INFORM-AREA# .", "I also need a place to go in the #ATTRACTION-INFORM-AREA# .",
"Can you recommend some fun entertainment in the #ATTRACTION-INFORM-AREA# ?" "Can you recommend some fun entertainment in the #ATTRACTION-INFORM-AREA# ?"
...@@ -221,22 +221,18 @@ ...@@ -221,22 +221,18 @@
], ],
"Area": [ "Area": [
"I need a place to stay in the #HOTEL-INFORM-AREA# please .", "I need a place to stay in the #HOTEL-INFORM-AREA# please .",
"I would prefer the hotel be in the #HOTEL-INFORM-AREA# part of town .", "I would prefer the hotel be in the #HOTEL-INFORM-AREA# .",
"I ' m also looking for a place to stay . In the #HOTEL-INFORM-AREA# preferably .", "I ' m also looking for a place to stay . In the #HOTEL-INFORM-AREA# preferably .",
"Would you be able to help me find a place to stay in the #HOTEL-INFORM-AREA# side of town ?", "Would you be able to help me find a place to stay in the #HOTEL-INFORM-AREA# ?",
"I ' m looking for a place to stay in the #HOTEL-INFORM-AREA# part of town .", "I ' m looking for a place to stay in the #HOTEL-INFORM-AREA# .",
"I ' m looking for a hotel in the #HOTEL-INFORM-AREA# .", "I ' m looking for a hotel in the #HOTEL-INFORM-AREA# .",
"I need it in the #HOTEL-INFORM-AREA# , please ." "I need it in the #HOTEL-INFORM-AREA# , please ."
], ],
"People": [ "People": [
"I need reservations for #HOTEL-INFORM-PEOPLE# .",
"Yes , could you book the hotel room for me for #HOTEL-INFORM-PEOPLE# people ?", "Yes , could you book the hotel room for me for #HOTEL-INFORM-PEOPLE# people ?",
"There are #HOTEL-INFORM-PEOPLE# of us .",
"That will work . Can you make a reservation for #HOTEL-INFORM-PEOPLE# people , please ?", "That will work . Can you make a reservation for #HOTEL-INFORM-PEOPLE# people , please ?",
"There is going to be #HOTEL-INFORM-PEOPLE# of us",
"Actually , I 'd like to book it for #HOTEL-INFORM-PEOPLE# people . Can you help with that ?", "Actually , I 'd like to book it for #HOTEL-INFORM-PEOPLE# people . Can you help with that ?",
"There will be #HOTEL-INFORM-PEOPLE# people .", "There will be #HOTEL-INFORM-PEOPLE# people .",
"There will be #HOTEL-INFORM-PEOPLE# of us .",
"Yes , could you book the hotel room for me for #HOTEL-INFORM-PEOPLE# people ?", "Yes , could you book the hotel room for me for #HOTEL-INFORM-PEOPLE# people ?",
"I would like to book it for #HOTEL-INFORM-PEOPLE# people . Thanks ." "I would like to book it for #HOTEL-INFORM-PEOPLE# people . Thanks ."
], ],
...@@ -441,14 +437,14 @@ ...@@ -441,14 +437,14 @@
"I ' m looking for a restaurant named #RESTAURANT-INFORM-NAME# ." "I ' m looking for a restaurant named #RESTAURANT-INFORM-NAME# ."
], ],
"Area": [ "Area": [
"I ' m so hungry - can you find me a place to eat in the city #RESTAURANT-INFORM-AREA# ?", "I ' m so hungry - can you find me a place to eat in the #RESTAURANT-INFORM-AREA# ?",
"Can you help me find a restaurant ? I want to find a place in the #RESTAURANT-INFORM-AREA# .", "Can you help me find a restaurant ? I want to find a place in the #RESTAURANT-INFORM-AREA# .",
"I would prefer it in the #RESTAURANT-INFORM-AREA# area .", "I would prefer it in the #RESTAURANT-INFORM-AREA# .",
"I am also in the market for a new restaurant . Is there something in the #RESTAURANT-INFORM-AREA# of town ?", "I am also in the market for a new restaurant . Is there something in the #RESTAURANT-INFORM-AREA# ?",
"Is that located in the #RESTAURANT-INFORM-AREA# ?", "Is that located in the #RESTAURANT-INFORM-AREA# ?",
"I 'd like to be in the #RESTAURANT-INFORM-AREA# please .", "I 'd like to be in the #RESTAURANT-INFORM-AREA# please .",
"What restaurants are located in the #RESTAURANT-INFORM-AREA# ?", "What restaurants are located in the #RESTAURANT-INFORM-AREA# ?",
"I also would like information on a place to eat in the #RESTAURANT-INFORM-AREA# of town ." "I also would like information on a place to eat in the #RESTAURANT-INFORM-AREA# ."
], ],
"Price": [ "Price": [
"it just needs to be #RESTAURANT-INFORM-PRICE# .", "it just needs to be #RESTAURANT-INFORM-PRICE# .",
...@@ -456,7 +452,7 @@ ...@@ -456,7 +452,7 @@
"I want to find a #RESTAURANT-INFORM-PRICE# priced restaurant .", "I want to find a #RESTAURANT-INFORM-PRICE# priced restaurant .",
"I ' m looking for an #RESTAURANT-INFORM-PRICE# restaurant .", "I ' m looking for an #RESTAURANT-INFORM-PRICE# restaurant .",
"I am looking for a #RESTAURANT-INFORM-PRICE# restaurant .", "I am looking for a #RESTAURANT-INFORM-PRICE# restaurant .",
"Actually I need a #RESTAURANT-INFORM-PRICE#ly priced restaurant . Are there any fitting that description ?", "Actually I need a #RESTAURANT-INFORM-PRICE# priced restaurant . Are there any fitting that description ?",
"Oh , I really need something #RESTAURANT-INFORM-PRICE# .", "Oh , I really need something #RESTAURANT-INFORM-PRICE# .",
"I also need a place to dine that is #RESTAURANT-INFORM-PRICE# priced ." "I also need a place to dine that is #RESTAURANT-INFORM-PRICE# priced ."
], ],
...@@ -494,16 +490,14 @@ ...@@ -494,16 +490,14 @@
"I need a reservation for #RESTAURANT-INFORM-PEOPLE# people .", "I need a reservation for #RESTAURANT-INFORM-PEOPLE# people .",
"I need a table for #RESTAURANT-INFORM-PEOPLE# people .", "I need a table for #RESTAURANT-INFORM-PEOPLE# people .",
"We will have #RESTAURANT-INFORM-PEOPLE# people in the party .", "We will have #RESTAURANT-INFORM-PEOPLE# people in the party .",
"Book a table for #RESTAURANT-INFORM-PEOPLE# person please .", "Book a table for #RESTAURANT-INFORM-PEOPLE# people please .",
"Can you book me a table for #RESTAURANT-INFORM-PEOPLE# ?", "Can you book me a table for #RESTAURANT-INFORM-PEOPLE# people?",
"It will be for #RESTAURANT-INFORM-PEOPLE# people .", "It will be for #RESTAURANT-INFORM-PEOPLE# people ."
"There will be #RESTAURANT-INFORM-PEOPLE# of us ."
], ],
"Day": [ "Day": [
"i am also looking for a restaurant to book for #RESTAURANT-INFORM-DAY#", "i am also looking for a restaurant to book for #RESTAURANT-INFORM-DAY#",
"I 'll be needing a table for #RESTAURANT-INFORM-DAY# .", "I 'll be needing a table for #RESTAURANT-INFORM-DAY# .",
"book a table on #RESTAURANT-INFORM-DAY# .", "book a table on #RESTAURANT-INFORM-DAY# .",
"We will be there #RESTAURANT-INFORM-DAY# night .",
"Please make a reservation for #RESTAURANT-INFORM-DAY# .", "Please make a reservation for #RESTAURANT-INFORM-DAY# .",
"I do need a booking for #RESTAURANT-INFORM-DAY# .", "I do need a booking for #RESTAURANT-INFORM-DAY# .",
"Please reserve a table on #RESTAURANT-INFORM-DAY# .", "Please reserve a table on #RESTAURANT-INFORM-DAY# .",
......
...@@ -200,6 +200,13 @@ class TemplateNLG(NLG): ...@@ -200,6 +200,13 @@ class TemplateNLG(NLG):
"Anyone would be ok. ", "Anyone would be ok. ",
"Just select one for me. " "Just select one for me. "
]) ])
elif slot == 'Price' and 'same price range' in value:
sentence = random.choice([
"it just needs to be {} .".format(value),
"Oh , I really need something {} .".format(value),
"I would prefer something that is {} .".format(value),
"it needs to be {} .".format(value)
])
elif dialog_act in template and slot in template[dialog_act]: elif dialog_act in template and slot in template[dialog_act]:
sentence = random.choice(template[dialog_act][slot]) sentence = random.choice(template[dialog_act][slot])
sentence = sentence.replace('#{}-{}#'.format(dialog_act.upper(), slot.upper()), str(value)) sentence = sentence.replace('#{}-{}#'.format(dialog_act.upper(), slot.upper()), str(value))
......
...@@ -830,6 +830,17 @@ class Agenda(object): ...@@ -830,6 +830,17 @@ class Agenda(object):
return None return None
def __push(self, diaact, slot=DEF_VAL_NUL, value=DEF_VAL_NUL): def __push(self, diaact, slot=DEF_VAL_NUL, value=DEF_VAL_NUL):
if slot in ['people', 'day', 'area', 'pricerange']:
for item in self.__stack:
if item['slot'] == slot and item['value'] == value and random.random() < 0.3:
if slot == 'people':
item['value'] = 'the same'
elif slot == 'day':
item['value'] = 'the same day'
elif slot == 'pricerange':
item['value'] = 'in the same price range as the {}'.format(diaact.split('-')[0])
elif slot == 'area':
item['value'] = 'same area as the {}'.format(diaact.split('-')[0])
self.__stack.append({'diaact': diaact, 'slot': slot, 'value': value}) self.__stack.append({'diaact': diaact, 'slot': slot, 'value': value})
def __pop(self, initiative=1): def __pop(self, initiative=1):
...@@ -911,25 +922,21 @@ if __name__ == '__main__': ...@@ -911,25 +922,21 @@ if __name__ == '__main__':
goal_generator = GoalGenerator() goal_generator = GoalGenerator()
while True: while True:
goal = goal_generator.get_user_goal() goal = goal_generator.get_user_goal()
if 'taxi' in goal['domain_ordering']: if 'restaurant' in goal['domain_ordering'] and 'hotel' in goal['domain_ordering']:
break break
# pprint(goal) # pprint(goal)
user_goal = {'domain_ordering': ('restaurant', 'hotel', 'taxi'), user_goal = {'domain_ordering': ('hotel', 'restaurant', 'taxi'),
'attraction': {'info': {'area': 'west', 'type': 'museum'}, 'reqt': ['phone']}, 'hotel': {'book': {'day': 'sunday', 'people': '6', 'stay': '4'},
'hotel': {'book': {'day': 'saturday', 'people': '5', 'stay': '4'}, 'info': {'internet': 'yes',
'fail_info': {'area': 'north', 'parking': 'no',
'internet': 'yes',
'pricerange': 'expensive',
'stars': '3'},
'info': {'area': 'north',
'internet': 'yes',
'pricerange': 'moderate', 'pricerange': 'moderate',
'stars': '3'}}, 'area': 'centre'}},
'restaurant': {'book': {'day': 'saturday', 'people': '5', 'time': '18:00'}, 'restaurant': {'info': {'area': 'centre',
'info': {'area': 'centre', 'food': 'british'}, 'food': 'chinese',
'pricerange': 'moderate'},
'reqt': ['address']}, 'reqt': ['address']},
'taxi': {"info": {"leaveAt": "02:45"},"reqt": ["car type","phone"]}} 'taxi': {'info': {'arriveBy': '13:00'}, 'reqt': ['car type', 'phone']}}
user_goal = goal # user_goal = goal
goal = Goal(goal_generator) goal = Goal(goal_generator)
goal.set_user_goal(user_goal) goal.set_user_goal(user_goal)
...@@ -951,7 +958,7 @@ if __name__ == '__main__': ...@@ -951,7 +958,7 @@ if __name__ == '__main__':
# pprint(state) # pprint(state)
sys_act = sys_policy.predict(state) sys_act = sys_policy.predict(state)
# sys_act.append(["Request", "Restaurant", "Price", "?"]) # sys_act.append(["Request", "Restaurant", "Price", "?"])
sys_act = [['Request', 'Hotel', 'Area', '?'], ['Request', 'Hotel', 'Stars', '?']] # sys_act = [['Request', 'Hotel', 'Area', '?'], ['Request', 'Hotel', 'Stars', '?']]
print(sys_act) print(sys_act)
...@@ -964,90 +971,90 @@ if __name__ == '__main__': ...@@ -964,90 +971,90 @@ if __name__ == '__main__':
dst.update(user_act) dst.update(user_act)
# pprint(state) # pprint(state)
sys_act = sys_policy.predict(state) sys_act = sys_policy.predict(state)
sys_act = [['Inform', 'Hotel', 'Choice', '3']] # sys_act = [['Inform', 'Hotel', 'Choice', '3']]
print(sys_act) print(sys_act)
# user_act = user_policy.predict(sys_act) user_act = user_policy.predict(sys_act)
# print(user_act) print(user_act)
# user_utt = user_nlg.generate(user_act) user_utt = user_nlg.generate(user_act)
# print(user_utt) print(user_utt)
# state = dst.state state = dst.state
# state['user_action'] = user_act state['user_action'] = user_act
# dst.update(user_act) dst.update(user_act)
# pprint(state)
# sys_act = sys_policy.predict(state)
# # sys_act = [["Book", "Booking", "Ref", "7GAWK763"]]
# print(sys_act)
# #
# user_act = user_policy.predict(sys_act)
# print(user_act)
# user_utt = user_nlg.generate(user_act)
# print(user_utt)
# state = dst.state
# state['user_action'] = user_act
# dst.update(user_act)
# pprint(state)
# sys_act = sys_policy.predict(state)
# # sys_act = [["Reqmore", "General", "none", "none"]]
# print(sys_act)
# #
# user_act = user_policy.predict(sys_act)
# print(user_act)
# user_utt = user_nlg.generate(user_act)
# print(user_utt)
# state = dst.state
# state['user_action'] = user_act
# dst.update(user_act)
# pprint(state) # pprint(state)
# sys_act = sys_policy.predict(state) sys_act = sys_policy.predict(state)
# # sys_act = [["Inform", "Hotel", "Parking", "none"]] # sys_act = [["Book", "Booking", "Ref", "7GAWK763"]]
# print(sys_act) print(sys_act)
# #
# # user_act = user_policy.predict(sys_act)
# # print(user_act)
# # user_utt = user_nlg.generate(user_act)
# # print(user_utt)
# # state = dst.state
# # state['user_action'] = user_act
# # dst.update(user_act)
# # pprint(state)
# # sys_act = sys_policy.predict(state)
# # # sys_act = [["Request", "Booking", "people", "?"]]
# # print(sys_act)
# #
# # user_act = user_policy.predict(sys_act)
# # print(user_act)
# # user_utt = user_nlg.generate(user_act)
# # print(user_utt)
# # state = dst.state
# # state['user_action'] = user_act
# # dst.update(user_act)
# # pprint(state)
# # sys_act = sys_policy.predict(state)
# # # sys_act = [["Inform", "Hotel", "Post", "233"], ["Book", "Booking", "none", "none"]]
# # print(sys_act)
# #
# user_act = user_policy.predict(sys_act) user_act = user_policy.predict(sys_act)
# print(user_act) print(user_act)
# user_utt = user_nlg.generate(user_act) user_utt = user_nlg.generate(user_act)
# print(user_utt) print(user_utt)
# state = dst.state state = dst.state
# state['user_action'] = user_act state['user_action'] = user_act
# dst.update(user_act) dst.update(user_act)
# pprint(state) # pprint(state)
# sys_act = sys_policy.predict(state) sys_act = sys_policy.predict(state)
# sys_act = [["Request", "Taxi", "Dest", "?"], ["Request", "Taxi", "Depart", "?"]] # sys_act = [["Reqmore", "General", "none", "none"]]
# print(sys_act) print(sys_act)
# #
# user_act = user_policy.predict(sys_act) user_act = user_policy.predict(sys_act)
# print(user_act) print(user_act)
# user_utt = user_nlg.generate(user_act) user_utt = user_nlg.generate(user_act)
# print(user_utt) print(user_utt)
# state = dst.state state = dst.state
# state['user_action'] = user_act state['user_action'] = user_act
# dst.update(user_act) dst.update(user_act)
# pprint(state) # pprint(state)
# sys_act = sys_policy.predict(state) sys_act = sys_policy.predict(state)
# # sys_act = [["Request", "Taxi", "Destination", "?"], ["Request", "Taxi", "Departure", "?"]] # sys_act = [["Inform", "Hotel", "Parking", "none"]]
# print(sys_act) print(sys_act)
user_act = user_policy.predict(sys_act)
print(user_act)
user_utt = user_nlg.generate(user_act)
print(user_utt)
state = dst.state
state['user_action'] = user_act
dst.update(user_act)
# pprint(state)
sys_act = sys_policy.predict(state)
# sys_act = [["Request", "Booking", "people", "?"]]
print(sys_act)
user_act = user_policy.predict(sys_act)
print(user_act)
user_utt = user_nlg.generate(user_act)
print(user_utt)
state = dst.state
state['user_action'] = user_act
dst.update(user_act)
# pprint(state)
sys_act = sys_policy.predict(state)
# sys_act = [["Inform", "Hotel", "Post", "233"], ["Book", "Booking", "none", "none"]]
print(sys_act)
user_act = user_policy.predict(sys_act)
print(user_act)
user_utt = user_nlg.generate(user_act)
print(user_utt)
state = dst.state
state['user_action'] = user_act
dst.update(user_act)
# pprint(state)
sys_act = sys_policy.predict(state)
sys_act = [["Request", "Taxi", "Dest", "?"], ["Request", "Taxi", "Depart", "?"]]
print(sys_act)
user_act = user_policy.predict(sys_act)
print(user_act)
user_utt = user_nlg.generate(user_act)
print(user_utt)
state = dst.state
state['user_action'] = user_act
dst.update(user_act)
# pprint(state)
sys_act = sys_policy.predict(state)
# sys_act = [["Request", "Taxi", "Destination", "?"], ["Request", "Taxi", "Departure", "?"]]
print(sys_act)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment