CPC G06F 40/35 (2020.01) [G06F 16/3329 (2019.01)] | 16 Claims |
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.
|