So the bot is imaginary but the application is universal.
In my project I want to ask the user some questions which have the same options.
E.g. on a scale from 1 to 5. Do you agree with X, yes or no?
The intents are the same, the entities are the same, but the context is different.
How can I store an entity depending on the last action of the bot?
Right now my slot gets overwritten (obviously) since the entity is the same.
Yes perfectly clear So the way to do this is to have slot names that are different to the entity and then store the entities in a slot in a custom action. So your stories would look something like this:
the same questonaire bot. i want to create a survey bot where the answer would be plain text. how can i achieve that using rasa. Any help would be much appreciated. @akelad
Here is an example action I made to get Likert ratings. But notice that the custom actions syntax may have changed because this was done on an older version of Rasa.
The user is asked for, on a scale from 1-5 how bad something felt, mentally.
class ActionStoreLikertPsychological(Action):
def name(self):
return 'custom_act_likert_psychological' #This is used in the story
def run(self, dispatcher, tracker, domain):
dictData = next((e for e in tracker.latest_message.entities if
e['entity'] == 'ent_likert'), None)
rating = dictData['value']
try:
rating = int(rating)
if (rating < 1) or (rating > 5):
dispatcher.utter_message("I need a number between 1 og 5")
return [SlotSet("slot_likert_psychological", None)]
else:
#dispatcher.utter_message("den psychological strain is set to " + str(rating))
return [SlotSet("slot_likert_psychological", rating)]
except:
dispatcher.utter_message("I need a number between 1 and 5")
return [SlotSet("slot_likert_psychological", None)]
Then you also need to train some intents with the entity being 1,2,3,4,5.
Thanks @Krogsager for quick reply. i was just wondering for i don’t have a response like 1 to 5 and i would ask questions such as how was your experience with product, Is there anything that we can improve. questions like this whose response is open ended and it would be difficult to train the model on responses from user.
I am a bit confused about how can i leverage rasa to do that and also i am a bit new to it.So if you have any idea on how could i achieve this it would be great help.
With any chat bot, you get the most benefit from it when you have you have to answer specific questions, or help a user through a precisely defined task. (E.g. FAQs, password reset, food ordering)
There are no chatbot system today that can handle open ended conversations. If you are looking for sentiment analysis in long texts you could take a look at this watson api.
like it asks multiple questions and stores user’s response. i am now wondering whether rasa is a good choice for such an application or should i use something else
Sure it can be done, but I wonder why you would do it. I concluded (when I made this thread) that it made more sense to use a normal questionnaire form instead of a chatbot. It is easier for the user to fill a form than chat with a bot.