From a8bf975f12c6e1034caf55f6f68f72df8a7a08b6 Mon Sep 17 00:00:00 2001 From: Krzysztof Bojakowski Date: Fri, 3 May 2024 00:21:47 +0200 Subject: [PATCH] Dodanie modulu taktyki dialogu --- src/model/frame.py | 8 +++++--- src/model/slot.py | 4 ++++ src/service/dialog_policy.py | 12 ++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/model/slot.py create mode 100644 src/service/dialog_policy.py diff --git a/src/model/frame.py b/src/model/frame.py index bdbc717..66fad20 100644 --- a/src/model/frame.py +++ b/src/model/frame.py @@ -1,4 +1,6 @@ +from slot import Slot + class Frame: - def __init__(self, source: str, text: str): - self.source = source - self.text = text + def __init__(self, act: str, slots: list[Slot]): + self.slots = slots + self.act = act diff --git a/src/model/slot.py b/src/model/slot.py new file mode 100644 index 0000000..df4956f --- /dev/null +++ b/src/model/slot.py @@ -0,0 +1,4 @@ +class Slot: + def __init__(self, name, value=None): + self.name = name + self.value = value \ No newline at end of file diff --git a/src/service/dialog_policy.py b/src/service/dialog_policy.py new file mode 100644 index 0000000..a3cf40f --- /dev/null +++ b/src/service/dialog_policy.py @@ -0,0 +1,12 @@ +from model.frame import Frame +from model.dialogue_act import DialogueAct + +class DialogPolicy: + def __init__(self, frames: list[Frame]) -> None: + self.frames = frames + + def next_dialogue_act(self) -> Frame: + if self.frames[-1].act == "welcomemsg": + return Frame("welcomemsg", []) + else: + return Frame("canthelp", [])