US 12,086,555 B2
Method for generating dialogue, electronic device, and storage medium
Jianglu Hu, Beijing (CN); Hehan Li, Beijing (CN); Huifeng Sun, Beijing (CN); Shuqi Sun, Beijing (CN); Yue Chang, Beijing (CN); Tingting Li, Beijing (CN); Hua Wu, Beijing (CN); and Haifeng Wang, Beijing (CN)
Assigned to BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD., Beijing (CN)
Filed by BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD., Beijing (CN)
Filed on Dec. 7, 2021, as Appl. No. 17/643,053.
Claims priority of application No. 202110000726.5 (CN), filed on Jan. 4, 2021.
Prior Publication US 2022/0215180 A1, Jul. 7, 2022
Int. Cl. G06F 40/35 (2020.01); G06F 16/332 (2019.01)
CPC G06F 40/35 (2020.01) [G06F 16/3329 (2019.01)] 16 Claims
OG exemplary drawing
 
1. A method for generating a dialogue, comprising:
obtaining an input sentence;
determining a type of a task-based response sentence that is to be generated, by updating a current dialogue state based on the input sentence;
generating the task-based response sentence by inputting the input sentence into a task-based dialogue response generator;
determining the task-based response sentence as a target response sentence in response to the type of the task-based response sentence being a designated type;
determining an intention of the input sentence in response to the type of the task-based response sentence being not the designated type; obtaining N previous response sentences adjacent to the input sentence from historical dialogues in response to the intention of the input sentence being not a chat intention, where N is a positive integer; and generating a current target response sentence based on the N previous response sentences;
generating a chat-based response sentence by inputting the input sentence into a chat-based dialogue response generator;
obtaining the historical dialogues in response to the intention of the input sentence being the chat intention;
determining a moment of chat ending based on the historical dialogues, the chat-based response sentence and the input sentence; and
when a current moment is the moment of chat ending, generating the current target response sentence based on the chat-based response sentence and a previous task-based response sentence adjacent to the input sentence in the historical dialogues.