taktyka_dialogu implementation
This commit is contained in:
parent
b8192b498a
commit
44435f3fa6
@ -1,2 +1,2 @@
|
||||
def generator_jezyka_nautalnego():
|
||||
pass
|
||||
def generator_jezyka_nautalnego(frames):
|
||||
print(frames)
|
||||
|
@ -10,8 +10,8 @@ def main():
|
||||
text = input('>>>')
|
||||
frame = analizator_jezyka_naturalnego(text)
|
||||
state = monitor_stanu_dialogowego(frame)
|
||||
taktyka_dialogu(state)
|
||||
generator_jezyka_nautalnego()
|
||||
response_frames = taktyka_dialogu(state)
|
||||
generator_jezyka_nautalnego(response_frames)
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -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):
|
||||
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])
|
Loading…
Reference in New Issue
Block a user