Fix Dziękuję
This commit is contained in:
parent
1dcb6c7343
commit
3464a04349
@ -58,28 +58,29 @@ class DialoguePolicy(Policy):
|
|||||||
|
|
||||||
def update_system_action(self, user_act, user_action, state, system_action):
|
def update_system_action(self, user_act, user_action, state, system_action):
|
||||||
domain, intent = user_act
|
domain, intent = user_act
|
||||||
constraints = [(slot, value) for slot, value in state['belief_state'][domain]['info'].items() if value != '']
|
if domain in state['belief_state']:
|
||||||
# print(f"Constraints: {constraints}")
|
constraints = [(slot, value) for slot, value in state['belief_state'][domain]['info'].items() if value != '']
|
||||||
self.results = deepcopy(self.query(domain.lower(), constraints))
|
# print(f"Constraints: {constraints}")
|
||||||
# print(f"Query results: {self.results}")
|
self.results = deepcopy(self.query(domain.lower(), constraints))
|
||||||
|
# print(f"Query results: {self.results}")
|
||||||
|
|
||||||
if intent == 'request':
|
if intent == 'request':
|
||||||
if len(self.results) == 0:
|
if len(self.results) == 0:
|
||||||
system_action[(domain, 'NoOffer')] = []
|
system_action[(domain, 'NoOffer')] = []
|
||||||
else:
|
else:
|
||||||
for slot in user_action[user_act]:
|
for slot in user_action[user_act]:
|
||||||
if slot[0] in self.results[0]:
|
if slot[0] in self.results[0]:
|
||||||
system_action[(domain, 'Inform')].append([slot[0], self.results[0].get(slot[0], 'unknown')])
|
system_action[(domain, 'Inform')].append([slot[0], self.results[0].get(slot[0], 'unknown')])
|
||||||
|
|
||||||
elif intent == 'inform':
|
elif intent == 'inform':
|
||||||
if len(self.results) == 0:
|
if len(self.results) == 0:
|
||||||
system_action[(domain, 'NoOffer')] = []
|
system_action[(domain, 'NoOffer')] = []
|
||||||
else:
|
else:
|
||||||
system_action[(domain, 'Inform')].append(['Choice', str(len(self.results))])
|
system_action[(domain, 'Inform')].append(['Choice', str(len(self.results))])
|
||||||
choice = self.results[0]
|
choice = self.results[0]
|
||||||
|
|
||||||
if domain in ["hotel"]:
|
if domain in ["hotel"]:
|
||||||
system_action[(domain, 'Recommend')].append(['Name', choice['name']])
|
system_action[(domain, 'Recommend')].append(['Name', choice['name']])
|
||||||
for slot in state['belief_state'][domain]['info']:
|
for slot in state['belief_state'][domain]['info']:
|
||||||
if choice.get(slot):
|
if choice.get(slot):
|
||||||
state['belief_state'][domain]['info'][slot] = choice[slot]
|
state['belief_state'][domain]['info'][slot] = choice[slot]
|
||||||
|
Loading…
Reference in New Issue
Block a user