From 4620e5322928eb84ecda7d89704fd13b33d68942 Mon Sep 17 00:00:00 2001 From: kb Date: Mon, 10 Jun 2024 18:20:11 +0200 Subject: [PATCH] Poprawki --- src/main.py | 2 +- src/model/frame.py | 2 +- src/service/natural_languag_understanding.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.py b/src/main.py index aafeefb..c92b3f3 100644 --- a/src/main.py +++ b/src/main.py @@ -3,7 +3,6 @@ from service.dialog_policy import DialogPolicy from service.natural_languag_understanding import NaturalLanguageUnderstanding from service.natural_language_generation import NaturalLanguageGeneration, parse_frame from service.templates import templates -from convlab.dialog_agent import PipelineAgent # initialize classes nlu = NaturalLanguageUnderstanding() # NLU @@ -32,6 +31,7 @@ while True: # DP system_action = dialog_policy.predict(monitor) print("System action: ", system_action) + # NLG act, slots = parse_frame(frame) response = language_generation.generate(act, slots) diff --git a/src/model/frame.py b/src/model/frame.py index 01a9c71..caf874f 100644 --- a/src/model/frame.py +++ b/src/model/frame.py @@ -1,7 +1,7 @@ from .slot import Slot class Frame: - def __init__(self, source: str, act: str, slots: list[Slot]): + def __init__(self, source: str, act: str, slots: list[Slot] = []): self.source = source self.slots = slots self.act = act diff --git a/src/service/natural_languag_understanding.py b/src/service/natural_languag_understanding.py index dced5a0..facb98f 100644 --- a/src/service/natural_languag_understanding.py +++ b/src/service/natural_languag_understanding.py @@ -42,8 +42,8 @@ SLOTS: class NaturalLanguageUnderstanding(): def __init__(self, use_mocks=False): - if use_mocks: - self.use_mocks = True + self.use_mocks = use_mocks + if self.use_mocks: return from flair.models import SequenceTagger