CPC G06F 40/35 (2020.01) [G06F 11/3438 (2013.01); G06F 16/3325 (2019.01); G06F 16/3329 (2019.01); G06F 18/22 (2023.01); G06F 40/279 (2020.01)] | 14 Claims |
1. A method for generating a response, comprising:
obtaining a current user request in a current conversation from information input by a user in a current conversation box through an electronic device and historical coreference information in the current conversation from a server;
extracting content matching the current user request from the historical coreference information;
updating the current user request based on the content to obtain an updated current user request; and
generating a response of the current user request based on the updated current user request;
wherein the historical coreference information comprises one or more historical user requests triggering coreference, and a plurality of coreference options corresponding to each historical user request,
wherein extracting the content matching the current user request from the historical coreference information, comprises:
when the current user request comprises an entity represented by an ordinal number, obtaining sequentially, in order of time from nearest to far, a historical user request from the historical coreference information as a to-be-processed historical user request;
removing the entity represented by the ordinal number and a meaningless word from the current user request to generate a rewritten current user request;
determining a second similarity of the rewritten current user request and the to-be-processed historical user request; and
taking the to-be-processed historical request whose second similarity satisfies a second similarity threshold as the content matching the current user request;
wherein, extracting the content matching the current user request from the historical coreference information, further comprises:
when there is no to-be-processed historical request whose second similarity satisfies the second similarity threshold, determining whether the current user request satisfies a preset coreference inheritance condition;
when the current user request satisfies the preset coreference inheritance condition, taking a historical user request closest to a current time point in the historical coreference information as the content matching the current user request; and
when the current user request does not satisfy the preset coreference inheritance condition, determining that there is no content matching the current user request.
|