[NLU] Intent for keyword search

Hello,

I’m looking for a component or an other method to create an intent used for searching documents with few keywords (1-5 words).
But I have already some stories, intents and the keywords are messing with the NLU.
My problem is those keywords can be very varied and interfere with other intents.

I have seen component like KeywordIntentClassifier, but with this warning :
This classifier is intended only for small projects or to get started.
And I don’t find it very intuitive to ask users to type a predefined word to perform a task.

Does someone has a workaround or some ideas to solve my problem ?

Hi @JosephCHS you can try using spacy. The following link can help you

I probably misunderstood something.

But for me spacy is a pre-trained model that allows you to detect entities without the need of training, like for localization with “LOC”.
The example you show me allows, if I understand correctly, to customize spacy and create a new category?

My problem is to detect the “keyword search” intent and then to retrieve the whole user’s sentence and not to extract a few words, in order to make a search in my algolia database.

Hi Joseph,

It’s hard to give detailed advice without looking at the intents but we do something like this our rasa-demo bot Sara. We create fairly generic intent, for this bot, it’s called technical_question where we try to capture general questions not handled by the bot. We then use the TwoStageFallback intent to ask for clarification and invoke a action that does an algolia search of our docs.

Greg

Hi Stephens,

Thanks for the hints!

Here is my nlu file: nlu.md (12.2 KB)

I’d recommend you do a form that requires a search_text slot. With an intent something like this:

## intent:search
- search [Activité physique Endurance]{"entity":"search_text","value","Activité physique Endurance"}
- i want to do a search

If the value is not set in the form, you would ask the user what they want to search on. The form would fill the slot with the text based on any of a number of intents (a general inform intent is most common). Here’s an example of a slot_mapping where the value can come from multiple intents including setting the slot with the entire utterance - self.from_text(intent="enter_data").

Greg

1 Like

Hi Greg,

I’m a bit confuse about one thing.

As the the domail.yml of sara-demo suggests, the intent enter_data doesn’t use any entities

 - enter_data:
   use_entities: []

But in the story step1_get_started.md (line 696)

## enter_data{"language":"english"}
* slot{"language": "english"}

We can see that the intent enter_data use the entity language and store the result english in a slot.
Does’nt this go against the Rasa documentation ?

If you want all entities to be ignored for certain intents, you can add the use_entities: []