Zaktualizuj 'dialogue_system.py'
fix NLG
This commit is contained in:
parent
44b9976aa6
commit
8dc0774ca1
@ -2,8 +2,11 @@ from modules.NLU import NLU
|
|||||||
from modules.DST import DST
|
from modules.DST import DST
|
||||||
from modules.DP import DP
|
from modules.DP import DP
|
||||||
from modules.NLG import NLG
|
from modules.NLG import NLG
|
||||||
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
value_dict = json.load(open('value_dict.json'))
|
||||||
|
|
||||||
def format_prediction(prediction, intent):
|
def format_prediction(prediction, intent):
|
||||||
out_list = []
|
out_list = []
|
||||||
for idx, tup in enumerate(prediction):
|
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:
|
elif (('jak' or 'któr') and 'film') in user_input_lr or 'repertuar' in user_input_lr:
|
||||||
dst.update([['inform', 'Cinema', 'task', 'show_movies']])
|
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:
|
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']])
|
dst.update([['inform', 'Cinema', 'task', 'show_seats']])
|
||||||
print(nlg.update([['cinema','inform','task','seat']]))
|
print(nlg.update([['cinema','inform','seat','']]))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print(formatted_prediction) # NLU output
|
print(formatted_prediction) # NLU output
|
||||||
@ -155,3 +163,4 @@ def main():
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user