2023-05-05 00:07:47 +02:00
|
|
|
from SystemActType import SystemActType
|
|
|
|
from UserActType import UserActType
|
|
|
|
|
|
|
|
|
|
|
|
class NLG:
|
|
|
|
def generate_response(self, state, last_user_act, last_system_act, slots, system_act):
|
|
|
|
if state == UserActType['order']:
|
2023-05-05 00:42:26 +02:00
|
|
|
if system_act['act'] == SystemActType['request']:
|
|
|
|
if system_act['slot'] == 'kind':
|
|
|
|
return 'Jaką pizzę chcesz zamówić?'
|
|
|
|
elif system_act['slot'] == 'size':
|
2023-05-05 00:07:47 +02:00
|
|
|
return 'Jakiego rozmiaru chcesz pizzę?'
|
2023-05-05 00:42:26 +02:00
|
|
|
elif system_act['slot'] == 'plates':
|
2023-05-05 00:07:47 +02:00
|
|
|
return 'Dla ilu osób ma to być?'
|
2023-05-05 00:42:26 +02:00
|
|
|
elif system_act['act'] == SystemActType['confirm_domain']:
|
|
|
|
return 'Czy mam dodać tę pizzę do zamówienia?\nPizza: {}\nRozmiar: {}\nIlość osób: {}'.\
|
|
|
|
format(slots['order']['kind'], slots['order']['size'], slots['order']['plates'])
|
2023-05-05 00:07:47 +02:00
|
|
|
elif last_user_act == UserActType['hello']:
|
2023-05-05 00:42:26 +02:00
|
|
|
return 'Dzień dobry, w czym mogę pomóc?'
|
2023-05-05 00:07:47 +02:00
|
|
|
else:
|
2023-05-05 00:42:26 +02:00
|
|
|
return 'Przepraszam. Zdanie nie jest mi zrozumiałe. Spróbuj je sformułować w inny sposób.'
|