Problem:- I have pincode.txt file and I want to serach in this file that user give input pincode. Means I can’t hard code all pincodes in entity or slots.
Possible solutions I have tried or think for this :
1> Use lookup table for that but Don’t know how to do it , means how to utter message when pincode not in my lookup table
2> Use custom action for that but not able to extract entity. So, anybody can help me out from this . here are releated flies that I have made
def run(self, dispatcher, tracker, domain):
path = '/home/saurbh/Desktop/intern/my_project/rasa/pincode.txt'
pincode_file = open(path,'r')
pin = tracker.get_slot('pincode')
for i in pincode_file:
Payme India, your app is not accepting my pincode?
pin = str(tracker.get_slot('pincode'))
with open('pincode.txt') as file:
for line in file:
for word in line.split():
if pin in word:
Also the ‘run’ function needs the above mentioned parameters according to the format by rasa.
The type of get_slot is NONE, so we convert it to str.