Trigger intent by any free text

Hi, I need to create and intent which could be triggered by free text or pre-trained entity. For example, ner_spacy recognize names as PERSON entity. If user says Katty, this name should trigger intent. Or is it possible to create a intent which can capture free text. Same as @sys.any in dialogflow?

I’d suggest you create a generic intent called inform, where the user can provide any sort of information to the bot

Well this is exactly my question, how I can create such generic intent? It is not clear and I didn’t found in documentation. I would be very happy if someone can point me where I can look. Obviously I can’t train against any possible phrase… In dialogflow I can use build in entity called @sys.any which allows to trigger intent using any free text.

Rasa Demo bot is achieving this and you can see nlu examples here: rasa-demo/ at master · RasaHQ/rasa-demo · GitHub

Look for “intent:enter_data”

But still I have to train intent, right?

As @Kirill asked. Is there any way we don’t have to train generic intent(which is used to accept free text) like @sys.any which allows triggering intent using any free text.

No, you have to train a generic intent as of now. This is because it’s not quite clear how to deal with an any intent when it comes to training the core model

I was able to use free text input by starting a form and just setting the slot to whatever the text was!

<inside validation>
# add input to slots regardless of intent or entity
elif slot_to_fill in self.required_slots():
    validated_events.append(SlotSet(slot_to_fill, tracker.latest_message['text']))


Can you please share file so that things could be clear to me. I would like to know how the flow would be in story in this case.

Hi @Kirill @Christiaanben! can you please elaborate on how you were actually able to use free text? maybe share some snippets of the particular action and stories. Did you also create an intent for the free text?

It would be really helpful for me if i get these answers. Thanks in advance! :slight_smile:

Hi @Christiaanben , Please elaborate the process. Give me the example.

1 Like

hey Chaitanya, you will need to implement a form in rasa to get any free text as an input. See the formbot example of rasa and analyze how the feedback is being taken from the user ( in ).

You’ll know exactly what to do.

Hi sorry for being absent. Here is a snippet for making this work:

class CustomForm(FormAction):
    def validate(self, dispatcher, tracker, domain):
        validated_events = []
        slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
        user_text = tracker.latest_message['text']
        if slot_to_fill in self.required_slots():
            validated_events.append(SlotSet(slot_to_fill, user_text))
        return validated_events