This commit is contained in:
s495727 2024-06-10 18:20:11 +02:00
parent f7ee0ba059
commit 4620e53229
3 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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

View File

@ -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