Systemy_DialogowePon15-30/presenter/Presenter.py

19 lines
847 B
Python

from presenter.chatbot_modules.DialogueStateTracker import DialogueStateTracker
from presenter.chatbot_modules.NaturalLanguageGeneration import NaturalLanguageGeneration
from presenter.chatbot_modules.NaturalLanguageUnderstanding import NaturalLanguageUnderstanding
from presenter.chatbot_modules.DialoguePolicy import DialoguePolicy
class Presenter:
dialogue_state_tracker = DialogueStateTracker()
nlu = NaturalLanguageUnderstanding()
policy = DialoguePolicy()
nlg = NaturalLanguageGeneration()
def process_user_input(self, user_input):
user_frames = self.nlu.text_to_user_frame(user_input)
dialogue_state = self.dialogue_state_tracker.processUserAct(user_frames)
system_frames = self.policy.resolve_system_acts(dialogue_state)
msg = self.nlg.generate_text(system_frames)
return msg