Add gramar slots
This commit is contained in:
parent
d2238ec165
commit
b59b5528b1
@ -1,7 +1,7 @@
|
||||
from analizator_jezyka_naturalnego import analizator_jezyka_naturalnego
|
||||
from monitor_stanu_dialogowego import monitor_stanu_dialogowego
|
||||
from taktyka_dialogu import taktyka_dialogu
|
||||
from generator_jezyka_nautalnego import generator_jezyka_nautalnego
|
||||
# from generator_jezyka_nautalnego import generator_jezyka_nautalnego
|
||||
|
||||
def main():
|
||||
running = True
|
||||
@ -11,13 +11,13 @@ def main():
|
||||
text = input('>>>')
|
||||
|
||||
frame = analizator_jezyka_naturalnego(text)
|
||||
print(frame)
|
||||
# print(frame)
|
||||
#{'act': 'notifications', 'slots': [('time_when', None), ('liczba', ''), ('timeunit', None)]}
|
||||
|
||||
state = monitor_stanu_dialogowego(frame, frame)
|
||||
print(state)
|
||||
state = monitor_stanu_dialogowego(frame)
|
||||
# print(state)
|
||||
|
||||
# questions = taktyka_dialogu(state) # todo dodac stan
|
||||
questions = taktyka_dialogu(state, frame) # todo dodac stan
|
||||
#
|
||||
# generator_jezyka_nautalnego(frame, questions, state)
|
||||
|
||||
|
@ -1,5 +1,31 @@
|
||||
gramar_slots = {
|
||||
# 'act': ((slot0, 'required'),
|
||||
# (slot1, 'optional')
|
||||
# )
|
||||
'pullrequest': (('action', 'optional'),
|
||||
('repo', 'required')
|
||||
),
|
||||
'brefing': (('action', 'optional'),
|
||||
('repo', 'required')
|
||||
),
|
||||
'notifications': (('liczba', 'optional'),
|
||||
# ('repo', 'required')
|
||||
),
|
||||
'tests': (('test', 'optional'),
|
||||
# ('repo', 'required')
|
||||
),
|
||||
'time': (('time_when', 'required'),
|
||||
('timeunit', 'required')
|
||||
),
|
||||
'issues': (
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def taktyka_dialogu(state, frame):
|
||||
if frame['act'] == 'null':
|
||||
print("Nie rozumiem :/")
|
||||
return 'null'
|
||||
if state['current_context'] in ['hello', 'pomoc', 'bye']:
|
||||
return short_thread(state)
|
||||
else:
|
||||
@ -7,13 +33,39 @@ def taktyka_dialogu(state, frame):
|
||||
|
||||
def short_thread(state):
|
||||
if state['current_context'] == 'pomoc':
|
||||
print(state['current_context'])
|
||||
pass
|
||||
#TODO
|
||||
else:
|
||||
print(state['current_context'])
|
||||
return state['current_context']
|
||||
|
||||
def long_thread(state):
|
||||
state['topics']
|
||||
act = state['current_context']
|
||||
slots = []
|
||||
for topic in state['topics']:
|
||||
if act == topic['act']:
|
||||
slots = topic['slots']
|
||||
required = gramar_slots[act]
|
||||
for item in required:
|
||||
if item[1] == 'required':
|
||||
for slot in slots:
|
||||
if slot[0] == item[0] and slot[1] == '':
|
||||
if slot[0] == 'repo':
|
||||
state['facts']['repo'] == ''
|
||||
print('dopytaj')
|
||||
print(item[0])
|
||||
elif slot[0] == 'time':
|
||||
state['facts']['time'] == ''
|
||||
print('dopytaj')
|
||||
print(item[0])
|
||||
else:
|
||||
print('dopytaj')
|
||||
print(item[0])
|
||||
#pokaz
|
||||
#powiedz, że może dopytać o... 'optional'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user