Struggling to recognize intent with phone-number

Hello :slightly_smiling_face:,

We just upgraded to 12.10.1, since it seem botpress is struggling to recognize my intent. I Am trying to catch a phone number.

Any ideas why it’s ambiguous here ?
What’s the best way to train with phone number ?

Thx

Hi @Ozenne,

Can you please export your bot and send it to me? My adress is francois.levasseur@botpress.com.

Merci :),

François

Hello @frank_levasseur and thx for your help.

unfortunately, for several reasons i can’t make this bot public. Is there no other ways to debug this ?

Thx :slightly_smiling_face:

.

No problem, I just wanted to save a few minutes recreating your use case!

Ok, so your problem is that the NLU cannot predict the intention of giving your phone number. This is because there is no natural language in your utterances.

Slots must be tought as parameters of intentions and intentions can only be predicted if they contain utterances with text.

Thereby, ou have two options:

  1. You add text to your utterances. It should look something like this: “My phone number is 450 444-1919” (make sure to indicate the slot).

  2. Rather than filling a slot, you check if an entity has been extracted with the correct type.

My solution works like this:

Where extract-phone is an action with the following content:

function action(bp: typeof sdk, event: sdk.IO.IncomingEvent, args: any, { user, temp, session } = event.state) {
  /** Your code starts below */

  /**
   * Small description of your action
   * @title Extract Phone
   * @category Custom
   * @author François
   */
  const myAction = async (name, value) => {
    const phoneEntities = event.nlu.entities.filter(e => e.name === 'phone-number')
    if (phoneEntities.length) {
      const entity = phoneEntities[0]
      user.phone = entity.data.value
    }
  }

  return myAction(args.name, args.value)

  /** Your code ends here */
}

If I think of something else, I’ll let you know but for now, theses are my solutions.

Hope this helps,

François

1 Like

I used your first solution and it work very well now.

Thank you very much for your help :slightly_smiling_face:

1 Like