I’m working on a chatbot project. I’m trying to fetch data from a csv file.My csv file consists of number of people and locations. Suppose the user asks for 10 people then the bot will answer about the location for 10 people.
Hope you are doing well. I have corrected it just as you said and its working fine. But still I’m not getting the desired response. Suppose man.csv is my csv file.This csv file and image file of the output responses are attached below. Whatever I send like 10,20,30 etc. as user input, its giving me the same response “UK”. And when I send 1,2,3 etc., I’m the getting the desired responses.You can check the image file of the output. So, I think its considering the serial number as the user input, might be I’m wrong.
Do I need to first store the row data and then use it. Could you please help.
I looked into your actions.py. You have commented out the part where the _csv needs to run and fetch data from .csv file. I have modified the actions.py and it will work now.
I’m so sorry. By mistake I sent you the wrong file. I have tried it with this actions.py file. Please check. The file is attached with this message. My apologies for the inconvenience. Please help.actions.py (1.3 KB)
Hi,
Yes, the one I above sent will work, I understood that you have set entities and intents in your files. so I modified the actions.py according to it…
dispatcher.utter_message(text=row[1]) is not inside the for loop that’s why it did not print the user input values you expected.
You can use the above one or the fix this actions.py by adjusting the dispatcher.utter_message(text=row[1]) inside the for loop. and change the import to
import _csv and _csv.reader. Sometimes csv imports cannot be recognized on the py libraries. If you have issues on csv.
Hope you are doing well. Sorry for the late reply. I was also trying by myself. Actually, whatever I’m giving as user input its returning each and every value of the location as response. Could you please help. The response image file is attached with this message. Please check and reply if possible.
It looks like you have only 6 cell of data in your .csv and you are asking for 10 cells, It will print everything. Try adding more data into your csv and see.