Poprawki do dependency, dodanie przykladu do main.py

This commit is contained in:
s495727 2024-05-03 00:30:43 +02:00
parent a8bf975f12
commit c70685682d
4 changed files with 18 additions and 12 deletions

View File

@ -1,10 +1,16 @@
from src.model.frame import Frame
from src.service.dialog_state_monitor import DialogStateMonitor
from model.frame import Frame
from service.dialog_state_monitor import DialogStateMonitor
from service.dialog_policy import DialogPolicy
# Example
print("Dialog state monitor, examples:")
monitor = DialogStateMonitor()
monitor.append(Frame('system', 'hello'))
monitor.append(Frame('user', 'some text'))
print(monitor.get_all()[0].text)
print(monitor.get_last().text)
monitor.append(Frame('system', 'hello', []))
monitor.append(Frame('user', 'some_text', []))
print(monitor.get_all()[0].act)
print(monitor.get_last().act)
print("Dialog policy, next dialogue act:")
dialog_policy = DialogPolicy(monitor.get_all())
print(dialog_policy.next_dialogue_act().act)

View File

@ -1,6 +1,7 @@
from slot import Slot
from model.slot import Slot
class Frame:
def __init__(self, act: str, slots: list[Slot]):
def __init__(self, source: str, act: str, slots: list[Slot]):
self.source = source
self.slots = slots
self.act = act

View File

@ -1,5 +1,4 @@
from model.frame import Frame
from model.dialogue_act import DialogueAct
class DialogPolicy:
def __init__(self, frames: list[Frame]) -> None:
@ -7,6 +6,6 @@ class DialogPolicy:
def next_dialogue_act(self) -> Frame:
if self.frames[-1].act == "welcomemsg":
return Frame("welcomemsg", [])
return Frame("system", "welcomemsg", [])
else:
return Frame("canthelp", [])
return Frame("system", "canthelp", [])

View File

@ -1,4 +1,4 @@
from src.model.frame import Frame
from model.frame import Frame
class DialogStateMonitor: