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 analizator_jezyka_naturalnego import analizator_jezyka_naturalnego
|
||||||
from monitor_stanu_dialogowego import monitor_stanu_dialogowego
|
from monitor_stanu_dialogowego import monitor_stanu_dialogowego
|
||||||
from taktyka_dialogu import taktyka_dialogu
|
from taktyka_dialogu import taktyka_dialogu
|
||||||
from generator_jezyka_nautalnego import generator_jezyka_nautalnego
|
# from generator_jezyka_nautalnego import generator_jezyka_nautalnego
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
running = True
|
running = True
|
||||||
@ -11,13 +11,13 @@ def main():
|
|||||||
text = input('>>>')
|
text = input('>>>')
|
||||||
|
|
||||||
frame = analizator_jezyka_naturalnego(text)
|
frame = analizator_jezyka_naturalnego(text)
|
||||||
print(frame)
|
# 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, frame)
|
state = monitor_stanu_dialogowego(frame)
|
||||||
print(state)
|
# print(state)
|
||||||
|
|
||||||
# questions = taktyka_dialogu(state) # todo dodac stan
|
questions = taktyka_dialogu(state, frame) # todo dodac stan
|
||||||
#
|
#
|
||||||
# generator_jezyka_nautalnego(frame, questions, state)
|
# 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):
|
def taktyka_dialogu(state, frame):
|
||||||
|
if frame['act'] == 'null':
|
||||||
|
print("Nie rozumiem :/")
|
||||||
|
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:
|
||||||
@ -7,13 +33,39 @@ def taktyka_dialogu(state, frame):
|
|||||||
|
|
||||||
def short_thread(state):
|
def short_thread(state):
|
||||||
if state['current_context'] == 'pomoc':
|
if state['current_context'] == 'pomoc':
|
||||||
|
print(state['current_context'])
|
||||||
pass
|
pass
|
||||||
#TODO
|
#TODO
|
||||||
else:
|
else:
|
||||||
|
print(state['current_context'])
|
||||||
return state['current_context']
|
return state['current_context']
|
||||||
|
|
||||||
def long_thread(state):
|
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