From b8192b498a97753e2bbaf299d8033d42ccf2a043 Mon Sep 17 00:00:00 2001 From: Marcin Kostrzewski Date: Tue, 19 Apr 2022 23:22:20 +0200 Subject: [PATCH] Move acts to consts --- system_mockup/acts.py | 5 +++++ system_mockup/analizator_jezyka_naturalnego.py | 6 ++++-- system_mockup/monitor_stanu_dialogowego.py | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 system_mockup/acts.py diff --git a/system_mockup/acts.py b/system_mockup/acts.py new file mode 100644 index 0000000..a441fe7 --- /dev/null +++ b/system_mockup/acts.py @@ -0,0 +1,5 @@ +hello_act = 'hello' +name_request_act = 'request(name)' +name_response_act = 'inform(name)' +help_response_act = 'helpresponse' +unknown_act = 'null' \ No newline at end of file diff --git a/system_mockup/analizator_jezyka_naturalnego.py b/system_mockup/analizator_jezyka_naturalnego.py index bb4c032..7bc960f 100644 --- a/system_mockup/analizator_jezyka_naturalnego.py +++ b/system_mockup/analizator_jezyka_naturalnego.py @@ -1,11 +1,13 @@ import re +from acts import hello_act, name_request_act + hello = ['dzie[ńn] dobry', 'dobry wiecz[oó]r', 'witam', 'witaj', 'siema', 'elo', 'cze[śs][ćc]'] request_name = ['imi[eę]', 'nazywasz'] question = ['\?$'] -acts = {'hello': [hello], - 'request(name)': [request_name, question]} +acts = {hello_act: [hello], + name_request_act: [request_name, question]} def analizator_jezyka_naturalnego(text): text = text_preprocess(text) diff --git a/system_mockup/monitor_stanu_dialogowego.py b/system_mockup/monitor_stanu_dialogowego.py index 3ffee6a..095b8a9 100644 --- a/system_mockup/monitor_stanu_dialogowego.py +++ b/system_mockup/monitor_stanu_dialogowego.py @@ -1,3 +1,6 @@ +from acts import hello_act + + dialogue_state = [] def monitor_stanu_dialogowego(frame): @@ -9,6 +12,6 @@ def monitor_stanu_dialogowego(frame): def reset_state_if_needed(frame): - if 'hello' in frame: + if hello_act in frame: dialogue_state.clear()