I am developing PDA like Google assistant on Android. So far, so good. But now, I want to add contextual follow up like Google assistant so it can keep the train of thought. As demonstrated here- https://www.youtube.com/watch?v=xYRENGuwwCA

Can anyone guide me or hint how to design the algorithm? Thank you very much!


You would need to keep track of the current topic, and references. So, for example, a query When is the next train from London to Birmingham? would result in

  • topic = TRAIN_TRAVEL
  • start-loc = London
  • destination-loc = Birmingham

A follow-up And what about Bristol? would then replace destination-loc with "Bristol" and you would be able to build a new query from that.

The key issues here are the set of topics your assistant will be able to handle, and the relevant object slots. You might also want to clear the topic variable after the next input or so to avoid having it still hanging around even though the user no longer talks about that particular topic.

UPDATE: Just to add how that would work from a technical point of view. The input And what about Bristol? would not be recognised as any known intent, as it is too unspecific. As a fallback your Assistant then takes the last topic, and interprets the input in the light of that context. So here we assume that the intent is 'train travel', as that is the last thing the user spoke about. This will of course not always work, but should sort out the majority of cases.

  • $\begingroup$ Thank you very much for the answer. Just the issue is, there can be infinitely many topics for the user to ask. And sure, many topics can be added in a similar way but is it possible to develop an algorithm that breaks down questions starting from "how" or "what" into words, which can be saved into variables and then processed as you showed above? $\endgroup$ – Praharsh Bhatt Apr 27 '18 at 12:51
  • 2
    $\begingroup$ I'm afraid this is probably not possible. I work professionally with dialog systems, and that is how we do it. Infinite topics are not really feasible, especially if you're doing it all by yourself. You would need a lot of information to recognise that "Bristol" is a city (could also be a football club), and that you are talking about travel (but then you're got limited topics again). $\endgroup$ – Oliver Mason Apr 27 '18 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.