Answers.Body: <p>What you want to look for is called <a href="https://en.wikipedia.org/wiki/Anaphora_(linguistics)#Anaphora_resolution_%E2%80%93_centering_theory" rel="nofollow noreferrer">anaphora resolution</a>. You basically keep a record of the past conversation and try and find an antecedent for any occurrences of <em>it</em>, <em>he/she</em>, <em>her/his</em>, etc. You probably want to have a pre-processing step where you substitute the antecedent before passing the input sentence on to the agent.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-09-20T08:22:48.163Z
Answers.LastActivityDate: 2021-09-20T08:22:48.163Z
Answers.UserDisplayName: Oliver Mason
Body: <pre><code>User: What is the tallest mountain?
  Agent: Everest
  User: Where is it located? # Agent hears: &quot;Where is Everest located?&quot;
  Agent: Nepal
  </code></pre>
  <p>I want to be able to generate a sequence that has been generated using the user's current query as well as the past conversation.</p>
  <p>More specifically, I am using Google's T5 for closed-book question answering, but, instead of trivial questions, we use the user's frequently asked queries.</p>
  <p>I want to be able to encode their past questions and the agent's past answers, then use them to generate the agent's next answer. How can I do that?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2021-09-20T13:00:01.597Z
Comments.Text: Hello. I edited your post. Please, make sure I didn't change its meaning. In particular, I added this part "we use the user's frequently asked queries.", because what you had originally written wasn't clear (at least to me).
Comments.UserDisplayName: nbro
Tags: <natural-language-processing><python><transformer><question-answering>
Title: How to generate a response while considering past questions as well?
UserDisplayName: angryweasel
ThreadText: # How to generate a response while considering past questions as well?
  
  (Asked by: username_0 on 2021-09-20)
  
  ```
  User: What is the tallest mountain?
  Agent: Everest
  User: Where is it located? # Agent hears: "Where is Everest located?"
  Agent: Nepal
  
  ```
  
  I want to be able to generate a sequence that has been generated using the user's current query as well as the past conversation.
  
  More specifically, I am using Google's T5 for closed-book question answering, but, instead of trivial questions, we use the user's frequently asked queries.
  
  I want to be able to encode their past questions and the agent's past answers, then use them to generate the agent's next answer. How can I do that?
  
  **Tags:** natural-language-processing, python, transformer, question-answering
  
  > **Comments:**
  > **username_1**: Hello. I edited your post. Please, make sure I didn't change its meaning. In particular, I added this part "we use the user's frequently asked queries.", because what you had originally written wasn't clear (at least to me).  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2021-09-20. Score: 1
  
  What you want to look for is called [anaphora resolution](https://en.wikipedia.org/wiki/Anaphora_(linguistics)#Anaphora_resolution_%E2%80%93_centering_theory). You basically keep a record of the past conversation and try and find an antecedent for any occurrences of *it*, *he/she*, *her/his*, etc. You probably want to have a pre-processing step where you substitute the antecedent before passing the input sentence on to the agent.
  
  
  ---
  
  