hope all works well
This commit is contained in:
parent
fbd85d9e34
commit
175de22c9b
14
src/main.py
14
src/main.py
@ -1,29 +1,31 @@
|
|||||||
from service.dialog_state_monitor import DialogStateMonitor
|
from service.dialog_state_monitor import DialogStateMonitor
|
||||||
from service.dialog_policy import DialogPolicy
|
from service.dialog_policy import DialogPolicy
|
||||||
from service.natural_languag_understanding import NaturalLanguageUnderstanding
|
from service.natural_languag_understanding import NaturalLanguageUnderstanding
|
||||||
from service.natural_language_generation import NaturalLanguageGeneration
|
from service.natural_language_generation import NaturalLanguageGeneration, parse_frame
|
||||||
|
from service.templates import templates
|
||||||
|
|
||||||
# initialize classes
|
# initialize classes
|
||||||
nlu = NaturalLanguageUnderstanding() # NLU
|
nlu = NaturalLanguageUnderstanding() # NLU
|
||||||
monitor = DialogStateMonitor() # DSM
|
monitor = DialogStateMonitor() # DSM
|
||||||
dialog_policy = DialogPolicy() # DP
|
dialog_policy = DialogPolicy() # DP
|
||||||
language_generation = NaturalLanguageGeneration() # NLG
|
language_generation = NaturalLanguageGeneration(templates) # NLG
|
||||||
|
|
||||||
# Main loop
|
# Main loop
|
||||||
user_input = input("Możesz zacząć pisać.\n")
|
user_input = input("Możesz zacząć pisać.\n")
|
||||||
while True:
|
while True:
|
||||||
# NLU
|
# NLU
|
||||||
frame = nlu.process_input(user_input)
|
frame = nlu.process_input(user_input)
|
||||||
print(frame)
|
# print(frame)
|
||||||
|
|
||||||
# DSM
|
# DSM
|
||||||
monitor.append(frame)
|
# monitor.append(frame)
|
||||||
|
|
||||||
# DP
|
# DP
|
||||||
print(dialog_policy.next_dialogue_act(monitor.get_all()).act)
|
# print(dialog_policy.next_dialogue_act(monitor.get_all()).act)
|
||||||
|
|
||||||
# NLG
|
# NLG
|
||||||
response = language_generation.respond_to_name_query("Jak masz na imię?")
|
act, slots = parse_frame(frame)
|
||||||
|
response = language_generation.generate(act, slots)
|
||||||
print(response)
|
print(response)
|
||||||
|
|
||||||
if frame.act == "bye":
|
if frame.act == "bye":
|
||||||
|
Loading…
Reference in New Issue
Block a user