How to include different types of labels for a given text?

How to annotate data in nlu.md such that for a single text/message I have multiple independent labels? I want to have intent and sentiment both for a give message and train two different models: intent classification and sentiment classification.

How might I achieve this?

## intent: scold && good
 - dude, what went wrong with the experiment?

## intent: scold && bad
 - dude, how in the f you mess up the experiment? 

As you can see, I want to annotate a single message with multiple labels to train multiple models.

I am guessing the solution might look something like this:

## intent: scold
 - dude, what went wrong with the experiment?
 - dude, how in the f you mess up the experiment? 

## sentiment: good
 - dude, what went wrong with the experiment?

##sentiment: bad
 - dude, how in the f you mess up the experiment? 

and then in the train method of the intent classifier and sentiment classifier components, do:

example.get("intent")

and

example.get("sentiment")

to get the respective labels.

  1. Is this possible?
  2. There is duplication of data, and the size of nlu.md might increase. Is there easier way to do this?

Also, if the proposed solution is indeed possible, what identifier am I not allowed to use? (because they are reserved by rasa)

## {IDENTIFIER} : label

I know that the IDENTIFIER can’t be : synonym, lookup, regex. What other IDENTIFIERs are reserved?

@akelad

Hey @psds01 - any reason you couldn’t use multi-intents? How to handle multiple intents per input using Rasa NLU TensorFlow pipeline

Hey @amn41, because in my case, scold is the intent of the user message and the sentiment of that does not affect my next action.

I just want to add sentiment to the Message to understand my demographics better: are they abusing bot? how often? what population? I understand that this can be done offline but I want to stop conversing if I get abusive content.

@psds01 since this is custom functionality, it would be up to you to implement that how you want. We don’t support sentiment analysis by default

1 Like

Already done, thanks @akelad :slight_smile:

1 Like