0
votes

I am creating a dialogue to "make a complaint". The data to use in this dialog are:

  • Contract number: it can consist of 10 numbers or numbers and letters (Type : pattern)
  • Company (Type : entity)
  • Name: it can be composed of ([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'- ", ]){1,} (Type : pattern)
  • First name: it can be composed of ([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'- ", ]){1,} (Type : pattern)
  • Object of complaint : paragraph which can contain letters, numbers, characters, spaces, ... (Type : pattern)

After the collection of these data, a question will arise to the customer: your contract number is $num_contrat, your surname is: $surname your first name is: $first_name your claim is: $obj_reclamation. Do you confirm these data?

If yes, the claim will be recorded in the database. If not, the question that will be asked is: what data do you want to edit ? ...

Until now, my bot detects only the $company because it exists in the company entity and it does not detect $num_contrat, $surname, $first_name and $obj_reclamation.

1
How is the data collected? Is this in slots? How do you define the entities? How did you test? Please provide more information. - data_henrik
compagnie are defined as entities but surname, first_name, contract_number and obj_reclamation are entities with pattern type. - Ala Garali

1 Answers

0
votes

I would recommend to test your regular expressions with a testing tool. I ran your regexp at: https://regexr.com

It reported the error:

Range values reversed. Start char code is greater than end char code.

Which relates to -.

So your correct regular expression to fix this should be.

([A-Za-z àâæçéèêëîïôœùûüÿÀÂÆÇnÉÈÊËÎÏÔŒÙÛÜŸ'\- ", ]){1,} 

But you still have an issue. This is going to match the first full string that is entered. If the person is using slots, you are only going to detect the first word.

You have a few options to resolve this.

1. Use the @sys-name system entity. That will get you a persons name.

2. You can structure your request to ask for their explicit name.

3. You can create a mini form to force them to fill with structured content. Requires UI work.

4. You can create a cloud function to pass it to NLU which you can have return the persons name and company names, etc. I have an example here.