Zaktualizuj 'dialogue_system.py'

fix NLG
This commit is contained in:
Julian Zabłoński 2022-06-08 01:25:12 +02:00
parent 44b9976aa6
commit 8dc0774ca1

View File

@ -2,8 +2,11 @@ from modules.NLU import NLU
from modules.DST import DST
from modules.DP import DP
from modules.NLG import NLG
import json
import re
value_dict = json.load(open('value_dict.json'))
def format_prediction(prediction, intent):
out_list = []
for idx, tup in enumerate(prediction):
@ -117,11 +120,16 @@ def main():
elif (('jak' or 'któr') and 'film') in user_input_lr or 'repertuar' in user_input_lr:
dst.update([['inform', 'Cinema', 'task', 'show_movies']])
print(nlg.update([['cinema','offer','task','closestscreening']]))
for slot in slots:
if slot[0] in value_dict['train']['date'] or slot[0] in value_dict['train']['day'] or slot[0] in ['dziś','jutro','pojutrze']:
print(nlg.update([['cinema','inform','closestscreening',slot[0]]]))
flag = True
if not flag:
print(nlg.update([['cinema','inform','closestscreening','']]))
elif (('czy' or 'jakie' or 'które') and ('dostęp' or 'woln' or 'zajęt') and 'miejsc') in user_input_lr:
dst.update([['inform', 'Cinema', 'task', 'show_seats']])
print(nlg.update([['cinema','inform','task','seat']]))
print(nlg.update([['cinema','inform','seat','']]))
else:
print(formatted_prediction) # NLU output
@ -155,3 +163,4 @@ def main():
if __name__ == '__main__':
main()