0

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?

nbro
  • 39,006
  • 12
  • 98
  • 176
Praharsh Bhatt
  • 221
  • 1
  • 6
  • Please, next time, do a little bit of research on the question/problem you have before asking a question and tell us what you found. – nbro May 10 '22 at 07:54

1 Answers1

2

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.

Oliver Mason
  • 5,322
  • 12
  • 32
  • 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? – Praharsh Bhatt Apr 27 '18 at 12:51
  • 2
    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). – Oliver Mason Apr 27 '18 at 13:13