from parser import nlu request = input() result = nlu(request) for slot in result['slots']: if slot[0] == "time_when" and slot[1] == None: print("Z jakiego okresu czasu chcesz zobaczyć powiadomienia?") while True: response = input() responseResult = nlu(response) liczba = list(filter(lambda s : s[0] == "liczba", responseResult['slots'])) timeunit = list(filter(lambda s : s[0] == "timeunit", responseResult['slots'])) if len(timeunit) != 0: print("{} {}".format(liczba, timeunit)) break else: print("Nieprawidłowy czas, spróbuj jeszcze raz")