SystemyDialogowe/main.py

37 lines
1.1 KiB
Python
Raw Normal View History

2021-04-26 00:29:07 +02:00
from NaturalLanguageUnderstanding import NLU
2021-04-26 09:57:03 +02:00
from NaturalLanguageGeneration import NLG
2021-04-26 00:29:07 +02:00
from DialogueStateTracker import DST
from DialoguePolicy import DP
if __name__ == "__main__":
nlu = NLU()
dst = DST()
2021-05-31 13:52:01 +02:00
dp = DP(dst)
2021-04-26 09:57:03 +02:00
nlg = NLG()
while(1):
user_input = input("Wpisz tekst: ")
2021-04-26 00:29:07 +02:00
2021-05-16 16:56:37 +02:00
user_frame = nlu.parse_user_input(user_input)
2021-05-31 13:52:01 +02:00
print('------ rozpoznany user frame ------')
2021-05-30 12:55:49 +02:00
print(user_frame)
2021-05-31 13:52:01 +02:00
dst.user_update(user_frame)
state, last_user_act, last_system_act = dst.get_dialogue_state()
slots = dst.get_dialogue_slots()
system_act = dp.chooseTactic()
dst.system_update(system_act)
print('------ stan ------')
print(state, last_user_act, last_system_act)
print('------ przechowywane sloty ------')
print(slots)
print('------ wybrana akcja systemu ------')
print(system_act)
print('-----------------------------------')
print('-----------------------------------')
2021-05-30 12:55:49 +02:00
#text = nlg.toText(system_act)
2021-04-26 00:29:07 +02:00
2021-05-30 12:55:49 +02:00
#print(text)
#if system_act.isDialogFinished():
# break