Extract free text from user input and correctly classify the entity

I’m developing a home assistant chatbot and I have an intent called “send_notification” that should capture the text of the reminder (or alarm, in my case). Example phrase:

  • send me a notification to [remind](notification_mode) me to [buy milk](text)
  • send an [alarm](notification_mode) that says [the door is open](text)

The problem concerns the entity text that despite countless training phrases, is not recognized during usage. I have also tried defining the entity as a regex that captures everything enclosed in quotation marks (adapting the training phrases), but again the entity value is always “cut off”. It also happens when the relative form is active and requests for the slot.

For example:

→ user: send me a reminder

→ bot: What is the text of the reminder?

→ user: “remember to buy milk”

In this case, the NLU extract only “remember to” or “to buy” and so on, the same happens if the user put the text inside the first input (e.g., send me a reminder to “buy milk”).

How can I fix it? And would be also nice if the user did not have to put the text in quotation marks.

Moreover, if the text inserted during the slot filling match any other declared intent, the model switch from asking for the slot to triggering the intent represented by the user message that should be the text of the notification. For example:

→ user: send me a reminder

→ bot: What is the text of the reminder?

→ user: “remember to switch off the lights!”

Model deactivate current form loop and trigger the intent “set_light_state” where training phrases like “switch off the kitchen light” are present.

Thanks,

Simone

Here are a few suggestions that may help you improve the entity recognition:

Provide more training data: It’s possible that your model needs more examples to learn how to identify the reminder or alarm text accurately. Try adding more training phrases that include different variations of the reminder or alarm text to your dataset.

Use entity roles: Instead of using just one entity type for both the notification mode and the text, try using two different entity roles. For example, you could define one entity role as “notification_mode” and another entity role as “reminder_text”. This will allow you to capture both the mode of the notification (e.g., reminder, alarm) and the text of the reminder separately.

Use entity synonyms: You can try defining synonyms for your entity text, which can help the model recognize different variations of the same text. For example, you could define synonyms for “buy milk” such as “purchase milk”, “get milk”, or “grab milk”.

Use conditional logic: If the model is not able to extract the full reminder or alarm text, you could use conditional logic to prompt the user to provide more information. For example, you could ask the user, “Can you please provide more details about the reminder?” and provide some examples of the information you need.

Hello @simog,

I think the solution is to use a from_text slot. Go to your domain file and declare your slot as follows:

slot_name:
    type: text
    mappings:
    - type: from_text
      intent: null
      conditions:
      - active_loop: your_form
        requested_slot: slot_name

This will allow you to fill the slot slot_name with the user’s input (from_text) regardless of the intent detected with this input (intent:null), on the unique condition that the your_form form is active and the slot slot_name is requested.