I would like to use regex instead of list of possible values in nlu file. I had some imagination how to do it but it does not works as I was expecting. It was working with list, where were listed every possible value, entity UpdateNumber was filled correctly. But it does not working with regex, please have somebody an experience with regex?
nlu.md:
## regex:update_number
- ([A-Z]{2}[0-9]{3}/[0-9]{2}/[A-Z]{1})
## intent:give_update_number
- the update number is [update_number](UpdateNumber)
- [update_number](UpdateNumber)
You need to provide examples under the intent with values for the update_number, the regex is not designed to replace that value. So have something like:
Thank you, but it is exactly as it was working before, there were list of examples. So, is not possible to use regex instead of this list and in which case has to be used regex?
As far as I understand the regex part is just to further specify how exactly the entity has to look. The entity examples given in the intent examples are just for the NLU to “understand” in which context the entity can appear … am I near right?
I just added a regex definition a few minutes ago because intent examples alone didn’t work - but with the regex part it is working now!
I am little bit confused, please could you be more specific? I would like to know: where you added “regex definition for entity”?
In my case it is working with value from example (intent definition), but in case when I use different value (which is matched by regex) entity is not filled.
Thank you for your help! After I added 10 “examples” into intent it is working. Also I have 3 stories with different examples.
Only for the others, which cold fell lost as me:
nlu.md:
> ## regex:UpdateNumber
> - [A-Z]{2}[0-9]{3}/[0-9]{2}/[A-Z]{1}
>
> ## intent:give_update_number
> - the update number is [BC001/17/S](UpdateNumber)
> - [BC001/17/S](UpdateNumber)
> - the update number is [JB007/34/P](UpdateNumber)
> - [JB007/34/P](UpdateNumber)
....10x similar rows
stories.md
> ## story_resend_update_notification_01
> * update_notification
> - utter_ask_update_number
> * give_update_number{"UpdateNumber":"BC001/17/S"}
> - action_validate_update_number
> ... 3x similar stories with different values
Another question: how I can train bot to ask again for entity if value did not match pattern OR use some condition how to decide next steps? Only for example:
I have implemented action_validate_update_number which checks whether provided UpdateNumber matched our pattern. So this action with result false means: provided UpdateNumber is not valid, please provide it again. So there is not such action, it is exactly what I need to find out how to force bot for asking “Number was not valid, please provide it again!”.
My idea is: how to train bot in case when input does not matched pattern to ask user for it again? Something like condition but in this case bot has to decide if input was true OR else.
I’m also looking for solutions. But your story can not achieve your purpose obviously. Because there is no change in intent or event or entity. If you have the result, tell me please.
@cMarex Hmm, so what exactly is the problem you’re having now? You say part of it was solved right? Though your story format is wrong * give_update_number[BC001/17/S](UpdateNumber) --> * give_update_number{"UpdateNumber":"BC..."}
As for the action_validate_update_number, you should handle this with a boolean slot for example. something like is_valid_number and have a story for when it’s set to true and when it’s set to false
Hello, please could you provide an example how it should be written in stories? I do not have imagination how can rasa-core controls workflow, I always see examples when user controls workflow.
Hi @akelad, one small clarification - so if I have two to three entities which need to be validated, I need to write those many combinations of stories for the entities values true and false is it…?