From f4b8ba58607d8e84d6037521d63ead81d6f270c6 Mon Sep 17 00:00:00 2001 From: karoel2 Date: Wed, 8 Jun 2022 10:23:01 +0200 Subject: [PATCH] Add basic tactic --- system_mockup/system_dialogowy.py | 10 +++++---- system_mockup/taktyka_dialogu.py | 37 +++++++++++++------------------ 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/system_mockup/system_dialogowy.py b/system_mockup/system_dialogowy.py index d35e455..7523a43 100644 --- a/system_mockup/system_dialogowy.py +++ b/system_mockup/system_dialogowy.py @@ -11,13 +11,15 @@ def main(): text = input('>>>') frame = analizator_jezyka_naturalnego(text) + print(frame) #{'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 - - generator_jezyka_nautalnego(frame, questions, state) + # questions = taktyka_dialogu(state) # todo dodac stan + # + # generator_jezyka_nautalnego(frame, questions, state) if __name__ == '__main__': main() diff --git a/system_mockup/taktyka_dialogu.py b/system_mockup/taktyka_dialogu.py index 5bc36a7..a346f18 100644 --- a/system_mockup/taktyka_dialogu.py +++ b/system_mockup/taktyka_dialogu.py @@ -1,26 +1,21 @@ -from enum import Enum -class Questions(Enum): - TIME = "time" - REPO = "repo" - NONE = "none" +def taktyka_dialogu(state, frame): + if state['current_context'] in ['hello', 'pomoc', 'bye']: + return short_thread(state) + else: + return long_thread(state) -#todo taktyka ma zwracać bardziej złożony obiekt -def taktyka_dialogu(frame): - return questions(frame) +def short_thread(state): + if state['current_context'] == 'pomoc': + pass + #TODO + else: + return state['current_context'] -#todo dodac wiecej casow -#brac pod uwage stan -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 +def long_thread(state): + state['topics'] -#todo dodać mock github api \ No newline at end of file + + +#todo dodać mock github api