Patent ID: 11954449
Assignee: BEIJING BAIDU NETCOM SCIENCE TECHNOLOGY CO., LTD.
Field: Computer technology (Electrical engineering)
Classification: CPC G  Y | IPC G

Claim 0:
1. A method for generating a conversation, comprising:
obtaining a current conversation and historical conversations of the current conversation;
selecting a plurality of reference historical conversations from the historical conversations and adding the plurality of reference historical conversations to a temporary conversation set; and
generating reply information of the current conversation based on the current conversation and the temporary conversation set;
wherein the current conversation is represented by rt, the historical conversations are represented by r1, . . . , rt-1, t represents a current time point, and selecting the plurality of reference historical conversations from the historical conversations and adding the plurality of reference historical conversations into the temporary conversation set comprise:
selecting conversations rt-w, . . . , rt-1 from the historical conversations based on a first preset number w, and adding the conversations rt-w, . . . , rt-1 to the temporary conversation set; and
selecting a plurality of conversations from the conversations r1, . . . , rt-w-1 based on a selection strategy model, and adding the plurality of conversations selected from the conversations r1, . . . , rt-w-1 to the temporary conversation set, wherein a maximum number n of conversations in the temporary conversation set is greater than w;
wherein generating the reply information of the current conversation based on the current conversation and the temporary conversation set comprises:
inputting the current conversation and the temporary conversation set into a generation model to generate the reply information;
wherein a training process of the generation model and the selection strategy model comprises:
obtaining a plurality of sample data, the sample data comprising a sample conversation and sample history conversations;
adding random disturbance distribution to the selection strategy model;
inputting each sample data into the selection strategy model and the generation model respectively to obtain a prediction probability of the sample conversation outputted by the selection strategy model and reply information of the sample conversation outputted by the generation model;
performing coefficient adjustment on the generation model based on the reply information of the sample conversation and a loss function of the generation model; and
performing coefficient adjustment on the selection strategy model based on the loss function, the prediction probability of the sample conversation and a target function of the selection strategy model.