Dialogue generation method and device, equipment and medium

By finding matching background knowledge text from the background knowledge base and performing combined feature extraction, the problem of inaccurate reply by traditional chatbots is solved, and the accuracy and compliance of conversation reply is improved.

CN118916449APending Publication Date: 2024-11-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310512948.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-08
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

When traditional chatbots respond to conversations, the feedback content often does not meet user expectations, resulting in low accuracy of conversation responses.

Method used

By obtaining the input conversation topic text, find matching target background knowledge text from the pre-constructed background knowledge base, combine text for feature extraction, and reply prediction based on semantic features to improve the accuracy of the reply.

Benefits of technology

It improves the accuracy of conversation replies, making the reply content more in line with user expectations and topic background.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916449A_ABST
    Figure CN118916449A_ABST
Patent Text Reader

Abstract

The invention relates to a dialogue generation method and device, equipment and a medium, and more relates to a network media technology and an artificial intelligence technology. The method comprises the steps of obtaining an input dialogue topic text; searching a pre-constructed background knowledge base for a target background knowledge text matched with the dialogue topic text; the target background knowledge text represents a topic background generated by the dialogue topic text; combining the target background knowledge text with the dialogue topic text to obtain a combined text; performing feature extraction on the combined text to obtain semantic features of the combined text; and performing reply prediction according to the semantic features of the combined text to obtain a dialogue reply text which corresponds to the dialogue topic text and conforms to the topic background. By adopting the method, the dialogue reply accuracy can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to network media technology, and in particular to a dialogue generation method, device, equipment and medium. Background Art

[0002] With the development of computer technology, many scenarios require intelligent feedback and responses to input text, such as chatbots. Chatbots are computer programs that communicate through dialogue or text input by objects and can simulate human dialogue. In other words, chatbots are programs used to simulate human dialogue or chat. Chatbots can be used in many industries, greatly improving people's work efficiency and providing convenience to people's lives. For example, chatbots can be used in related fields and businesses such as customer service or information acquisition.

[0003] In traditional technology, the subject usually inputs the question text, and the subject that implements the feedback will generate answer information based on the directly input question text and feed it back to the subject. The content of the reply often does not meet the expectations of the subject, resulting in low accuracy of the dialogue response. Summary of the invention

[0004] Based on this, it is necessary to provide a dialogue generation method, device, equipment and medium that can improve the accuracy of dialogue responses in response to the above technical problems.

[0005] In a first aspect, the present application provides a method for generating a dialogue, the method comprising:

[0006] Get the input conversation topic text;

[0007] Searching for a target background knowledge text that matches the dialogue topic text from a pre-built background knowledge library; the target background knowledge text represents the topic background generated by the dialogue topic text;

[0008] Combining the target background knowledge text with the dialogue topic text to obtain a combined text;

[0009] Extracting features from the combined text to obtain semantic features of the combined text;

[0010] Reply prediction is performed based on the semantic features of the combined text to obtain a dialogue reply text that corresponds to the dialogue topic text and conforms to the topic background.

[0011] In a second aspect, the present application provides a dialogue generation device, the device comprising:

[0012] An acquisition module is used to obtain the input conversation topic text;

[0013] A search module is used to search for a target background knowledge text that matches the dialogue topic text from a pre-built background knowledge library; the target background knowledge text represents the topic background generated by the dialogue topic text;

[0014] A combining module, used for combining the target background knowledge text with the dialogue topic text to obtain a combined text;

[0015] An extraction module, used for extracting features from the combined text to obtain semantic features of the combined text;

[0016] The prediction module is used to predict the reply according to the semantic features of the combined text, and obtain the dialogue reply text corresponding to the dialogue topic text and conforming to the topic background.

[0017] In one embodiment, the search module is also used to extract features from the conversation topic text to obtain semantic features of the topic text; determine the feature similarities between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base; and use the background knowledge text corresponding to the background text semantic feature with the maximum feature similarity as the target background knowledge text that matches the conversation topic text.

[0018] In one embodiment, the apparatus further comprises:

[0019] A construction module is used to obtain a first creative text; perform text segmentation on the first creative text to obtain at least one first sub-text, and use each of the first sub-texts as a background knowledge text corresponding to the first creative text; and construct the background knowledge base based on the background knowledge text corresponding to the first creative text.

[0020] In one embodiment, the first creative text is a creative text related to a preset target character; the prediction module is also used to predict a reply based on the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and conforming to the dialogue style of the target character and the topic background.

[0021] In one embodiment, the conversation topic text includes the current topic text input at the current conversation moment; the combination module is also used to obtain historical conversation text; the historical conversation text includes the historical topic text input at the historical conversation moment, and the historical reply text obtained by replying to the historical topic text; the historical conversation moment is at least any conversation moment before the current conversation moment; the target background knowledge text, the historical conversation text and the current topic text are combined to obtain a combined text.

[0022] In one embodiment, the conversation reply text is predicted by a trained conversation model; the device further comprises:

[0023] A training module is used to obtain a dialogue training text; the dialogue training text includes a sample combination text and a reference dialogue reply text; the sample combination text is obtained by combining a sample background knowledge text and a sample dialogue topic text; the sample background knowledge text represents a sample topic background generated by the sample dialogue topic text; the reference dialogue reply text is a dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background; the dialogue model to be trained is iteratively trained through the dialogue training text to obtain a trained dialogue model.

[0024] In one embodiment, the sample conversation topic text includes a first sample topic text; the training module is also used to obtain a first sample historical conversation text; the first sample historical conversation text includes a second sample topic text and a sample reply text obtained in response to the second sample topic text; the conversation time corresponding to the second sample topic text is earlier than the conversation time of the first sample topic text; the sample background knowledge text, the first sample historical conversation text and the first sample topic text are combined to obtain a sample combined text.

[0025] In one embodiment, the training module is also used to obtain dialogue reference information; the dialogue reference information includes a dialogue task description text, the sample dialogue topic text and the sample background knowledge text; referring to the sample dialogue topic text and the sample background knowledge text, the reference dialogue reply text is predicted according to the dialogue task represented by the dialogue task description text.

[0026] In one embodiment, the sample conversation topic text includes a third sample topic text; the conversation reference information also includes a second sample historical conversation text; the second sample historical conversation text includes a fourth sample topic text, and a sample reply text obtained in response to the fourth sample topic text; the conversation moment corresponding to the fourth sample topic text is earlier than the conversation moment of the third sample topic text; the training module is also used to refer to the second sample historical conversation text, the third sample topic text and the sample background knowledge text, and predict the reference conversation reply text according to the conversation task represented by the conversation task description text.

[0027] In one embodiment, the trained dialogue model is a customized dialogue model trained for a preset target role; the dialogue reference information also includes role description information of the target role; the training module is also used to refer to the sample dialogue topic text, the sample background knowledge text and the role description information, and predict the reference dialogue response text that conforms to the dialogue style of the target role according to the dialogue task represented by the dialogue task description text.

[0028] In one embodiment, the training module is also used to obtain topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example dialogue topic text; the example topic description text represents the topic background generated by the example dialogue topic text; obtain the topic description text to be predicted; use the topic description text as the sample background knowledge text, and refer to the example text pair, and according to the topic task represented by the topic task description text, predict the sample dialogue topic text that meets the topic background represented by the topic description text.

[0029] In one embodiment, the trained dialogue model is a customized dialogue model trained for a preset target role; the training module is also used to obtain a second creative text related to the target role; the second creative text is segmented to obtain at least one second sub-text that meets a preset text length, and each second sub-text is used as a topic description text to be predicted.

[0030] In one embodiment, the training module is also used to classify the content of the second creative text to obtain dialogue text content and non-dialogue text content; and perform text segmentation on the dialogue text content and the non-dialogue text content respectively to obtain at least one second sub-text that meets a preset text length.

[0031] In a third aspect, the present application provides a computer device including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps in the method embodiments of the present application are implemented.

[0032] In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the method embodiments of the present application.

[0033] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the steps in the method embodiments of the present application when the computer program is executed by a processor.

[0034] The above-mentioned dialogue generation method, device, equipment, medium and computer program product obtain the input dialogue topic text and search for the target background knowledge text matching the dialogue topic text from the pre-built background knowledge base. Since there are many background knowledge texts stored in the background knowledge base, the background information is very rich. By searching the target background knowledge text matching the dialogue topic text from the background knowledge base, the target background knowledge text represents the topic background generated by the dialogue topic text. By combining the target background knowledge text with the dialogue topic text, a combined text is obtained. The combined text can simultaneously contain the topic that the object of the input dialogue topic text intends to talk about, and the background knowledge related to the input topic. Feature extraction is performed on the combined text to obtain the semantic features of the combined text, and reply prediction is performed based on the semantic features of the combined text, so that a dialogue reply text corresponding to the dialogue topic text and conforming to the topic background can be obtained, thereby improving the accuracy of the dialogue reply. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] Figure 1 An application environment diagram of a dialogue generation method in an embodiment;

[0036] Figure 2 A flowchart of a method for generating a dialogue in one embodiment;

[0037] Figure 3 A network structure diagram of a conversation model in one embodiment;

[0038] Figure 4 is a schematic diagram of conversation reference information in one embodiment;

[0039] Figure 5 is a schematic diagram of topic reference information in one embodiment;

[0040] Figure 6 A flowchart of a method for generating a dialogue in another embodiment;

[0041] Figure 7 is a flowchart of a method for generating a dialogue in yet another embodiment;

[0042] Figure 8 is a structural block diagram of a dialogue generating device in one embodiment;

[0043] Fig. 9 is a structural block diagram of a dialogue generating device in another embodiment;

[0044] Fig.10 is an internal structure diagram of a computer device in one embodiment;

[0045] Fig.11 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0047] The dialogue generation method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, can be integrated on the server 104, or can be placed on the cloud or other servers. Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, cloud security, host security and other network security services, CDN, and basic cloud computing services such as big data and artificial intelligence platforms. The terminal 102 and the server 104 can be directly or indirectly connected by wired or wireless communication, and this application is not limited here.

[0048] The server 104 may obtain the input conversation topic text, and search for a target background knowledge text that matches the conversation topic text from a pre-built background knowledge base; the target background knowledge text represents the topic background generated by the conversation topic text. The server 104 may combine the target background knowledge text with the conversation topic text to obtain a combined text, and perform feature extraction on the combined text to obtain semantic features of the combined text. The server 104 may perform reply prediction based on the semantic features of the combined text to obtain a conversation reply text that corresponds to the conversation topic text and conforms to the topic background.

[0049] It is understood that the terminal 102 can obtain the input conversation topic text and send the conversation topic text to the server 104, and the server 104 can receive the conversation topic text. It is understood that the server 104 can also send the obtained conversation reply text to the terminal 102 for output. This embodiment does not limit this, and it is understood that Figure 1 The application scenarios are only for illustration and are not limited to this.

[0050] It should be noted that the dialogue generation method in some embodiments of the present application uses artificial intelligence technology. For example, the combined text semantic features of the combined text belong to the feature vectors encoded using artificial intelligence technology. And the dialogue reply text also belongs to the text predicted using artificial intelligence technology. In order to make it easier to understand artificial intelligence, the concept of artificial intelligence is now explained. Specifically, artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that the machines have the functions of perception, reasoning and decision-making. This application implements dialogue generation based on artificial intelligence technology, which can further improve the accuracy of dialogue replies.

[0051] In one embodiment, Figure 2 As shown, a method for generating a dialogue is provided. The method can be applied to a computer device, which can be a terminal or a server. The method can be executed by the terminal or the server itself, or can be implemented through interaction between the terminal and the server. This embodiment takes the method applied to a computer device as an example for explanation, and includes the following steps:

[0052] Step 202, obtaining the input conversation topic text.

[0053] The conversation topic text is the text used to describe the topic during the conversation, and the topic refers to the subject of the conversation. To facilitate further understanding of the conversation topic text, an example is given below to illustrate that the conversation topic text may include the conversation question text, which is the text used to describe the question asked during the conversation. For example, the conversation question text may be "Who is Zhang San's father?"

[0054] In one embodiment, the terminal for dialogue can obtain the dialogue topic text input by the object, and send the dialogue topic text to the computer device, so that the computer device can receive the dialogue topic text input by the object. It can be understood that the object can be a user or other dialogue subject other than the user, for example, the object can also be a virtual character that outputs the dialogue topic text.

[0055] Step 204, searching the pre-built background knowledge base for target background knowledge text that matches the dialogue topic text; the target background knowledge text represents the topic background generated by the dialogue topic text.

[0056] The background knowledge base is a database for storing background knowledge texts. Background knowledge texts are texts used to describe background knowledge. It can be understood that background knowledge can be used to represent the core content that the dialogue wants to express. Background knowledge helps to understand the dialogue topic text and thus understand the true intention of the subject to have a dialogue.

[0057] Specifically, a plurality of background knowledge texts are stored in the pre-constructed background knowledge base, and the computer device can search for a target background knowledge text that matches the input conversation topic text from the plurality of background knowledge texts stored in the background knowledge base.

[0058] In one embodiment, a pre-constructed background knowledge base stores a plurality of background knowledge texts and background text semantic features corresponding to each background knowledge text. It can be understood that for each background knowledge text, the background knowledge text and the background text semantic features of the background knowledge text are associated and stored in the background knowledge base, and the background text semantic features of the background knowledge text can be used as a query index for the background knowledge text. Furthermore, after obtaining the input dialogue topic text, the computer device can directly search for a target background knowledge text that matches the dialogue topic text from each background knowledge text stored in the background knowledge base based on the background text semantic features of each background knowledge text in the background knowledge base.

[0059] In one embodiment, a plurality of background knowledge texts are stored in a pre-built background knowledge base. After obtaining the input conversation topic text, the computer device may perform feature extraction on each background knowledge text in the background knowledge base to obtain background text semantic features corresponding to each background knowledge text. Furthermore, the computer device may search for a target background knowledge text that matches the conversation topic text from each background knowledge text stored in the background knowledge base based on the background text semantic features corresponding to each background knowledge text.

[0060] In one embodiment, a pre-constructed background knowledge base stores a plurality of background knowledge texts and candidate conversation topic texts corresponding to each background knowledge text. It is understandable that, for each background knowledge text, the background knowledge text and the candidate conversation topic text corresponding to the background knowledge text are associated and stored in the background knowledge base, and the candidate conversation topic text corresponding to the background knowledge text can be used as a query index for the background knowledge text. Furthermore, after obtaining the input conversation topic text, the computer device can search the background knowledge base for the candidate conversation topic text with the highest similarity to the input conversation topic text, and use the background knowledge text corresponding to the searched candidate conversation topic text as the target background knowledge text that matches the input conversation topic text.

[0061] Step 206, combining the target background knowledge text with the dialogue topic text to obtain a combined text.

[0062] The combined text is a text obtained by combining the target background knowledge text and the dialogue topic text, and the combined text may include both the target background knowledge text and the dialogue topic text. It is understood that the combined text may include both the topic that the subject of the input dialogue topic text intends to talk about, and the background knowledge related to the input topic.

[0063] In one embodiment, the computer device can perform text splicing on the target background knowledge text and the dialogue topic text by using a pre-set separator, and use the text obtained after the splicing as the combined text. It can be understood that the separator is used to separate the target background knowledge text and the dialogue topic text. For example, if the target background knowledge text is "text 1", the dialogue topic text is "text 2", and the separator is "[SEP]", then the combined text obtained after the splicing is "text 1 [SEP] text 2".

[0064] In one embodiment, the conversation includes multiple rounds of conversations corresponding to multiple conversation moments, and the conversation topic text includes the current topic text input at the current conversation moment. The computer device may combine the target background knowledge text matching the current topic text with the current topic text to obtain a combined text. It can be understood that the combined text in this embodiment only includes the current topic text input at the current conversation moment and the target background knowledge text matching the current topic text, and does not include the conversation topic text input at the conversation moment before the current conversation moment, nor does it include the conversation reply text replied at the conversation moment before the current conversation moment.

[0065] Step 208: extract features from the combined text to obtain semantic features of the combined text.

[0066] Among them, the combined text semantic feature is feature information used to characterize the text semantics of the combined text. It can be understood that since the combined text is a text obtained by combining the target background knowledge text and the dialogue topic text, the combined text can contain the target background knowledge text and the dialogue topic text at the same time. Therefore, the combined text semantic feature can simultaneously contain the background text semantic features of the target background knowledge text and the topic text semantic features of the dialogue topic text. The background text semantic feature is feature information used to characterize the text semantics of the background knowledge text. The topic text semantic feature is feature information used to characterize the text semantics of the dialogue topic text.

[0067] Specifically, the computer device may perform feature extraction on the combined text to obtain the combined text semantic features of the combined text. It is understandable that the computer device may perform convolution processing on the combined text and use the features obtained after the convolution as the combined text semantic features of the combined text.

[0068] Step 210, performing reply prediction based on the combined text semantic features to obtain a dialogue reply text that corresponds to the dialogue topic text and conforms to the topic background.

[0069] The dialogue reply text refers to the text obtained by replying to the input dialogue topic text. For example, if the dialogue topic text is "Who is Zhang San's father?", and the target background knowledge text matching the dialogue topic text is "Zhang Xiaoming, male, he and Li Xiaohong are married, and they have a child named Zhang San", then the dialogue reply text corresponding to the dialogue topic text can be "Zhang San's father is Zhang Xiaoming".

[0070] In one embodiment, the computer device may input the combined text semantic features into a trained dialogue model to perform reply prediction based on the combined text semantic features through the trained dialogue model, and output a dialogue reply text that corresponds to the dialogue topic text and conforms to the topic background.

[0071] In the above-mentioned dialogue generation method, the input dialogue topic text is obtained, and the target background knowledge text matching the dialogue topic text is searched from the pre-built background knowledge base. Since there are many background knowledge texts stored in the background knowledge base, the background information is very rich. By searching the target background knowledge text matching the dialogue topic text from the background knowledge base, the target background knowledge text represents the topic background generated by the dialogue topic text. By combining the target background knowledge text with the dialogue topic text, a combined text is obtained, and the combined text can simultaneously contain the topic that the object of the input dialogue topic text intends to talk about, and the background knowledge related to the input topic. Feature extraction is performed on the combined text to obtain the semantic features of the combined text, and the reply prediction is performed based on the semantic features of the combined text, so that a dialogue reply text corresponding to the dialogue topic text and conforming to the topic background can be obtained, thereby improving the accuracy of the dialogue reply.

[0072] In one embodiment, a target background knowledge text that matches a conversation topic text is searched from a pre-constructed background knowledge base, including: extracting features from the conversation topic text to obtain semantic features of the topic text; determining the feature similarities between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base; and using the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the conversation topic text.

[0073] Specifically, the computer device may perform feature extraction on the conversation topic text to obtain the topic text semantic features of the conversation topic text, and obtain the background text semantic features of each background knowledge text in the background knowledge base. Furthermore, the computer device may respectively calculate the feature similarity between the topic text semantic features and the background text semantic features of each background knowledge text in the background knowledge base, determine the background text semantic features with the maximum feature similarity, and use the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the conversation topic text.

[0074] In one embodiment, a plurality of background knowledge texts and background text semantic features corresponding to each background knowledge text are stored in a pre-constructed background knowledge base. It can be understood that for each background knowledge text, the background knowledge text and the background text semantic features of the background knowledge text are associated and stored in the background knowledge base, and the background text semantic features of the background knowledge text can be used as a query index for the background knowledge text. Furthermore, after obtaining the input dialogue topic text, the computer device can perform feature extraction on the dialogue topic text to obtain the topic text semantic features. The computer device can respectively determine the feature similarity between the topic text semantic features and the background text semantic features stored corresponding to each background knowledge text in the background knowledge base, and use the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the dialogue topic text.

[0075] In one embodiment, a plurality of background knowledge texts are stored in a pre-constructed background knowledge base. After obtaining the input conversation topic text, the computer device may perform feature extraction on the conversation topic text to obtain the semantic features of the topic text, and perform feature extraction on each background knowledge text in the background knowledge base to obtain the background text semantic features corresponding to each background knowledge text. Furthermore, the computer device may determine the feature similarity between the extracted topic text semantic features and the extracted background text semantic features, and use the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the conversation topic text.

[0076] In the above embodiment, since the semantic features of the topic text can represent the semantics of the dialogue topic text, and the semantic features of the background text can represent the semantics of the background knowledge text, therefore, by determining the feature similarity between the semantic features of the topic text and the semantic features of the background text, and by using the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the dialogue topic text, the accuracy of the acquired target background knowledge text can be improved, thereby further improving the accuracy of the dialogue response.

[0077] In one embodiment, the method also includes: obtaining a first creative text; performing text segmentation on the first creative text to obtain at least one first sub-text, and using each first sub-text as a background knowledge text corresponding to the first creative text; and constructing a background knowledge base based on the background knowledge text corresponding to the first creative text.

[0078] The creative text refers to a content text obtained through creative labor. For example, the creative text may include at least one of an article, a novel, or a script. The first subtext is at least a part of the text in the first creative text.

[0079] Specifically, the computer device may obtain a first creative text, and perform text segmentation on the first creative text to obtain at least one first subtext. It can be understood that the first creative text includes at least one first subtext, and the text length of the first creative text is greater than the text length of the first subtext. The computer device may use each first subtext in the first creative text as the background knowledge text corresponding to the first creative text, and construct a background knowledge base based on the background knowledge text corresponding to the first creative text.

[0080] In one embodiment, the computer device may extract features from each background knowledge text corresponding to the first creative text to obtain background text semantic features corresponding to each background knowledge text. For each background knowledge text, the computer device may associate and store the background text semantic features corresponding to the background knowledge text with the background knowledge text to obtain a background knowledge library.

[0081] In one embodiment, the first creative text is a creative text related to a preset target role, and the computer device may construct a background knowledge base based on the background knowledge text corresponding to the first creative text related to the target role.

[0082] In the above embodiment, by using each first sub-text in the first creative text as the background knowledge text corresponding to the first creative text and directly constructing a background knowledge base based on the background knowledge text corresponding to the first creative text, the efficiency of constructing the background knowledge base can be improved.

[0083] In one embodiment, the first creative text is a creative text related to a preset target character; a reply prediction is performed based on the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and consistent with the topic background, including: a reply prediction is performed based on the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and consistent with the dialogue style and topic background of the target character.

[0084] Specifically, the computer device may obtain a first creative text related to the target role, and construct a background knowledge base based on the background knowledge text corresponding to the first creative text. The computer device may obtain an input conversation topic text, and search for a target background knowledge text that matches the conversation topic text from a pre-constructed background knowledge base, wherein the target background knowledge text represents the topic background generated by the conversation topic text. The computer device may combine the target background knowledge text with the conversation topic text to obtain a combined text, perform feature extraction on the combined text to obtain a semantic feature of the combined text, and perform reply prediction based on the semantic feature of the combined text to obtain a conversation reply text that corresponds to the conversation topic text and conforms to the conversation style and topic background of the target role.

[0085] In the above embodiment, since the combined text includes the target background knowledge text corresponding to the target role, the reply prediction is performed through the combined text semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and in line with the dialogue style and topic background of the target role. This improves the accuracy of the dialogue reply while also generating a reply that conforms to the customized role, thereby increasing the interest of the conversation.

[0086] In one embodiment, the conversation topic text includes the current topic text input at the current conversation moment; the target background knowledge text is combined with the conversation topic text to obtain a combined text, including: obtaining a historical conversation text; the historical conversation text includes a historical topic text input at a historical conversation moment, and a historical reply text obtained by replying to the historical topic text; the historical conversation moment is at least any conversation moment before the current conversation moment; the target background knowledge text, the historical conversation text and the current topic text are combined to obtain a combined text.

[0087] Among them, the current topic text is the conversation topic text input at the current conversation moment, and the historical topic text is the conversation topic text input at the historical conversation moment. It can be understood that the conversation may include multiple rounds of conversations, each round of conversation corresponds to a conversation moment, and the historical conversation moment is at least any conversation moment before the current conversation moment. The historical reply text is the conversation reply text obtained by replying to the historical topic text. The historical conversation text is the conversation text corresponding to each historical conversation moment during the multi-round conversation process. It can be understood that the conversation text includes the conversation topic text and the conversation reply text obtained by replying to the conversation topic text. The combined text is the text obtained by combining the target background knowledge text, the historical conversation text and the current topic text. It can be understood that the combined text includes the target background knowledge text, the historical conversation text and the current topic text at the same time.

[0088] In one embodiment, the conversation may include multiple rounds of conversations, and the computer device may obtain the historical conversation texts corresponding to each historical conversation moment, and obtain the current topic text input at the current conversation moment. Furthermore, the computer device may combine the target background knowledge text matched by the current topic text input at the current conversation moment, the historical conversation text, and the current topic text input at the current conversation moment to obtain a combined text.

[0089] For example, a conversation may include three rounds of conversation. It can be understood that the first two rounds of conversation are historical conversations, and the third round of conversation is the current conversation, that is, the historical conversation moment is the conversation moment corresponding to the first two rounds of conversation, and the current conversation moment is the conversation moment corresponding to the third round of conversation. The computer device can obtain the historical conversation text corresponding to the first two rounds of conversation, and obtain the current topic text input for the third round of conversation. Furthermore, the computer device can combine the target background knowledge text matched by the current topic text input for the third round of conversation, the historical conversation text corresponding to the first two rounds of conversation, and the current topic text input for the third round of conversation, to obtain a combined text for predicting the reply of the third round of conversation. Furthermore, the computer device can perform feature extraction on the combined text, and perform reply prediction for the third round of conversation based on the extracted semantic features of the combined text, to obtain a conversation reply text corresponding to the current topic text input for the third round of conversation.

[0090] In the above embodiment, a combined text is obtained by combining the target background knowledge text, the historical conversation text and the current topic text, so that the combined text includes not only the current topic text and the corresponding target background knowledge text input at the current conversation moment, but also the historical conversation text corresponding to the historical conversation moment, so that the combined text contains richer information, while taking into account the current input and the historical conversation results, thereby further improving the accuracy of the conversation response.

[0091] In one embodiment, the dialogue reply text is predicted by a trained dialogue model; the method also includes: obtaining a dialogue training text; the dialogue training text includes a sample combination text and a reference dialogue reply text; the sample combination text is obtained by combining a sample background knowledge text and a sample dialogue topic text; the sample background knowledge text represents a sample topic background generated by a sample dialogue topic text; the reference dialogue reply text is a dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background; and the dialogue model to be trained is iteratively trained using the dialogue training text to obtain a trained dialogue model.

[0092] Among them, the dialogue training text is a text used to train the dialogue model to be trained, and the dialogue training text includes a sample combination text and a reference dialogue reply text. The sample combination text is a text obtained by combining the sample background knowledge text and the sample dialogue topic text, and the sample combination text may include the sample background knowledge text and the sample dialogue topic text at the same time. It can be understood that the sample combination text may include the topic that the object that inputs the sample dialogue topic text intends to talk about, as well as the background knowledge related to the input topic. The reference dialogue reply text is a dialogue reply text used as a reference when training the dialogue model to be trained.

[0093] Specifically, the computer device may obtain a conversation training text, and input the conversation training text into the conversation model to be trained, so as to predict a reply based on the sample combination text by the conversation model to be trained, and obtain a predicted conversation reply text. Furthermore, the computer device may determine a training loss based on the difference between the predicted conversation reply text and the reference conversation reply text, and iteratively train the conversation model to be trained based on the training loss to obtain a trained conversation model. The predicted conversation reply text refers to the text obtained by predicting a reply to the input sample conversation topic text.

[0094] In one embodiment, Figure 3 As shown, the dialogue model to be trained includes at least two encoding blocks. The computer device can obtain the dialogue training text and input the dialogue training text into the dialogue model to be trained, so as to predict the response based on each character of the sample combination text (i.e., the sample background knowledge text and the sample dialogue topic text) in the dialogue training text by the dialogue model to be trained, and obtain the predicted dialogue response text composed of the predicted characters. Furthermore, the computer device can iteratively train the dialogue model to be trained based on the difference between the predicted dialogue response text and the reference dialogue response text to obtain the trained dialogue model.

[0095] In one embodiment, the sample background knowledge text, the sample conversation topic text and the corresponding reference conversation reply text in the conversation training text may be manually written.

[0096] In one embodiment, after obtaining the trained dialogue model, the computer device may obtain the input dialogue topic text, and search for the target background knowledge text that matches the dialogue topic text from the pre-built background knowledge library, and the target background knowledge text represents the topic background generated by the dialogue topic text. The computer device may combine the target background knowledge text with the dialogue topic text to obtain a combined text, and input the combined text into the trained dialogue model to perform feature extraction on the combined text through the trained dialogue model to obtain the semantic features of the combined text, and perform reply prediction based on the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and conforming to the topic background. It can be understood that the generated dialogue reply text can conform to the style of any character.

[0097] In the above embodiment, since the dialogue training text used to train the dialogue model to be trained includes a sample combination text and a reference dialogue response text, and the sample combination text is obtained by combining a sample background knowledge text and a sample dialogue topic text, the sample background knowledge text represents the sample topic background generated by the sample dialogue topic text, and the reference dialogue response text is a dialogue response text corresponding to the sample dialogue topic text and conforming to the sample topic background, the dialogue model to be trained is trained by the dialogue training text, and the dialogue response text is predicted by the trained dialogue model, which can further improve the accuracy of the dialogue response.

[0098] In one embodiment, the sample conversation topic text includes a first sample topic text; the method also includes: obtaining a first sample historical conversation text; the first sample historical conversation text includes a second sample topic text and a sample reply text obtained in response to the second sample topic text; the conversation time corresponding to the second sample topic text is earlier than the conversation time of the first sample topic text; and combining the sample background knowledge text, the first sample historical conversation text and the first sample topic text to obtain a sample combined text.

[0099] The first sample topic text and the second sample topic text are the conversation topic texts used in the process of training the conversation model to be trained. The sample reply text is the conversation reply text obtained by replying to the second sample topic text. The sample combination text is the text obtained by combining the sample background knowledge text, the first sample historical conversation text and the first sample topic text. It can be understood that the sample combination text includes the sample background knowledge text, the first sample historical conversation text and the first sample topic text at the same time.

[0100] Specifically, the conversation may include multiple rounds of conversations, and the computer device may obtain the first sample historical conversation text corresponding to the previous conversation moment, and obtain the first sample topic text corresponding to the subsequent conversation moment. It can be understood that the previous conversation moment is the historical conversation moment in the multiple rounds of conversations, and the subsequent conversation moment is the current conversation moment in the multiple rounds of conversations. Furthermore, the computer device may combine the sample background knowledge text matched by the first sample topic text, the first sample historical conversation text, and the input first sample topic text to obtain a sample combined text.

[0101] In the above embodiment, during the training process, the sample background knowledge text, the first sample historical conversation text and the first sample topic text are combined to obtain a sample combined text, so that the sample combined text includes not only the first sample topic text and the corresponding sample background knowledge text input at the current conversation moment, but also the first sample historical conversation text corresponding to the historical conversation moment, so that the sample combined text contains richer information, and the current input and historical conversation results are simultaneously considered during the training process, thereby further improving the accuracy of the conversation responses of the trained conversation model.

[0102] In one embodiment, the method also includes: obtaining dialogue reference information; the dialogue reference information includes dialogue task description text, sample dialogue topic text and sample background knowledge text; referring to the sample dialogue topic text and the sample background knowledge text, and predicting the reference dialogue reply text according to the dialogue task represented by the dialogue task description text.

[0103] The dialogue reference information is the information used in the process of predicting and generating the reference dialogue reply text. The dialogue reference information includes the dialogue task description text, the sample dialogue topic text and the sample background knowledge text. The dialogue task description text is the text used to describe the dialogue generation task. The dialogue generation task refers to the task of predicting and generating the reference dialogue reply text.

[0104] Specifically, the computer device may obtain dialogue reference information including dialogue task description text, sample dialogue topic text, and sample background knowledge text. It can be understood that the dialogue reference information is a format template, and the computing device may fill in the dialogue task description text, sample dialogue topic text, and sample background knowledge text at the corresponding positions in the format template. Furthermore, the computer device may refer to the sample dialogue topic text and sample background knowledge text in the dialogue reference information, and predict the reference dialogue reply text according to the dialogue task represented by the dialogue task description text in the dialogue reference information.

[0105] In one embodiment, the computer device may directly refer to the sample conversation topic text and the sample background knowledge text in the conversation reference information, and predict the reference conversation reply text according to the conversation task represented by the conversation task description text in the conversation reference information. It can be understood that the conversation reference information in this embodiment only includes the conversation task description text, the sample conversation topic text and the sample background knowledge text.

[0106] In one embodiment, Figure 4 As shown, the dialogue reference information may include dialogue task description text 401, sample dialogue topic text (i.e., "What is your husband's name?" asked by a friend in dialogue 404) and sample background knowledge text 403. The computer device may refer to the sample dialogue topic text and the sample background knowledge text in the dialogue reference information, and predict the reference dialogue reply text (i.e., the content answered by Li Si in dialogue 404, for example, the reference dialogue reply text may be "My husband's name is Liu Xiaoming") according to the dialogue task represented by the dialogue task description text in the dialogue reference information.

[0107] In one embodiment, a computer device may obtain dialogue reference information including dialogue task description text, sample dialogue topic text, and sample background knowledge text, and input the dialogue generation reference information into a trained large language dialogue generation model, so as to predict a reference dialogue response text according to the dialogue task represented by the dialogue task description text in the dialogue reference information by referring to the sample dialogue topic text and the sample background knowledge text in the dialogue reference information through the large language dialogue generation model.

[0108] In the above embodiment, since the sample background knowledge text can represent the sample topic background generated by the sample conversation topic text, by referring to the sample conversation topic text and the sample background knowledge text in the conversation reference information and predicting the reference conversation reply text according to the conversation task represented by the conversation task description text in the conversation reference information, the accuracy of generating the reference conversation reply text corresponding to the sample conversation topic text can be improved.

[0109] In one embodiment, the sample conversation topic text includes a third sample topic text; the conversation reference information also includes a second sample historical conversation text; the second sample historical conversation text includes a fourth sample topic text, and a sample reply text obtained in response to the fourth sample topic text; the conversation moment corresponding to the fourth sample topic text is earlier than the conversation moment of the third sample topic text; referring to the sample conversation topic text and the sample background knowledge text, and predicting a reference conversation reply text according to the conversation task represented by the conversation task description text, includes: referring to the second sample historical conversation text, the third sample topic text and the sample background knowledge text, and predicting a reference conversation reply text according to the conversation task represented by the conversation task description text.

[0110] Among them, the third sample topic text and the fourth sample topic text are dialogue topic texts used in the process of predicting and generating reference dialogue reply texts.

[0111] Specifically, the dialogue reference information includes the second sample historical dialogue text in addition to the dialogue task description text, the third sample topic text and the sample background knowledge text. The computer device may refer to the second sample historical dialogue text, the third sample topic text and the sample background knowledge text in the dialogue reference information, and predict the reference dialogue reply text according to the dialogue task represented by the dialogue task description text in the dialogue reference information.

[0112] In one embodiment, continue to refer to Figure 4 , the sample conversation topic text includes the third sample topic text, and in addition to the conversation task description text 401, the third sample topic text (i.e., "What is your husband's name?" asked by a friend in conversation 404) and the sample background knowledge text 403, the conversation 404 in the conversation reference information may also include the second sample historical conversation text. The computer device may refer to the second sample historical conversation text, the third sample topic text and the sample background knowledge text in the conversation reference information, and predict the reference conversation reply text (i.e., the content answered by Li Si in conversation 404, for example, the reference conversation reply text may be "My husband's name is Liu Xiaoming") according to the conversation task represented by the conversation task description text in the conversation reference information.

[0113] In one embodiment, a computer device may obtain dialogue reference information including a dialogue task description text, a third sample topic text, a sample background knowledge text, and a second sample historical dialogue text, and input the dialogue generation reference information into a trained large language dialogue generation model, so as to predict a reference dialogue reply text according to the dialogue task represented by the dialogue task description text in the dialogue reference information by referring to the second sample historical dialogue text, the third sample topic text, and the sample background knowledge text in the dialogue reference information through the large language dialogue generation model.

[0114] In the above embodiment, by referring to the second sample historical dialogue text, the third sample topic text and the sample background knowledge text, the reference dialogue reply text is predicted according to the dialogue task represented by the dialogue task description text. Since the prediction process not only considers the third sample topic text and the corresponding sample background knowledge text input at the current dialogue moment, but also includes the second sample historical dialogue text corresponding to the historical dialogue moment, the accuracy of the predicted reference dialogue reply text is improved.

[0115] In one embodiment, the trained dialogue model is a customized dialogue model trained for a preset target role; the dialogue reference information also includes role description information of the target role; referring to sample dialogue topic text and sample background knowledge text, and predicting reference dialogue response text according to the dialogue task represented by the dialogue task description text, including: referring to sample dialogue topic text, sample background knowledge text and role description information, and predicting reference dialogue response text that conforms to the dialogue style of the target role according to the dialogue task represented by the dialogue task description text.

[0116] The role description information is information used to describe the target role. For example, the role description information may include basic information of the target role, and may also include additional information such as the life experience and social relations of the target role.

[0117] Specifically, the dialogue reference information includes not only the dialogue task description text, the sample dialogue topic text, and the sample background knowledge text, but also the role description information of the target role. The computer device can refer to the sample dialogue topic text, the sample background knowledge text, and the role description information in the dialogue reference information, and predict the reference dialogue response text that meets the dialogue style of the target role according to the dialogue task represented by the dialogue task description text in the dialogue reference information.

[0118] In one embodiment, continue to refer to Figure 4 In addition to the dialogue task description text 401, the sample dialogue topic text (i.e., the question asked by the friend in dialogue 404, "What is your husband's name?") and the sample background knowledge text 403, the dialogue reference information may also include role description information 402. The computer device may refer to the sample dialogue topic text, the sample background knowledge text and the role description information in the dialogue reference information, and predict the reference dialogue reply text that conforms to the dialogue style of the target role according to the dialogue task represented by the dialogue task description text in the dialogue reference information. (i.e., the content answered by Li Si in dialogue 404, for example, the reference dialogue reply text may be Li Si's answer, "My husband's name is Liu Xiaoming"). It can be understood that the reference dialogue reply text that conforms to the dialogue style of the target role is the reference dialogue reply text replied from Li Si's perspective.

[0119] In one embodiment, a computer device may obtain dialogue reference information including dialogue task description text, sample dialogue topic text, sample background knowledge text, and role description information, and input the dialogue generation reference information into a trained large language dialogue generation model, so as to refer to the sample dialogue topic text, sample background knowledge text, and role description information in the dialogue reference information through the large language dialogue generation model, and predict a reference dialogue response text that conforms to the dialogue style of the target role according to the dialogue task represented by the dialogue task description text in the dialogue reference information.

[0120] In the above embodiment, by referring to the sample dialogue topic text, sample background knowledge text and role description information, according to the dialogue task represented by the dialogue task description text, the reference dialogue response text that conforms to the dialogue style of the target role is predicted, and the dialogue model to be trained is trained with the reference dialogue response text of the dialogue style of the target role. While improving the accuracy of the dialogue response, it is also possible to generate responses that conform to the customized role, thereby increasing the interest of the dialogue.

[0121] In one embodiment, the method also includes: obtaining topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example conversation topic text; the example topic description text represents the topic background generated by the example conversation topic text; obtaining the topic description text to be predicted; using the topic description text as a sample background knowledge text, and referring to the example text pair, according to the topic task represented by the topic task description text, predicting a sample conversation topic text that conforms to the topic background represented by the topic description text.

[0122] Among them, the topic reference information is the information referenced in the process of predicting and generating sample conversation topic text. The topic task description text is the text used to describe the topic generation task. The topic generation task refers to the task of predicting and generating sample conversation topic text. The example text pair is a text pair used as a reference example in the process of predicting and generating sample conversation topic text, and the example text pair includes an example topic description text and an example conversation topic text. The example topic description text is a text used to describe the topic and is used as a reference example in the process of predicting and generating sample conversation topic text. The example conversation topic text is a conversation topic text used as a reference example in the process of predicting and generating sample conversation topic text.

[0123] Specifically, the computer device may obtain topic reference information and the topic description text to be predicted. The computer device may use the topic description text to be predicted in the topic reference information as the sample background knowledge text, and refer to the sample text pairs in the topic reference information, and predict the sample conversation topic text that meets the topic background represented by the topic description text according to the topic task represented by the topic task description text in the topic reference information.

[0124] In one embodiment, the computer device may obtain topic reference information and obtain the topic description text to be predicted. Then, the computer device may input the topic description text and the topic reference information into the trained large language topic generation model, so as to predict the sample conversation topic text that meets the topic background represented by the topic description text according to the topic task represented by the topic task description text in the topic reference information by referring to the sample text pairs in the topic reference information through the large language topic generation model.

[0125] In one embodiment, Figure 5 As shown, the topic reference information includes a topic task description text 501 and at least one example text pair 502 (this embodiment provides two example text pairs, i.e., input 1-output 1, input 2-output 2). The example text pair includes an example topic description text (i.e., the content input by input 1 and input 2) and an example conversation topic text (i.e., the "topic" in output 1 and output 2). The example topic description text represents the topic background generated by the example conversation topic text. The computer device can obtain the topic description text to be predicted (i.e., the content input in the predicted output 503), and use the topic description text to be predicted as the sample background knowledge text, and refer to the example text pair 502, according to the topic task represented by the topic task description text 501, predict the sample conversation topic text that meets the topic background represented by the topic description text (i.e., the content output in the predicted output 503).

[0126] In the above embodiment, since the example topic description text represents the topic background generated by the example conversation topic text, the accuracy of generating the sample conversation topic text can be improved by using the topic description text as the sample background knowledge text and referring to the example text pair, and predicting the sample conversation topic text that meets the topic background represented by the topic description text according to the topic task represented by the topic task description text.

[0127] In one embodiment, the trained dialogue model is a customized dialogue model trained for a preset target role; obtaining a topic description text to be predicted includes: obtaining a second creative text related to the target role; performing text segmentation on the second creative text to obtain at least one second sub-text that meets a preset text length, and using each second sub-text as a topic description text to be predicted.

[0128] The second sub-text is at least a portion of the text in the second creative text.

[0129] In one embodiment, the computer device may obtain a second creative text related to the target role, and directly segment the second creative text to obtain at least one second subtext that meets a preset text length. It is understood that the second creative text includes each second subtext, and the text length of the second creative text is greater than the text length of each second subtext. Furthermore, the computer device may use each second subtext in the second creative text as a topic description text to be predicted.

[0130] In the above embodiment, by performing text segmentation on the second creative text related to the target role and using each second sub-text directly obtained by the segmentation as the topic description text to be predicted, the efficiency of obtaining the topic description text can be improved.

[0131] In one embodiment, the second creative text is segmented to obtain at least one second sub-text that meets a preset text length, including: classifying the second creative text to obtain dialogue text content and non-dialogue text content; and segmenting the dialogue text content and non-dialogue text content separately to obtain at least one second sub-text that meets the preset text length.

[0132] The dialogue text content is the text content related to the character dialogue in the second creative text. The non-dialogue text content is the text content related to the non-character dialogue in the second creative text. For example, the non-dialogue text content can be at least one of the inner monologue of the character or the scene description content in the second creative text.

[0133] Specifically, the computer device may classify the second creative text to obtain dialogue text content and non-dialogue text content. It can be understood that the second creative text is divided into two parts: dialogue text content and non-dialogue text content. The computer device may perform text segmentation on the dialogue text content and non-dialogue text content respectively to obtain at least one second sub-text that meets the preset text length.

[0134] In the above embodiment, by classifying the content of the second creative text to obtain dialogue text content and non-dialogue text content, and then performing text segmentation on the dialogue text content and the non-dialogue text content respectively, the segmentation accuracy of the second creative text can be improved, and a more accurate second sub-text can be obtained, thereby further improving the efficiency of obtaining the topic description text.

[0135] In one embodiment, Figure 6 As shown, the dialogue generation process of the present application includes four major stages, namely, generating training topics, generating training dialogues, training dialogue models, and inferring dialogue models. For the stage of generating training topics, the computer device can obtain creative texts related to the target role, perform text segmentation on the creative text, obtain multiple sub-texts, and use each sub-text as a topic description text to be predicted (the above process is the process of text preprocessing). Furthermore, the computer device can obtain topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example dialogue topic text; the example topic description text represents the topic background generated by the example dialogue topic text. Take the topic description text as the sample background knowledge text, and refer to the example text pair, and predict the sample dialogue topic text that meets the topic background represented by the topic description text according to the topic task represented by the topic task description text.

[0136] Continue to refer Figure 6For the dialogue stage of generating training, the computer device can obtain dialogue reference information; the dialogue reference information includes dialogue task description text, sample dialogue topic text and sample background knowledge text. Referring to the sample dialogue topic text, sample background knowledge text and role description information, according to the dialogue task represented by the dialogue task description text, the reference dialogue response text that meets the dialogue style of the pre-set target role is predicted.

[0137] Continue to refer Figure 6 For the stage of generating a training dialogue model, first, the computer device can first train the initial dialogue model through open source training data (i.e., the process of pre-training the initial dialogue model) to obtain the dialogue model to be trained in this application. Secondly, the computer device can obtain a dialogue training text; the dialogue training text includes a sample combination text and a reference dialogue reply text; the sample combination text is obtained by combining a sample background knowledge text and a sample dialogue topic text; the sample background knowledge text represents the sample topic background generated by the sample dialogue topic text; the reference dialogue reply text is a dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background. The dialogue model to be trained is iteratively trained through the dialogue training text to obtain a customized dialogue model for the target role that has been trained (i.e., the process of fine-tuning the customized role dialogue model).

[0138] Continue to refer Figure 6 For the inference stage of the dialogue model, the computer device can pre-build a background knowledge base. The input dialogue topic text is obtained, and the target background knowledge text matching the dialogue topic text is searched from the pre-built background knowledge base, and the target background knowledge text represents the topic background generated by the dialogue topic text. The target background knowledge text is combined with the dialogue topic text to obtain a combined text, and the combined text is input into the trained dialogue model to extract features of the combined text by using the trained dialogue model to obtain semantic features of the combined text. The response prediction is performed based on the semantic features of the combined text to obtain a dialogue response text corresponding to the dialogue topic text, in line with the topic background, and in line with the dialogue style of the target role.

[0139] like Figure 7 As shown, in one embodiment, a method for generating a dialogue is provided. The method can be applied to a computer device, which can be a terminal or a server. The method can be executed by the terminal or the server itself, or can be implemented through interaction between the terminal and the server. This embodiment is described by taking the method applied to a computer device as an example. The method specifically includes the following steps:

[0140] Step 702, obtain topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example dialogue topic text; the example topic description text represents the topic background generated by the example dialogue topic text.

[0141] Step 704, obtaining a second creative text related to the target character, classifying the second creative text into dialogue text content and non-dialogue text content.

[0142] Step 706 , respectively segmenting the dialogue text content and the non-dialogue text content to obtain at least one second sub-text satisfying a preset text length, and using each second sub-text as a topic description text to be predicted.

[0143] Step 708, taking the topic description text as sample background knowledge text, and referring to the example text pair, according to the topic task represented by the topic task description text, predicting the sample dialogue topic text that meets the topic background represented by the topic description text.

[0144] Step 710, obtaining dialogue reference information; the dialogue reference information includes dialogue task description text, sample dialogue topic text and sample background knowledge text.

[0145] Step 712, referring to the sample dialogue topic text, the sample background knowledge text and the role description information, and predicting a reference dialogue response text that conforms to the dialogue style of the preset target role according to the dialogue task represented by the dialogue task description text.

[0146] Step 714, obtain the dialogue training text; the dialogue training text includes a sample combination text and a reference dialogue response text; the sample combination text is obtained by combining the sample background knowledge text and the sample dialogue topic text; the sample background knowledge text represents the sample topic background generated by the sample dialogue topic text; the reference dialogue response text is the dialogue response text corresponding to the sample dialogue topic text and conforming to the sample topic background.

[0147] Step 716, iteratively train the dialogue model to be trained using the dialogue training text to obtain a trained and customized dialogue model for the target role.

[0148] Step 718, obtaining the first creative text, performing text segmentation on the first creative text to obtain at least one first sub-text, and using each first sub-text as a background knowledge text corresponding to the first creative text.

[0149] Step 720, constructing a background knowledge base based on the background knowledge text corresponding to the first creative text.

[0150] Step 722, obtain the input conversation topic text, and perform feature extraction on the conversation topic text to obtain semantic features of the topic text.

[0151] Step 724, determining the feature similarity between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base.

[0152] Step 726, the background knowledge text corresponding to the background text semantic feature with the maximum feature similarity is used as the target background knowledge text that matches the dialogue topic text; the target background knowledge text represents the topic background generated by the dialogue topic text.

[0153] Step 728, combining the target background knowledge text with the dialogue topic text to obtain a combined text, and inputting the combined text into the trained dialogue model to extract features of the combined text through the trained dialogue model to obtain semantic features of the combined text.

[0154] Step 730, perform reply prediction based on the combined text semantic features to obtain a dialogue reply text that corresponds to the dialogue topic text, conforms to the topic background, and conforms to the dialogue style of the target character.

[0155] The present application also provides an application scenario, which applies the above-mentioned dialogue generation method. Specifically, the dialogue generation method can be applied to the dialogue generation scenario of a specific character in a novel. It can be understood that the first creative text and the second creative text in the present application are target novels, and the target novel includes many characters, including the target character. For example, the target novel is "The Legendary Life of Zhang San" and the target character is "Zhang San".

[0156] Specifically, the computer device can obtain topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example dialogue topic text; the example topic description text represents the topic background generated by the example dialogue topic text. The "Legendary Life of Zhang San" related to Zhang San is obtained, and the content of "Legendary Life of Zhang San" is classified to obtain dialogue text content and non-dialogue text content. The dialogue text content and non-dialogue text content are respectively segmented to obtain at least one second sub-text that meets the preset text length, and each second sub-text is used as the topic description text to be predicted. The topic description text is used as a sample background knowledge text, and with reference to the example text pair, according to the topic task represented by the topic task description text, a sample dialogue topic text that meets the topic background represented by the topic description text is predicted.

[0157] The computer device can obtain dialogue reference information; the dialogue reference information includes dialogue task description text, sample dialogue topic text and sample background knowledge text. With reference to the sample dialogue topic text, sample background knowledge text and role description information, according to the dialogue task represented by the dialogue task description text, a reference dialogue response text that matches Zhang San's dialogue style is predicted.

[0158] The computer device can obtain the dialogue training text; the dialogue training text includes the sample combination text and the reference dialogue reply text; the sample combination text is obtained by combining the sample background knowledge text and the sample dialogue topic text; the sample background knowledge text represents the sample topic background generated by the sample dialogue topic text; the reference dialogue reply text is the dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background. The dialogue model to be trained is iteratively trained through the dialogue training text to obtain a customized dialogue model for Zhang San that has been trained.

[0159] The computer device can obtain "Zhang San's Legendary Life", perform text segmentation on "Zhang San's Legendary Life" to obtain at least one first subtext, and use each first subtext as the background knowledge text corresponding to "Zhang San's Legendary Life"; a background knowledge base is constructed based on the background knowledge text corresponding to "Zhang San's Legendary Life". The input dialogue topic text is obtained, and the dialogue topic text is feature extracted to obtain the semantic features of the topic text; the feature similarity between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base is determined respectively; the background knowledge text corresponding to the background text semantic features with the maximum feature similarity is used as the target background knowledge text matching the dialogue topic text; the target background knowledge text represents the topic background generated by the dialogue topic text. The target background knowledge text is combined with the dialogue topic text to obtain a combined text, and the combined text is input into the trained dialogue model to extract features from the combined text by the trained dialogue model to obtain the semantic features of the combined text. The reply prediction is performed according to the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text, in line with the topic background, and in line with Zhang San's dialogue style.

[0160] It is understandable that the computer device in the present application can be a chatbot, and the customized dialogue model trained in the present application can be deployed on the chatbot. It is understandable that the chatbot is customized for Zhang San, and the chatbot will reply to questions from Zhang San's perspective. For example, the user inputs the dialogue topic text to the chatbot (for example, "Zhang San, who is your father?"), and the chatbot will feedback the dialogue reply text to the user from Zhang San's perspective (for example, the chatbot will feedback "My father is Zhang Xiaoming"). The dialogue generation method of the present application can improve the accuracy of dialogue replies.

[0161] The present application also provides an application scenario, which applies the above-mentioned dialogue generation method. Specifically, the dialogue generation method can be applied to the scenario of dialogue generation of any character in the script. It can be understood that the first creative text and the second creative text in the present application are target scripts, and the target script includes many characters. The dialogue generation method of the present application can generate dialogue response text that conforms to the style of any character in the target script. The dialogue generation method of the present application can improve the accuracy of dialogue responses.

[0162] It should be understood that, although each step in the flow chart of the above-mentioned embodiments is shown in order, these steps are not necessarily performed in order. Unless there is a clear explanation in this article, the execution of these steps does not have strict order restrictions, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned embodiments may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily performed in order, but can be performed in turn or alternately with at least a portion of other steps or sub-steps or stages of other steps.

[0163] In one embodiment, Figure 8 As shown, a dialog generation device 800 is provided, and the device specifically includes:

[0164] An acquisition module 802 is used to acquire an input conversation topic text;

[0165] The search module 804 is used to search for a target background knowledge text that matches the dialogue topic text from a pre-built background knowledge base; the target background knowledge text represents the topic background generated by the dialogue topic text;

[0166] A combining module 806 is used to combine the target background knowledge text with the dialogue topic text to obtain a combined text;

[0167] An extraction module 808 is used to extract features from the combined text to obtain semantic features of the combined text;

[0168] The prediction module 810 is used to predict the reply according to the semantic features of the combined text, and obtain the dialogue reply text corresponding to the dialogue topic text and conforming to the topic background.

[0169] In one embodiment, the search module 804 is also used to extract features from the conversation topic text to obtain semantic features of the topic text; determine the feature similarities between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base; and use the background knowledge text corresponding to the background text semantic features with the maximum feature similarity as the target background knowledge text that matches the conversation topic text.

[0170] In one embodiment, reference Fig. 9 , the dialogue generating device 800 may further include a construction module 812.

[0171] Construction module 812 is used to obtain a first creative text; perform text segmentation on the first creative text to obtain at least one first sub-text, and use each first sub-text as a background knowledge text corresponding to the first creative text; and construct a background knowledge base based on the background knowledge text corresponding to the first creative text.

[0172] In one embodiment, the first creative text is a creative text related to a preset target role; the prediction module 810 is also used to predict a reply based on the semantic features of the combined text to obtain a dialogue reply text that corresponds to the dialogue topic text and conforms to the dialogue style and topic background of the target role.

[0173] In one embodiment, the conversation topic text includes the current topic text input at the current conversation moment; the combination module 806 is also used to obtain the historical conversation text; the historical conversation text includes the historical topic text input at the historical conversation moment, and the historical reply text obtained by replying to the historical topic text; the historical conversation moment is at least any conversation moment before the current conversation moment; the target background knowledge text, the historical conversation text and the current topic text are combined to obtain a combined text.

[0174] In one embodiment, the dialogue reply text is predicted by a trained dialogue model; the dialogue generation device 800 may further include a training module 814.

[0175] The training module 814 is used to obtain the dialogue training text; the dialogue training text includes the sample combination text and the reference dialogue reply text; the sample combination text is obtained by combining the sample background knowledge text and the sample dialogue topic text; the sample background knowledge text represents the sample topic background generated by the sample dialogue topic text; the reference dialogue reply text is the dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background; the dialogue model to be trained is iteratively trained through the dialogue training text to obtain the trained dialogue model.

[0176] In one embodiment, the sample conversation topic text includes a first sample topic text; the training module 814 is also used to obtain a first sample historical conversation text; the first sample historical conversation text includes a second sample topic text and a sample reply text obtained in response to the second sample topic text; the conversation time corresponding to the second sample topic text is earlier than the conversation time of the first sample topic text; the sample background knowledge text, the first sample historical conversation text and the first sample topic text are combined to obtain a sample combined text.

[0177] In one embodiment, the training module 814 is also used to obtain dialogue reference information; the dialogue reference information includes dialogue task description text, sample dialogue topic text and sample background knowledge text; referring to the sample dialogue topic text and the sample background knowledge text, according to the dialogue task represented by the dialogue task description text, the reference dialogue reply text is predicted.

[0178] In one embodiment, the sample conversation topic text includes a third sample topic text; the conversation reference information also includes a second sample historical conversation text; the second sample historical conversation text includes a fourth sample topic text, and a sample reply text obtained in response to the fourth sample topic text; the conversation moment corresponding to the fourth sample topic text is earlier than the conversation moment of the third sample topic text; the training module 814 is also used to refer to the second sample historical conversation text, the third sample topic text and the sample background knowledge text, and predict the reference conversation reply text according to the conversation task represented by the conversation task description text.

[0179] In one embodiment, the trained dialogue model is a customized dialogue model trained for a pre-set target role; the dialogue reference information also includes role description information of the target role; the training module 814 is also used to refer to sample dialogue topic text, sample background knowledge text and role description information, and predict a reference dialogue response text that conforms to the dialogue style of the target role according to the dialogue task represented by the dialogue task description text.

[0180] In one embodiment, the training module 814 is also used to obtain topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example conversation topic text; the example topic description text represents the topic background generated by the example conversation topic text; obtain the topic description text to be predicted; use the topic description text as a sample background knowledge text, and refer to the example text pair, and according to the topic task represented by the topic task description text, predict the sample conversation topic text that meets the topic background represented by the topic description text.

[0181] In one embodiment, the trained dialogue model is a customized dialogue model trained for a preset target role; the training module 814 is also used to obtain a second creative text related to the target role; the second creative text is segmented to obtain at least one second sub-text that meets a preset text length, and each second sub-text is used as a topic description text to be predicted.

[0182] In one embodiment, the training module 814 is also used to classify the content of the second creative text to obtain dialogue text content and non-dialogue text content; perform text segmentation on the dialogue text content and non-dialogue text content respectively to obtain at least one second sub-text that meets a preset text length.

[0183] In an embodiment of the present application, the input conversation topic text is obtained, and the target background knowledge text matching the conversation topic text is searched from the pre-built background knowledge base. Since there are many background knowledge texts stored in the background knowledge base, the background information is very rich. By searching the target background knowledge text matching the conversation topic text from the background knowledge base, the target background knowledge text represents the topic background generated by the conversation topic text. By combining the target background knowledge text with the conversation topic text, a combined text is obtained, and the combined text can simultaneously contain the topic that the object of the input conversation topic text intends to talk about, as well as background knowledge related to the input topic. Feature extraction is performed on the combined text to obtain the semantic features of the combined text, and reply prediction is performed based on the semantic features of the combined text, so that a conversation reply text corresponding to the conversation topic text and conforming to the topic background can be obtained, thereby improving the accuracy of the conversation reply.

[0184] Each module in the above-mentioned dialog generation device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each module.

[0185] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.10As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a dialogue generation method is implemented.

[0186] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for generating a dialogue is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0187] Those skilled in the art will understand that Fig.10 and Fig.11The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0188] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0189] In one embodiment, a computer-readable storage medium is provided, storing a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0190] In one embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.

[0191] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0192] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0193] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0194] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for generating a dialogue, characterized in that: The method comprises: Get the input conversation topic text; Searching for a target background knowledge text that matches the dialogue topic text from a pre-built background knowledge library; the target background knowledge text represents the topic background generated by the dialogue topic text; Combining the target background knowledge text with the dialogue topic text to obtain a combined text; Extracting features from the combined text to obtain semantic features of the combined text; Reply prediction is performed based on the semantic features of the combined text to obtain a dialogue reply text that corresponds to the dialogue topic text and conforms to the topic background.

2. The method according to claim 1, characterized in that: The step of searching a pre-built background knowledge base for a target background knowledge text that matches the conversation topic text includes: Extracting features from the conversation topic text to obtain semantic features of the topic text; respectively determining the feature similarity between the semantic features of the topic text and the background text semantic features of each background knowledge text in the background knowledge base; The background knowledge text corresponding to the background text semantic feature with the maximum feature similarity is used as the target background knowledge text that matches the dialogue topic text.

3. The method according to claim 1, characterized in that The method further comprises: Obtaining the first creative text; Performing text segmentation on the first creative text to obtain at least one first sub-text, and using each of the first sub-texts as a background knowledge text corresponding to the first creative text; The background knowledge base is constructed based on the background knowledge text corresponding to the first creative text.

4. The method according to claim 3, characterized in that The first creative text is a creative text related to a preset target role; The step of performing reply prediction according to the semantic features of the combined text to obtain a dialogue reply text corresponding to the dialogue topic text and conforming to the topic background includes: Reply prediction is performed based on the semantic features of the combined text to obtain a dialogue reply text that corresponds to the dialogue topic text and conforms to the dialogue style of the target character and the topic background.

5. The method according to claim 1, characterized in that The dialogue topic text includes the current topic text input at the current dialogue moment; the target background knowledge text is combined with the dialogue topic text to obtain a combined text, including: Acquire historical conversation text; the historical conversation text includes the historical topic text input at the historical conversation moment and the historical reply text obtained by replying to the historical topic text; the historical conversation moment is at least any conversation moment before the current conversation moment; The target background knowledge text, the historical conversation text and the current topic text are combined to obtain a combined text.

6. The method according to any one of claims 1 to 5, characterized in that The dialogue reply text is predicted by a trained dialogue model; the method further includes: Acquire a dialogue training text; the dialogue training text includes a sample combination text and a reference dialogue reply text; the sample combination text is obtained by combining a sample background knowledge text and a sample dialogue topic text; the sample background knowledge text represents a sample topic background generated by the sample dialogue topic text; the reference dialogue reply text is a dialogue reply text corresponding to the sample dialogue topic text and conforming to the sample topic background; The dialogue model to be trained is iteratively trained using the dialogue training text to obtain a trained dialogue model.

7. The method according to claim 6, characterized in that The sample conversation topic text includes a first sample topic text; the method further includes: Acquire a first sample historical conversation text; the first sample historical conversation text includes a second sample topic text and a sample reply text obtained by replying to the second sample topic text; the conversation time corresponding to the second sample topic text is earlier than the conversation time of the first sample topic text; The sample background knowledge text, the first sample historical dialogue text and the first sample topic text are combined to obtain a sample combined text.

8. The method according to claim 6, characterized in that The method further comprises: Acquire dialogue reference information; the dialogue reference information includes a dialogue task description text, the sample dialogue topic text and the sample background knowledge text; With reference to the sample conversation topic text and the sample background knowledge text, the reference conversation reply text is predicted according to the conversation task represented by the conversation task description text.

9. The method according to claim 8, characterized in that The sample conversation topic text includes a third sample topic text; the conversation reference information also includes a second sample historical conversation text; the second sample historical conversation text includes a fourth sample topic text and a sample reply text obtained by replying to the fourth sample topic text; the conversation time corresponding to the fourth sample topic text is earlier than the conversation time of the third sample topic text; The step of referring to the sample conversation topic text and the sample background knowledge text and predicting the reference conversation reply text according to the conversation task represented by the conversation task description text includes: With reference to the second sample historical dialogue text, the third sample topic text and the sample background knowledge text, the reference dialogue reply text is predicted according to the dialogue task represented by the dialogue task description text.

10. The method according to claim 8, characterized in that The trained dialogue model is a customized dialogue model trained for a preset target role; the dialogue reference information also includes role description information of the target role; The step of referring to the sample conversation topic text and the sample background knowledge text and predicting the reference conversation reply text according to the conversation task represented by the conversation task description text includes: With reference to the sample dialogue topic text, the sample background knowledge text and the role description information, the reference dialogue response text that conforms to the dialogue style of the target role is predicted according to the dialogue task represented by the dialogue task description text.

11. The method according to claim 6, characterized in that The method further comprises: Acquire topic reference information; the topic reference information includes a topic task description text and at least one example text pair; the example text pair includes an example topic description text and an example dialogue topic text; the example topic description text represents the topic background generated by the example dialogue topic text; Get the topic description text to be predicted; The topic description text is used as the sample background knowledge text, and with reference to the example text pair, the sample dialogue topic text that conforms to the topic background represented by the topic description text is predicted according to the topic task represented by the topic task description text.

12. The method according to claim 11, characterized in that: The trained dialogue model is a customized dialogue model trained for a preset target role; the step of obtaining the topic description text to be predicted includes: Obtaining a second creative text related to the target role; The second creative text is segmented to obtain at least one second sub-text satisfying a preset text length, and each of the second sub-texts is used as a topic description text to be predicted.

13. The method according to claim 12, characterized in that The step of segmenting the second creative text to obtain at least one second sub-text satisfying a preset text length includes: Classifying the content of the second creative text to obtain dialogue text content and non-dialogue text content; The dialogue text content and the non-dialogue text content are respectively segmented to obtain at least one second subtext satisfying a preset text length.

14. A dialogue generation device, characterized in that: The device comprises: An acquisition module is used to obtain the input conversation topic text; A search module is used to search for a target background knowledge text that matches the dialogue topic text from a pre-built background knowledge library; the target background knowledge text represents the topic background generated by the dialogue topic text; A combining module, used for combining the target background knowledge text with the dialogue topic text to obtain a combined text; An extraction module, used for extracting features from the combined text to obtain semantic features of the combined text; The prediction module is used to predict the reply according to the semantic features of the combined text, and obtain the dialogue reply text corresponding to the dialogue topic text and conforming to the topic background.

15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.

16. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.

17. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.