Remove short_thread
This commit is contained in:
parent
ac0a3417da
commit
57c1893a55
@ -37,16 +37,16 @@ gramar_slots = {
|
|||||||
def taktyka_dialogu(state, frame):
|
def taktyka_dialogu(state, frame):
|
||||||
if frame['act'] == 'null':
|
if frame['act'] == 'null':
|
||||||
return 'null'
|
return 'null'
|
||||||
if state['current_context'] in ['hello', 'pomoc', 'bye']:
|
# if state['current_context'] in ['hello', 'pomoc', 'bye']:
|
||||||
return short_thread(state)
|
# return short_thread(state)
|
||||||
else:
|
# else:
|
||||||
return long_thread(state)
|
return long_thread(state)
|
||||||
|
|
||||||
def short_thread(state):
|
# def short_thread(state):
|
||||||
if state['current_context'] == 'pomoc':
|
# if state['current_context'] == 'pomoc':
|
||||||
return state['current_context']
|
# return state['current_context']
|
||||||
else:
|
# else:
|
||||||
return state['current_context']
|
# return state['current_context']
|
||||||
|
|
||||||
def validate_repo(repo):
|
def validate_repo(repo):
|
||||||
if repo not in listRepositories():
|
if repo not in listRepositories():
|
||||||
@ -61,13 +61,13 @@ def long_thread(state):
|
|||||||
slots = topic['slots']
|
slots = topic['slots']
|
||||||
required = gramar_slots[act]
|
required = gramar_slots[act]
|
||||||
req_args, opt_args = agregate(required, slots)
|
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)
|
req_args = add_facts(req_args, facts)
|
||||||
opt_args = add_facts(opt_args, facts)
|
opt_args = add_facts(opt_args, facts)
|
||||||
required_empty = check_req(req_args)
|
required_empty = check_req(req_args)
|
||||||
if required_empty:
|
if required_empty:
|
||||||
return "QESTION", required_empty[0] #slot do uzupełnienia
|
return False, required_empty[0] #slot do uzupełnienia
|
||||||
return "ANSWER", act, req_args, opt_args #wyświetl użytkownikowi
|
return True, act, req_args, opt_args #wyświetl użytkownikowi
|
||||||
|
|
||||||
def check_req(req_args):
|
def check_req(req_args):
|
||||||
req = []
|
req = []
|
||||||
@ -99,4 +99,3 @@ def agregate(grammar, slots):
|
|||||||
elif item[1] == 'optional':
|
elif item[1] == 'optional':
|
||||||
opt_args.append([item[0], value])
|
opt_args.append([item[0], value])
|
||||||
return req_args, opt_args
|
return req_args, opt_args
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user