27 lines
1.0 KiB
Python
27 lines
1.0 KiB
Python
from model.frame import Frame
|
|
from service.dialog_state_monitor import DialogStateMonitor
|
|
from service.dialog_policy import DialogPolicy
|
|
from service.natural_languag_understanding import NaturalLanguageUnderstanding
|
|
from service.natural_language_generation import NaturalLanguageGeneration
|
|
|
|
print("Natural language understanding, example:")
|
|
naturalLanguageUnderstanding = NaturalLanguageUnderstanding()
|
|
print(naturalLanguageUnderstanding.convert_text_to_frame("Cześć, jak masz na imię?"))
|
|
|
|
# Example
|
|
print("Dialog state monitor, examples:")
|
|
monitor = DialogStateMonitor()
|
|
monitor.append(Frame('system', 'hello', []))
|
|
monitor.append(Frame('user', 'some_text', []))
|
|
print(monitor.get_all()[0].act)
|
|
print(monitor.get_last().act)
|
|
|
|
print("Dialog policy, next dialogue act:")
|
|
dialog_policy = DialogPolicy(monitor.get_all())
|
|
print(dialog_policy.next_dialogue_act().act)
|
|
|
|
print("Natural Language Generation example:")
|
|
agent = NaturalLanguageGeneration()
|
|
response = agent.respond_to_name_query("Jak masz na imię?")
|
|
print(response)
|