Dodano rozwiązanie zadania z LAB6

This commit is contained in:
Kacper Dudzic 2022-04-13 16:47:18 +02:00
parent 101732b88c
commit c556be513a

56
makieta.py Normal file
View File

@ -0,0 +1,56 @@
acts_list = {'hello': 'welcomemsg'}
class Act_frame:
text = ''
act = []
class Dialogue_state_frame:
user_history = []
system_history = []
def NLU(text):
user_frame = Act_frame()
user_frame.text = text
if text == 'Cześć, jak masz na imię?':
user_frame.act = 'hello'
else:
pass
return user_frame
def DST(user_frame):
dialogue_frame = Dialogue_state_frame()
dialogue_frame.user_history.append((user_frame.text, user_frame.act))
# ...
return dialogue_frame
def DP(dialogue_frame):
system_frame = Act_frame()
system_frame.act = acts_list[dialogue_frame.user_history[-1][1]]
return system_frame
def NLG(system_frame):
answer = ''
if system_frame.act == 'welcomemsg':
answer = 'Witaj, nazywam się Usher'
else:
pass
return answer
text = 'Cześć, jak masz na imię?'
print(NLG(DP(DST(NLU(text)))))