Zaktualizuj 'dialogue_system.py'
fix
This commit is contained in:
parent
06fc1dd32c
commit
520f262ecc
@ -59,16 +59,29 @@ def main():
|
||||
formatted_prediction = format_prediction(slots, intent)
|
||||
for slot in formatted_prediction:
|
||||
if len(formatted_prediction)<2:
|
||||
if dst.state['system_action'][-1] != slot:
|
||||
formatted_prediction.remove(slot)
|
||||
formatted_prediction.append([slot[0],slot[1],dst.state['system_action'][-1][0][2],slot[3]])
|
||||
try:
|
||||
if dst.state['system_action'][-1] != slot:
|
||||
formatted_prediction.remove(slot)
|
||||
formatted_prediction.append([slot[0],slot[1],dst.state['system_action'][-1][0][2],slot[3]])
|
||||
except:
|
||||
pass
|
||||
if slot[2]=='seat':
|
||||
if ',' in slot[3]:
|
||||
seat,row = slot[3].split(',')
|
||||
formatted_prediction.remove(['inform', 'Cinema', 'seat', slot[3]])
|
||||
formatted_prediction.append(['inform', 'Cinema', 'seat', seat])
|
||||
formatted_prediction.append(['inform', 'Cinema', 'row', f' {row}'])
|
||||
if 'rzęd' in user_input_lr:
|
||||
if ('czy' or 'jakie' or 'które') and ('dostęp' or 'woln' or 'zajęt' or 'są') and 'miejsc' in user_input_lr:
|
||||
dst.update([['offer', 'Cinema', 'task', 'show_seats']])
|
||||
flag=False
|
||||
for slot in slots:
|
||||
if slot[0] in value_dict['train']['seat']:
|
||||
print(nlg.update([['cinema','offer','seat',slot[0]]]))
|
||||
flag = True
|
||||
if not flag:
|
||||
print(nlg.update([['cinema','offer','seat','']]))
|
||||
|
||||
elif 'rzęd' in user_input_lr:
|
||||
formatted_prediction_tmp = formatted_prediction.copy()
|
||||
user_input_splited = user_input_lr.split()
|
||||
for slots in formatted_prediction:
|
||||
@ -88,7 +101,6 @@ def main():
|
||||
formatted_prediction.append(['inform', 'Cinema', 'row', user_input_splited[i+1]])
|
||||
elif 'miejsc' in user_input_lr and 'bilet' not in user_input_lr:
|
||||
for i in range(len(user_input_splited)-1):
|
||||
print(user_input_splited[i],user_input_splited[i+1])
|
||||
if 'rzęd' in user_input_splited[i]:
|
||||
try:
|
||||
if isinstance(int(user_input_splited[i+1]),int)and i==0:
|
||||
@ -109,7 +121,6 @@ def main():
|
||||
formatted_prediction.append(['inform', 'Cinema', 'seat', user_input_splited[i+1]])
|
||||
elif 'miejsc' not in user_input_lr and 'bilet' in user_input_lr:
|
||||
for i in range(len(user_input_splited)-1):
|
||||
print(user_input_splited[i],user_input_splited[i+1])
|
||||
if 'rzęd' in user_input_splited[i]:
|
||||
try:
|
||||
if isinstance(int(user_input_splited[i+1]),int)and i==0:
|
||||
@ -159,7 +170,7 @@ def main():
|
||||
formatted_prediction.append(['inform', 'Cinema', 'quantity', user_input_splited[i+1]])
|
||||
|
||||
|
||||
if user_input_lr == '/pomoc':
|
||||
elif user_input_lr == '/pomoc':
|
||||
print('System Usher pozwala na:\n1. Rezerwację biletu\n2. Anulowanie rezerwacji biletu\n3. Zakup biletu\n4. Anulowanie zakupu biletu\n5. Sprawdzenie repertuaru\n6. Sprawdzenie dostępności miejsc')
|
||||
|
||||
elif user_input_lr == '/koniec':
|
||||
@ -239,25 +250,12 @@ def main():
|
||||
flag = True
|
||||
if not flag:
|
||||
print(nlg.update([['cinema','offer','closestscreening','']]))
|
||||
|
||||
elif ('czy' or 'jakie' or 'które') and ('dostęp' or 'woln' or 'zajęt') in user_input_lr:
|
||||
if 'miejsce' in user_input_lr:
|
||||
dst.update([['offer', 'Cinema', 'task', 'show_seats']])
|
||||
flag=False
|
||||
for slot in slots:
|
||||
if slot[0] in value_dict['train']['seat']:
|
||||
print(nlg.update([['cinema','offer','seat',slot[0]]]))
|
||||
flag = True
|
||||
if not flag:
|
||||
print(nlg.update([['cinema','offer','seat','']]))
|
||||
|
||||
elif len(formatted_prediction)<1:
|
||||
print('Nie do końca zrozumiałem mógłbyś/mogłabyś powtórzyć? ')
|
||||
|
||||
else:
|
||||
# print(formatted_prediction) # NLU output
|
||||
dst.update(formatted_prediction)
|
||||
#DP
|
||||
fl = False
|
||||
for action in dst.state['system_action']:
|
||||
if 'cancel_book' == action[0][2]:
|
||||
@ -266,7 +264,6 @@ def main():
|
||||
fl = True
|
||||
if fl:
|
||||
print("Anulowano. Czy w czymś jeszcze mogę Ci pomóc?")
|
||||
|
||||
|
||||
else:
|
||||
for slot,value in dst.state['belief_state']['cinema']['book'].items():
|
||||
@ -301,4 +298,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
Loading…
Reference in New Issue
Block a user