I would like to know whether is possible to set a slot with a user’s response, without specifying any intent or entity, but getting only the text that the user has written.
I am facing the case where I have to set a slot
user_surname. In my opinion, the straightforward way to accomplish this is to take only the text in response to
utter_ask_surname, without having to generate hundreds of examples labeled with the entity
you can do so from Forms
forms: your_form: slot_name: - type: from_text intent: intent_name not_intent: excluded_intent
I have tried this solution before to write here. However, in this way, I have to specify an intent or an entity, right?
My aim was about how to set a slot directly with text from user, without specifying intents or entities.
how do you know when to take the text otherwise?? you can implement an action that can check the text everytime but you would need some kind of indication that the following question is about the last name and the answer you are expecting is the last name otherwise you would have to check literally every message that comes in.
not sure about your idea of implementing this otherwise, can you elaborate
The main issue is about to identify last names. I have trained the model with hundreds of surnames (from different countries), but often they are not recognized as entities.
Which could be a possible solution?
At the moment, I am using this action:
class ActionGetName(Action): def name(self): return "action_get_name" def run(self, dispatcher, tracker, domain): credentials = tracker.latest_message.get("text") return [SlotSet("surname",credentials)]
but I would like to find more effective solutions
possibly the hardest thing to do is detect last names, some countries like Belgium, last names are also locations , i would not go as far as detecting all last names of every country. This is the reason why keeping an intent is useful so you can avoid conflicts between when a name is asked v/s when you are asking where they live
possibly start with one, either use lookup tables to detect last names, list the common ones you can and if it is not in the list or not detected when asked, you can repeat the question and infact upon repeating you can invoke custom action that extracts it from the text as a failsafe option. be prepared that people can type answer in full sentence
“well my last name is van leuven.” which isn’t helpful. you can’t restrict the field to one token because last name can have more than one token as well.
so you have to take that into account as well.
if you are using form, you can also validate slot input and check for some corrections