taktyka_dialogu implementation

This commit is contained in:
Marcin Kostrzewski 2022-04-19 23:22:44 +02:00
parent b8192b498a
commit 44435f3fa6
3 changed files with 40 additions and 5 deletions

View File

@ -1,2 +1,2 @@
def generator_jezyka_nautalnego(): def generator_jezyka_nautalnego(frames):
pass print(frames)

View File

@ -10,8 +10,8 @@ def main():
text = input('>>>') text = input('>>>')
frame = analizator_jezyka_naturalnego(text) frame = analizator_jezyka_naturalnego(text)
state = monitor_stanu_dialogowego(frame) state = monitor_stanu_dialogowego(frame)
taktyka_dialogu(state) response_frames = taktyka_dialogu(state)
generator_jezyka_nautalnego() generator_jezyka_nautalnego(response_frames)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -1,2 +1,37 @@
from os import stat
from re import S
from acts import *
welcome = 'Witaj!'
prompt = 'Zapytaj mnie o moje imię.'
resp = 'Nazywam się Dia.'
def check_condition(state, conditions, type=all):
if type(i in state for i in conditions):
return True
return False
def taktyka_dialogu(state): def taktyka_dialogu(state):
print(state) if should_respond_gently(state):
return [hello_act, name_response_act]
if should_prompt(state):
return [help_response_act]
if should_respond_cold(state):
return [name_response_act]
return [unknown_act]
def should_respond_gently(state):
return check_condition(state, [hello_act, name_request_act])
def should_prompt(state):
return check_condition(state, [hello_act], any)
def should_respond_cold(state):
return check_condition(state, [name_request_act])