Why would one want multi-intent?

Hey! So I learned today about Multi-intents and how you enable them in pipeline. But I don’t understand why you would want to have two intents joined by a symbol such as “+”. Does it have a significant purpose?

Thanks for your time!

1 Like

@BrookieHub Nice question.

I guess you know these pipeline’s already ?

TensorFlow-based pipeline:

- name: "CountVectorsFeaturizer"
- name: "EmbeddingIntentClassifier"
  intent_tokenization_flag: true
  intent_split_symbol: "+"

Explination: By setting the flag intent_tokenization_flag: true , we tell the model that we want to split intent labels into tokens which means that the model will know which intents are multi-intents, and with intent_split_symbol we define which character should be used to make a split, which in this case is a + .

Significance of “+” is use to differentiate or split the two intents.

WhitespaceTokenizer pipeline: Ref: Components

- name: "WhitespaceTokenizer"
  # Flag to check whether to split intents
  "intent_tokenization_flag": true
  # Symbol on which intent should be split
  "intent_split_symbol": "_"
  # Regular expression to detect tokens
  "token_pattern": None

Multiple Intents

If you want to split intents into multiple labels, e.g. for predicting multiple intents or for modeling hierarchical intent structure, use these flags:

  • intent_tokenization_flag if true the algorithm will split the intent labels into tokens and use bag-of-words representations for them;
  • intent_split_symbol sets the delimiter string to split the intent labels. Default _


NLU training data

What does the training data look like for models using the TensorFlow pipeline? Not that different from the regular approach - the only addition is that we have to add examples of multi-intent inputs and assign them the corresponding multi-intent labels. Below I have a snippet of training data which I am going to use to train the NLU model (check the data/nlu_data.md file). As you can see, I have some regular examples with one intent per input as well as examples which have multiple intents assigned. For example, the input “Can you suggest any cool meetups in Berlin area?” has only one intention - the user asks for meetup recommendations, that’s why it has a single intent assigned to it. On the flipside, the input “Sounds good. Do you know how I could get there from home?” means two things - confirmation that a user wants to join the meetup and a query about the transport to get to the venue, and this is why such examples have a combined affirm+ask_transportintent.

## intent: meetup
- I am new to the area. What meetups I could join in Berlin? 
- I have just moved to Berlin. Can you suggest any cool meetups for me?

## intent: affirm+ask_transport
- Yes. How do I get there?
- Sounds good. Do you know how I could get there from home?

Reference link for more details : How to Handle Multiple Intents Using Rasa NLU TensorFlow Pipeline | The Rasa Blog | Rasa

I hope this will clear your doubt ?


Thanks for the explanation! I understand now.