Thanks a lot! This was missing… I followed it and voila!
I have another question if you can kindly help: I want to make the city name as case insensitive. As of now, my bot only recognizes city names that starts with Capital letter but cannot understand if user gives a city name in small letter, e.g., berlin but not Berlin. I am building a restaurant bot, so using Zomato .api to extract the relevant data. I am restricting the bot with a list of cities, created a dictionary of it where I mentioned the city names starting with capital letter and then the following code. Something is going wrong:
Error: Traceback (most recent call last): File “c:\users\sourav.kumar.nag\anaconda3\envs\rasademo\lib\site-packages\sanic\app.py”, line 976, in handle_request response = await response File “c:\users\sourav.kumar.nag\anaconda3\envs\rasademo\lib\site-packages\rasa_sdk\endpoint.py”, line 102, in webhook result = await executor.run(action_call) File “c:\users\sourav.kumar.nag\anaconda3\envs\rasademo\lib\site-packages\rasa_sdk\executor.py”, line 387, in run events = action(dispatcher, tracker, domain) File “C:\Users\sourav.kumar.nag\Desktop\Chatbots\RestaurantChatbot\actions.py”, line 65, in run check = check_location(loc) File “C:\Users\sourav.kumar.nag\Desktop\Chatbots\RestaurantChatbot\city_check.py”, line 26, in check_location elif loc.lower() not in city_dict: AttributeError: ‘NoneType’ object has no attribute ‘lower’
Code: city_dict = [x.lower() for x in city_dict] => As per the log it fails at this point def check_location(loc,city_dict =city_dict):