Adding intents vs adding entities

rasa-nlu

(Einar Bui Magnusson) #1

I am creating a bot for the user to get info about their next/last meeting/email/phonecall. I already have an intent called MyNextMeeting, handling questions such as “what’s my next meeting?”. For moving forward, is there a general consensus about which is better:

  • Add an intent for each distinct action, i.e. MyNextMeeting, MyLastMeeting, MyNextPhonecall, MyLastPhonecall, MyLastEmail
  • One intent (e.g. GetActivity) and add two new entity types (activity_type (email/phonecall/meeting) and e.g. temporality (next/last)
  • Or something in between (e.g. intents GetNextActivity/GetLastActivity)

I feel a bit weird about extracting entities that are quite far from being actual named entities… but it could easily be done with simple phrase matching.

[Edit] Any thoughts on this? Or is it just down to testing which way works best in each case?


(Shota) #2

I would most probably go for single intent/multi-entity option and here’s why: if I understood your question correctly, the structure of the question will be mostly the same, but only the “type” of the next event will be different. Said that, if you will go with different intents, you will get very similar intents where the only difference is the event type + obviously you have some back-end code which then works on some logic, so you will have mostly similar code in the back, with again difference in the event type. This means retraining more intents, (say you added 5 new examples of meeting intent, you have to do same for all others), having more code in the back-and and most probably more bugs :bug:

While with single intent/multiple entities, you will have one intent to train, examples will be same, back-end code will be the same and the only branching-point of the business logic will be event type. It’s way simpler and effective in my personal oppinion.


(Einar Bui Magnusson) #3

Yes, there are benefits to going the single intent/multiple entities way. After some thought, that approach turned out not to be feasible for our case, because one could either ask “when was my last meeting with X” or “when did I last meet X” or “when did I last see X”, so the sentence won’t always contain the word “meeting”. It may be possible to use synonyms and train for each of these, but I feel it’s a bit weird to mix up nouns and verbs…


(Akela Drissner) #4

I’d say the activity type can definitely be an entity. As for next/last - this you could define in separate intents, so I’d go for the “something in between” approach. What pipeline are you using with NLU so far? I suspect spacy might have some problems distinguishing these intents. Tensorflow should work fine though, as long as you have enough data