Move acts to consts

This commit is contained in:
Marcin Kostrzewski 2022-04-19 23:22:20 +02:00
parent 6bc9f36154
commit b8192b498a
3 changed files with 13 additions and 3 deletions

5
system_mockup/acts.py Normal file
View File

@ -0,0 +1,5 @@
hello_act = 'hello'
name_request_act = 'request(name)'
name_response_act = 'inform(name)'
help_response_act = 'helpresponse'
unknown_act = 'null'

View File

@ -1,11 +1,13 @@
import re 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]'] hello = ['dzie[ńn] dobry', 'dobry wiecz[oó]r', 'witam', 'witaj', 'siema', 'elo', 'cze[śs][ćc]']
request_name = ['imi[eę]', 'nazywasz'] request_name = ['imi[eę]', 'nazywasz']
question = ['\?$'] question = ['\?$']
acts = {'hello': [hello], acts = {hello_act: [hello],
'request(name)': [request_name, question]} name_request_act: [request_name, question]}
def analizator_jezyka_naturalnego(text): def analizator_jezyka_naturalnego(text):
text = text_preprocess(text) text = text_preprocess(text)

View File

@ -1,3 +1,6 @@
from acts import hello_act
dialogue_state = [] dialogue_state = []
def monitor_stanu_dialogowego(frame): def monitor_stanu_dialogowego(frame):
@ -9,6 +12,6 @@ def monitor_stanu_dialogowego(frame):
def reset_state_if_needed(frame): def reset_state_if_needed(frame):
if 'hello' in frame: if hello_act in frame:
dialogue_state.clear() dialogue_state.clear()