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-05-30 19:01:45 +02:00
|
|
|
from collections import defaultdict
|
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):
|
2021-05-30 19:01:45 +02:00
|
|
|
self.results = []
|
2021-04-26 00:29:07 +02:00
|
|
|
|
2021-05-30 19:01:45 +02:00
|
|
|
def chooseTactic(self, current_frame) -> SystemAct:
|
|
|
|
#userAct = frameList[-1]
|
|
|
|
if current_frame.getActType() == UserActType.HELLO:
|
2021-04-26 15:13:52 +02:00
|
|
|
return SystemAct(SystemActType.WELCOME_MSG)
|
2021-05-30 19:01:45 +02:00
|
|
|
elif current_frame.getActType() == UserActType.BYE:
|
2021-04-26 15:13:52 +02:00
|
|
|
return SystemAct(SystemActType.BYE)
|
2021-05-30 19:01:45 +02:00
|
|
|
elif current_frame.getActType() == UserActType.CONFIRM:
|
|
|
|
# Czy napewno zawsze po Confirm jest Affirm?
|
|
|
|
return SystemAct(SystemActType.AFFIRM)
|
|
|
|
elif current_frame.getActType() == UserActType.NEGATE:
|
|
|
|
# TODO rozpoznanie czy ma się już komplet danych
|
|
|
|
# Affirm (gdy ma się wszystkie potrzebne zdanie)
|
|
|
|
# Request (gdy potrzeba się dopytać dalej)
|
|
|
|
# Bye (gdy to odp na REQMORE)
|
|
|
|
return SystemAct(SystemActType.AFFIRM)
|
|
|
|
elif current_frame.getActType() == UserActType.THANKYOU:
|
|
|
|
return SystemAct(SystemActType.REQMORE)
|
|
|
|
elif current_frame.getActType() == UserActType.INFORM:
|
|
|
|
# TODO najczęściej chyba AFFIRM, CONFIRM_DOMAIN i REQUEST
|
|
|
|
return SystemAct(SystemActType.REQUEST)
|
|
|
|
elif current_frame.getActType() == UserActType.CREATE_MEETING:
|
|
|
|
# TODO najczęściej chyba CONFIRM_DOMAIN i REQUEST
|
|
|
|
return SystemAct(SystemActType.REQUEST)
|
|
|
|
elif current_frame.getActType() == UserActType.UPDATE_MEETING:
|
|
|
|
# TODO rozpoznanie czy ma się już komplet danych jak nie to REQUEST jak tak to CONFIRM_DOMAIN
|
|
|
|
return SystemAct(SystemActType.REQUEST)
|
|
|
|
elif current_frame.getActType() == UserActType.CANCEL_MEETING:
|
|
|
|
# TODO rozpoznanie czy ma się już komplet danych jak nie to REQUEST jak tak to CONFIRM_DOMAIN
|
|
|
|
return SystemAct(SystemActType.REQUEST)
|
|
|
|
elif current_frame.getActType() == UserActType.MEETING_LIST:
|
|
|
|
return SystemAct(SystemActType.INFORM, ["meeting_list"])
|
|
|
|
elif current_frame.getActType() == UserActType.FREE_TIME:
|
|
|
|
return SystemAct(SystemActType.INFORM, ["freetime"])
|
|
|
|
elif current_frame.getActType() == UserActType.INVALID:
|
2021-04-26 15:13:52 +02:00
|
|
|
return SystemAct(SystemActType.NOT_UNDERSTOOD)
|
2021-05-16 23:11:55 +02:00
|
|
|
else:
|
|
|
|
return SystemAct(SystemActType.INFORM,['name'])
|