Answers.Body: <p>You would need to keep track of the current topic, and references. So, for example, a query <em>When is the next train from London to Birmingham?</em> would result in</p>
  
  <ul>
  <li>topic = TRAIN_TRAVEL</li>
  <li>start-loc = London</li>
  <li>destination-loc = Birmingham</li>
  </ul>
  
  <p>A follow-up <em>And what about Bristol?</em> would then replace <em>destination-loc</em> with "Bristol" and you would be able to build a new query from that.</p>
  
  <p>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. </p>
  
  <p>UPDATE: Just to add how that would work from a technical point of view. The input <em>And what about Bristol?</em> 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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T12:51:49.310Z
Answers.Text: 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?
Answers.UserDisplayName: Praharsh Bhatt
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T13:13:55.110Z
Answers.Text: 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).
Answers.UserDisplayName: Oliver Mason
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T11:00:22.667Z
Answers.LastActivityDate: 2018-04-30T07:38:58.637Z
Answers.LastEditDate: 2018-04-30T07:38:58.637Z
Answers.UserDisplayName: Oliver Mason
Body: <p>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- <a href="https://www.youtube.com/watch?v=xYRENGuwwCA" rel="nofollow noreferrer">https://www.youtube.com/watch?v=xYRENGuwwCA</a></p>
  <p>Can anyone guide me or hint how to design the algorithm?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2022-05-10T07:54:49.823Z
Comments.Text: 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.
Comments.UserDisplayName: nbro
Tags: <natural-language-processing><reference-request><ai-design><algorithm-request><intelligent-personal-assistants>
Title: How to add contextual follow up like Google Assistant
UserDisplayName: Praharsh Bhatt
ThreadText: # How to add contextual follow up like Google Assistant
  
  (Asked by: username_0 on 2018-04-25)
  
  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?
  
  **Tags:** natural-language-processing, reference-request, ai-design, algorithm-request, intelligent-personal-assistants
  
  > **Comments:**
  > **username_1**: 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.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-04-27. Score: 2 | Accepted answer
  
  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.
  
  > **Comments:**
  > **username_0**: 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?  
  > **username_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).  
  
  ---
  
  