botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
78 stars 87 forks source link

NLU: Slot filling not using entity regex #1621

Open coatesap opened 2 years ago

coatesap commented 2 years ago

When you have an utterance that uses a slot that is linked to an entity using a regex, the regex is seemingly ignored for the purposes of slot filling.

To Reproduce

  1. Create an entity called job with the regex ^\s*([a-zA-Z-']+\s*){1,3}$ (any 1 - 3 words)
  2. Create an intent called job_pay, with an utterance like how much do vets get paid and tag vets as a slot linked to the job entity
  3. Train the bot and try a phrase like how much do train drivers get paid. The slot will be incorrectly filled with train, even though we've specified our slot can contain 1 - 3 words

Note: To reproduce, you'll need to add an extra 2 related utterances in order for NLU to kick in (see screenshot below for suitable examples)

botpress-nlu-intent

The same probably also exists when using 2 words in the utterance, and 1 word in the message to the bot, except the slot won't be filled at all.

Expected behavior The NLU slot filling should take the entity regex into account, and not make us repeat the same utterance 3 times to allow 1 - 3 words in the slot.