Add basic tactic

This commit is contained in:
karoel2 2022-06-08 10:23:01 +02:00
parent 3d47f53813
commit f4b8ba5860
2 changed files with 22 additions and 25 deletions

View File

@ -11,13 +11,15 @@ def main():
text = input('>>>') text = input('>>>')
frame = analizator_jezyka_naturalnego(text) frame = analizator_jezyka_naturalnego(text)
print(frame)
#{'act': 'notifications', 'slots': [('time_when', None), ('liczba', ''), ('timeunit', None)]} #{'act': 'notifications', 'slots': [('time_when', None), ('liczba', ''), ('timeunit', None)]}
state = monitor_stanu_dialogowego(frame) state = monitor_stanu_dialogowego(frame, frame)
print(state)
questions = taktyka_dialogu(frame) # todo dodac stan # questions = taktyka_dialogu(state) # todo dodac stan
#
generator_jezyka_nautalnego(frame, questions, state) # generator_jezyka_nautalnego(frame, questions, state)
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@ -1,26 +1,21 @@
from enum import Enum
class Questions(Enum): def taktyka_dialogu(state, frame):
TIME = "time" if state['current_context'] in ['hello', 'pomoc', 'bye']:
REPO = "repo" return short_thread(state)
NONE = "none" else:
return long_thread(state)
#todo taktyka ma zwracać bardziej złożony obiekt def short_thread(state):
def taktyka_dialogu(frame): if state['current_context'] == 'pomoc':
return questions(frame) pass
#TODO
else:
return state['current_context']
#todo dodac wiecej casow def long_thread(state):
#brac pod uwage stan state['topics']
def questions(frame):
for slot in frame['slots']:
if slot[0] == "time_when" and slot[1] == None:
return Questions.TIME
if slot[0] == "repo" and (slot[1] == None or slot[1] == ""):
return Questions.REPO
return Questions.NONE
#todo dodać mock github api #todo dodać mock github api