From 57c1893a55e5cfc164122f8adf728c9dff6296c2 Mon Sep 17 00:00:00 2001 From: karoel2 Date: Wed, 15 Jun 2022 08:48:04 +0200 Subject: [PATCH] Remove short_thread --- system/taktyka_dialogu.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/system/taktyka_dialogu.py b/system/taktyka_dialogu.py index 62cd300..52e7d9d 100644 --- a/system/taktyka_dialogu.py +++ b/system/taktyka_dialogu.py @@ -37,16 +37,16 @@ gramar_slots = { def taktyka_dialogu(state, frame): if frame['act'] == 'null': return 'null' - if state['current_context'] in ['hello', 'pomoc', 'bye']: - return short_thread(state) - else: - return long_thread(state) + # if state['current_context'] in ['hello', 'pomoc', 'bye']: + # return short_thread(state) + # else: + return long_thread(state) -def short_thread(state): - if state['current_context'] == 'pomoc': - return state['current_context'] - else: - return state['current_context'] +# def short_thread(state): +# if state['current_context'] == 'pomoc': +# return state['current_context'] +# else: +# return state['current_context'] def validate_repo(repo): if repo not in listRepositories(): @@ -61,13 +61,13 @@ def long_thread(state): slots = topic['slots'] required = gramar_slots[act] req_args, opt_args = agregate(required, slots) - facts = state['facts']# osobno validuj repo z req i z facts + facts = state['facts'] req_args = add_facts(req_args, facts) opt_args = add_facts(opt_args, facts) required_empty = check_req(req_args) if required_empty: - return "QESTION", required_empty[0] #slot do uzupełnienia - return "ANSWER", act, req_args, opt_args #wyświetl użytkownikowi + return False, required_empty[0] #slot do uzupełnienia + return True, act, req_args, opt_args #wyświetl użytkownikowi def check_req(req_args): req = [] @@ -99,4 +99,3 @@ def agregate(grammar, slots): elif item[1] == 'optional': opt_args.append([item[0], value]) return req_args, opt_args -