SystemyDialogowe/DialoguePolicy.py

28 lines
1012 B
Python
Raw Normal View History

2021-04-26 15:13:52 +02:00
from SystemAct import SystemAct
2021-04-26 00:29:07 +02:00
from UserActType import UserActType
2021-04-26 15:13:52 +02:00
from SystemActType import SystemActType
2021-04-26 00:29:07 +02:00
class DP:
"""
2021-04-26 09:57:03 +02:00
Moduł decydujący o wyborze kolejnego aktu, który ma podjąć system prowadząc rozmowę.
Wejście: Reprezentacja stanu dialogu (rama)
Wyjście: Akt systemu (rama)
2021-04-26 00:29:07 +02:00
"""
def __init__(self):
pass
2021-04-26 15:13:52 +02:00
def chooseTactic(self, frameList=None) -> SystemAct:
userAct = frameList[-1]
if userAct.getActType() == UserActType.WELCOME_MSG:
return SystemAct(SystemActType.WELCOME_MSG)
if userAct.getActType() == UserActType.REQUEST:
if "name" in userAct.getActParams():
return SystemAct(SystemActType.INFORM,['name'])
if userAct.getActType() == UserActType.BYE:
return SystemAct(SystemActType.BYE)
if userAct.getActType() == UserActType.INVALID:
return SystemAct(SystemActType.NOT_UNDERSTOOD)
raise Exception("UserAct:{} not recognized".format(userAct))