0

Wit.ai 'Understanding' tab allows us to train phrases for different intents (trait entities). However it is not clear how to train for the same phrase but in different contexts.

For example the phrase "Yes" may be used as the answer for different questions but depending on context it's intent may vary.

  • "Want to buy milk?" -> Yes (means my positive intention to buy milk)
  • "Should I send you receipt?" -> Yes (now the intent is to allow sending receipt)
A.N
  • 46
  • 4

2 Answers2

1

You will have to add a couple of examples for the Yes and No before Wit can get it. Go to the Undestanding section to do that.

enter image description here

Also you should handle Yes/No Answers in Stories tab with flow-based approach.

Please look at the Handle yes/no answers subheading in https://wit.ai/docs/recipes#converse-link. You will find that example very helpful probably.

Have a nice day.

gokcand
  • 6,694
  • 2
  • 22
  • 38
  • Thank you @GokcanD for you answer! But my problem actually was not to understand properly Yes and No variations but rather to predict the right action to call for same "Yes" answer but in different contexts. For example if user agreed to buy milk then bot says "Here is your milk" but when user agreed to get receipt by typing same "Yes" answer bot now will say "Here is your receipt". Wit may really confuse both of these Yes answers. – A.N Feb 17 '17 at 07:48
0

I faced this problem a while back.

I trained the phrase "Yes" to have intent as refer_back. This basically means that every time user says "yes", wit is telling my back end to refer to the last message (the question) the bot sent.

Now, that question was obviously written by you (for the bot to ask), so you can mark the question with an ID to identify what the user has said Yes to.

switch (lastQuestion.id) {
   case 1: getSomeMilk(); break;
   case 2: ...
}

Of course, this only works if you have a custom back end that makes API calls to wit and handles user interactions.

This strategy has worked quite well for me and hopefully can give you some ideas.

Raghav Dua
  • 26
  • 1
  • 5
  • Yes it makes sense. So it turns out that you accumulate all incoming wit messages (to label them) and store them within the session. Right? So I see that unfortunately we need to do some sort of these additional backend processings. Thank you @user3794496 – A.N Feb 17 '17 at 07:34
  • @A.N yeah so you need some way to keep track of which question the response is for, so a little extra work is there. You're welcome! – Raghav Dua Feb 17 '17 at 09:02