Regex Entity Extractor

Hi I am trying to extract age using regex entity extractor and the issue that I am facing is that it is not being extracted. This is the way I have written it in my nlu file

  • regex: age_english examples: |
    • /^100|[1-9]?\d$/
  • intent: age_english examples: |
    • [25] (age_english)
    • [23] (age_english)

This is my story

  • story: Activate Form steps:
    • intent:-------------
    • action: -----------
    • action: user_details_form
    • slot_was_set:
      • loan_type:
      • name: ----------------
      • salary: ----------------
      • experience: ----------------
      • reason: ----------------
      • time: ----------------
      • age: 30

@ChrisRahme can you guide me on this?

Hello Afnaan,

Why is your regex so complicated for a number? Try \d{1,2}

Another culprit could be your formatting, you should not have a space between ] and ( when tagging entities. Try: [25](age_english)

hey @ChrisRahme , So my regex was complex I get that, I wanted age between 0 and 100. I put the space in between ) [ was because if I do not put it there so it is not displayed correctly on this site. After putting this in the nlu file do I have to make changes in the domain and stories as well? How do I identify what is the regex?

What are the changes?

If you just changed the Regex, you only have to retrain the bot.

I want to do this because my bot is getting confused between two slots

age and salary it overwrites the value of age in salary.

I think this is because both are numeric values.

salary: - entity: salary type: from_entity not_intent: age_english

age: - entity: age_english type: from_entity not_intent: salary_english I have written this as well. Can you please tell me some other way I might be able to do it? @ChrisRahme

Hmm yeah it’s confused because both are numbers.

Sorry, I don’t know how to solve this :sweat_smile: But this is most probably your problem. Please create a new thread with this problem clearly defined in the title. For example, “Extract numbers as different entities”, “Extract age and salary”, etc.

Linking the new thread in case anyone in the future needs it: