Conversation reply generation method and device, electronic equipment and storage medium
By obtaining user information and historical dialogue segments, combining character background information to generate monologue information, and selecting appropriate dialogue segments from the original dialogue library, the problem of single-dimensional virtual character reply is solved, and the natural fluency and diversity of dialogue is improved. , enhances the user experience.
Patent Information
- Application Number
- CN202411212372.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-08-30
AI Technical Summary
When facing diverse dialogue situations and objects, existing virtual characters have a single reply, lack creativity, and affect the natural fluency and user experience of the conversation.
By obtaining the user information and historical dialogue segments of the target object, combining the background information of the character to generate monologue information, and selecting dialogue segments that are in line with the relationship information from the original dialogue library, dynamically generate dialogue reply information, breaking the singularity and improving natural fluency and diversity.
It significantly improves the natural fluency and diversity of dialogue between virtual characters and users, and enhances the authenticity and attractiveness of dialogue.
Smart Images

Figure CN119088937A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of natural language processing technology, and in particular, to a method, device, electronic device and storage medium for generating dialogue responses. Background Art
[0002] With the development of natural language processing technology, natural language processing systems are becoming increasingly important in various application scenarios, such as online customer service, virtual assistants, and virtual character conversations.
[0003] In order to extend the life of virtual characters in movies, TV shows, and games, the life of virtual characters can be extended by giving them similar personalities and ways of speaking to those in movies, TV shows, and games, and by creating new interactions between familiar virtual characters. Since the virtual characters in the conversation are pre-set, the responses to each communication partner (real person) are standardized. The conversation process often ignores the characteristics of human communication. When facing different communication partners, people will adjust their conversation methods according to the different relationships. Currently, when facing diverse conversation situations and partners, virtual characters can only provide single responses and lack creative answers, which limits the natural fluency of the conversation and affects the user experience. Summary of the invention
[0004] In view of this, in order to make the conversation content between the virtual character and the target object fit the relationship between the two parties and improve the natural fluency and diversity of the conversation, the embodiment of the present invention provides a method, device, electronic device and storage medium for generating a conversation reply.
[0005] In a first aspect, an embodiment of the present invention provides a method for generating a dialogue reply, the method being applied to a dialogue system, the method comprising:
[0006] Responding to current dialogue input information of the target object during the dialogue process, acquiring user information of the target object;
[0007] Acquire historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information representing the relationship between the target object and the virtual character;
[0008] Generate monologue information corresponding to the current dialogue input information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that meets the characteristics of the target character;
[0009] Determine the target original dialogue segment from the original dialogue database based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue;
[0010] Generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0011] In a possible implementation, obtaining the historical dialogue segments and character background information of the target object based on the user information includes:
[0012] Querying and obtaining historical conversation segments matching the user information from the conversation database; wherein the conversation database stores the corresponding relationship between the historical conversation segments and the user information;
[0013] The character background information matching the user information is queried from the character background information database; wherein the character background information database stores the corresponding relationship between the character background information and the user information.
[0014] In a possible implementation, generating monologue information corresponding to current dialogue input information according to historical dialogue segments and character background information includes:
[0015] The historical dialogue segments, character background information and current dialogue input information are input into the large language model, and the large language model outputs monologue information.
[0016] In a possible implementation, the original dialogue library stores a plurality of original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment;
[0017] Search the target original dialogue segment from the original dialogue library based on the relationship information and monologue information, including:
[0018] Obtaining role information corresponding to the virtual role that is in dialogue with the target object;
[0019] Searching for a plurality of first matching original dialogue segments corresponding to specific character information matching the character information from an original dialogue library;
[0020] Searching for a plurality of second matching original dialogue segments corresponding to the specific relationship information matching the relationship information from the plurality of first matching original dialogue segments;
[0021] The following processing is performed for each second matching original dialogue segment: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment;
[0022] The second matching original dialogue segment with the highest text similarity is determined as the target original dialogue segment.
[0023] In a possible implementation, generating dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment includes:
[0024] The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0025] In one possible implementation, the method further includes:
[0026] The current dialogue input information and dialogue reply information are stored in the dialogue library.
[0027] In one possible implementation, the method further includes:
[0028] Generate a dialogue reply text message or a dialogue reply voice message from the dialogue reply message;
[0029] The dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast.
[0030] In a second aspect, an embodiment of the present invention provides a device for generating a dialogue reply, the device being applied to a dialogue system, the device comprising:
[0031] A first acquisition module, configured to acquire user information of a target object in response to current dialogue input information of the target object during a dialogue process;
[0032] A second acquisition module is used to acquire the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character;
[0033] The first generation module is used to generate monologue information corresponding to the current dialogue input information according to the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that meets the characteristics of the target object character;
[0034] A determination module is used to determine a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue;
[0035] The second generation module is used to generate dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment, and generate dialogue reply information corresponding to the current dialogue input information.
[0036] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a processor and a memory, wherein the processor is used to execute a program for generating conversation replies stored in the memory to implement the above-mentioned method for generating conversation replies.
[0037] In a fourth aspect, an embodiment of the present invention provides a storage medium, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned method of generating dialogue replies.
[0038] The method, device, electronic device and storage medium for generating dialogue responses provided by the embodiment of the present invention include: obtaining user information of the target object in response to the current dialogue input information of the target object during the dialogue process; obtaining historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character; generating monologue information according to the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that conforms to the character characteristics of the target object; determining the target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the character relationship between the two parties in the dialogue; generating dialogue response information corresponding to the current dialogue input information according to the monologue information, the relationship information and the target original dialogue segment. The above technical scheme can dynamically select sentence paragraphs similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, and generate dialogue content that is more in line with the relationship between the two parties, thereby breaking the singleness of the existing virtual character dialogue output and significantly improving the natural fluency and diversity of the dialogue. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flowchart of an embodiment of a method for generating a dialogue reply provided by an embodiment of the present invention;
[0040] Figure 2 A flowchart of another embodiment of a method for generating a dialogue reply provided by an embodiment of the present invention;
[0041] Figure 3 A block diagram of an embodiment of a device for generating a dialogue reply provided by an embodiment of the present invention;
[0042] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0044] To facilitate understanding of the embodiments of the present invention, specific embodiments will be further explained below in conjunction with the accompanying drawings. The embodiments do not constitute a limitation on the embodiments of the present invention.
[0045] The embodiment of the present invention provides a method for generating dialogue responses, which is applied to a dialogue system, also known as a conversation agent, a computer system that simulates a conversation between a human and a virtual character, and is intended to form a coherent and smooth dialogue with a human. The communication methods mainly include voice / text / picture, and of course other methods such as gestures / tactile sensations can also be used. Figure 1 , Figure 1 A flowchart of an embodiment of a method for generating a dialogue reply provided in an embodiment of the present invention. Figure 1 The process shown may include the following steps:
[0046] Step 101, in response to the current dialogue input information of the target object during the dialogue process, obtaining the user information of the target object;
[0047] The target object may refer to any user engaging in an intelligent conversation. The current conversation input information is not limited to voice, text, pictures and other information forms. In actual application, the conversation system provides a conversation interface, which may be used by the target object to input the current conversation input information, and to display the target object's current conversation input information and conversation reply information.
[0048] User information can be understood as the unique identification information of the target object, which can be the user's ID number, user ID (Identity) or the device ID of the device used, etc. User information is not limited here.
[0049] Step 102, obtaining the historical dialogue segments and character background information of the target object based on the user information;
[0050] The historical dialogue segments include dialogue segments previously exchanged between the target object and each virtual character. In this embodiment, the dialogue segments include dialogue input information input by the target object and dialogue reply information replied by the virtual character.
[0051] The character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character.
[0052] The relationship information can be understood as information used to represent the social relationship between the target object and the virtual character. The relationship information can be relationship information indicating that the target object and the virtual character are strangers, relationship information indicating that the target object and the virtual character are friends, relationship information indicating that the target object and the virtual character are relatives, or relationship information indicating that the target object and the virtual character are superior-subordinate. The relationship information is not limited here.
[0053] In addition to relationship information, the above-mentioned character background information also includes personality information that can characterize the personality characteristics of the target object. The personality information can be cheerful, depressed, sad, or happy, etc., which is not limited here.
[0054] Step 103, generating monologue information corresponding to the current dialogue input information according to the historical dialogue segments and character background information;
[0055] The above monologue information is specifically generated based on the personality information in the historical dialogue segment and the character background information, wherein the monologue information is the dialogue response information that conforms to the characteristics of the target object character; the monologue information can provide the emotional and thematic basis for the subsequent dialogue generation. The monologue information is only a kind of information generated by the dialogue system itself, and is the intermediate product information for generating the final dialogue response information. Therefore, the monologue information is the dialogue response information that is not output to the target object.
[0056] In order to facilitate the understanding of the monologue information, the historical dialogue segment between the target object and the virtual character 1 is "xx, I am going to go out with my friends at 3 o'clock this afternoon. I feel very happy. You have to remind me. Okay, I will remind you then. I wish you a happy time." The character information in the character background information is happy. For example, if the current dialogue input information input by the target object is "xx, what time is it now". The monologue information of the dialogue system is "I am here, I am here. The current time is 2:50 pm. You should go out and play with your friends in 10 minutes." This kind of brisk tone information makes the dialogue consistent in both emotion and theme.
[0057] Step 104, determining a target original dialogue segment from an original dialogue library based on the relationship information and the monologue information;
[0058] The above-mentioned original dialogue library stores multiple original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment; it can be understood that each original dialogue segment is the specific dialogue content in the script content where the virtual character is located, the specific relationship information is used to mark the relationship between the characters who have conversations with the virtual character, and the specific role information is used to mark the virtual character, indicating what specific role the virtual character is.
[0059] In this embodiment, the target original dialogue segment determined from the original dialogue library based on the relationship information and the monologue information is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue; it provides a reference for the subsequent generation of dialogue content that fits the relationship between the two parties.
[0060] For ease of understanding, the relationship information in the character background information of the previous example is relatives. Among them, the monologue information and the relationship information of relatives that match the most with "I'm here, I'm here. The current time is 2:50 pm. You should go out and play with your friends in 10 minutes." is "My friend and I made an appointment to go out and play at noon. Really? Then you are a little short of time. You should go out and play with your friends now. I wish you have fun. I'll wait for you to come back home.".
[0061] Step 105, generating dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment.
[0062] After generating preliminary monologue information, this embodiment further optimizes and personalizes the monologue information based on target original dialogue segments that are similar to the monologue information in content and that match the relationship between the two characters in the dialogue, so that the dialogue is closer to the real emotions and social needs of the characters, thereby improving the authenticity and attractiveness of the dialogue.
[0063] To facilitate understanding, the dialogue reply message after the previous example of integrating the monologue information and the target original dialogue segment is "I'm here, I'm here. The current time is 2:50 pm. You have 10 minutes to go out and play with your friends. I hope you have fun. I'll wait for you at home."
[0064] The method for generating a dialogue reply provided by an embodiment of the present invention includes: in response to the current dialogue input information of the target object during the dialogue process, obtaining the user information of the target object; obtaining the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the character characteristics of the target object, and the character background information includes the relationship information representing the relationship between the target object and the virtual character; generating monologue information according to the historical dialogue segments and the character background information; wherein the monologue information is the dialogue reply information that conforms to the character characteristics of the target object; determining the target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the character relationship between the two parties in the dialogue; generating dialogue reply information corresponding to the current dialogue input information according to the monologue information, the relationship information and the target original dialogue segment. The above technical scheme can dynamically select sentence paragraphs similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, and generate dialogue content that is more in line with the relationship between the two parties, thereby breaking the singleness of the existing virtual character dialogue output and significantly improving the natural fluency and diversity of the dialogue.
[0065] exist Figure 1 Based on Figure 2 , Figure 2 A flow chart of another embodiment of a method for generating a conversation reply provided in an embodiment of the present invention. Figure 2 The process shown may include the following steps:
[0066] Step 201, in response to the current dialogue input information of the target object during the dialogue process, obtaining the user information of the target object;
[0067] Step 202, obtaining the historical dialogue segments and character background information of the target object based on the user information;
[0068] The character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character.
[0069] The specific process of obtaining historical dialogue segments and character background information can be achieved by steps A1 to A2:
[0070] Step A1, querying and obtaining historical conversation segments matching the user information from the conversation database;
[0071] Among them, the dialogue library stores the correspondence between historical dialogue segments and user information; it can be understood that each historical dialogue segment is identified by the user information of the object communicating with the virtual character, so that the historical dialogue segment corresponding to the user information matching it can be obtained from the dialogue library through the user information of the target object.
[0072] Step A2, querying and acquiring character background information matching the user information from a character background information database;
[0073] Among them, the character background information library stores the correspondence between character background information and user information; it can be understood that each character background information is identified by the user information of the object that has communicated with the virtual character, so that the character background information corresponding to the user information matching it can be obtained from the character background information library through the user information of the target object.
[0074] Among them, the personality information in the character background information is obtained based on the analysis of the historical dialogue segments of the object through the personality model, and the obtained personality information is stored in the character background information library. The personality model can be understood as a pre-trained analysis model. The relationship information in the character background information is set on the setting interface of the dialogue system before the object and the virtual character communicate. After the relationship information is set, the relationship information of the object is stored in the character background information library. The above setting interface provides the object with a selection control that can select each social relationship for the object to select; or provides an input control that can input social relationships, so that the object can enter the relationship information in the input control, which is not limited here.
[0075] Step 203, inputting the historical dialogue segments, character background information and current dialogue input information into the large language model, and the large language model outputs monologue information;
[0076] Among them, the monologue information is the dialogue response information that meets the characteristics of the target object.
[0077] A large language model is a functional module in a dialogue system that is used to output corresponding responses based on the input content. Large Language Model: Large Language Model, referred to as LLM, refers to a computer model that can process and generate natural language. LLM can predict the next word or sentence by learning the statistical laws and semantic information of language data. As the input data set and parameter space continue to expand, the capabilities of LLM will also expand accordingly. It is used in a variety of application fields, such as machine learning, machine translation, speech recognition, image processing, etc., so it is called a multimodal large language model.
[0078] In this embodiment, the large language model can be GPT (Generative Pre-trained Transformer)-3, GPT-4, PaLM (Scaling Language Modeling with Pathways), LLaMA (Large Language Model Meta AI), etc., which are not limited here.
[0079] The historical dialogue segments, character background information and current dialogue input information are input into the large language model, and the pre-trained large language model can output monologue information.
[0080] Step 204, determining a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information;
[0081] Among them, the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue.
[0082] The above step 204 can be implemented through steps B1 to B5:
[0083] Step B1, obtaining role information corresponding to the virtual role that is in dialogue with the target object;
[0084] The role information is unique identification information used to characterize the virtual role. The role information may be a role name, a role ID, a role code, etc., which is not limited here.
[0085] Step B2, searching the original dialogue library for a plurality of first matching original dialogue segments corresponding to the specific role information matching the role information;
[0086] Based on the principle of matching the role information with the specific role information, all the original dialogue segments including the first matching original dialogue segment of the virtual role are searched from the original dialogue library.
[0087] Step B3, searching, from the plurality of first matching original dialogue segments, a plurality of second matching original dialogue segments corresponding to the specific relationship information that matches the relationship information;
[0088] Specific relationship information is used to represent the social relationship between two virtual characters in the script. In this embodiment, based on the principle of matching relationship information with specific relationship information, a second matching original dialogue segment with specific relationship information as relationship information is found from multiple first matching dialogue segments to ensure that the relationship between the target object and the virtual character is consistent with the social relationship between the two virtual characters in the script, thereby improving the adaptability of the dialogue.
[0089] Step B4, performing the following processing for each second matching original dialogue segment: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment;
[0090] The text similarity can be calculated using a similarity calculation method such as cosine similarity or Jaccard similarity, which is not limited here. The text similarity method can ensure that the determined target original dialogue segment is similar to the monologue information in text content, thereby improving the relevance of the dialogue.
[0091] Step B5: determine the second matching original dialogue segment with the highest text similarity as the target original dialogue segment.
[0092] Step 205: input the monologue information, the target original dialogue segment and the current dialogue input information into the large language model, and the large language model outputs dialogue response information corresponding to the current dialogue input information.
[0093] The large language model here can be the same language model as the large language model in the above step 203, or it can be another language model, which is not limited here. The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model, and the pre-trained large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0094] In actual use, the dialogue reply information is converted into dialogue reply text information or dialogue reply voice information; the dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast. The text display module is the above-mentioned dialogue interface, and the dialogue reply information can be specifically in text form or voice form according to the target object selected on the setting interface, which is not limited here.
[0095] In specific implementation, the current dialogue input information and dialogue response information are stored in the dialogue library as historical dialogue segments to facilitate the generation of subsequent monologue information and ensure the emotional consistency and theme continuity of the dialogue.
[0096] The embodiment of the present invention provides a device for generating a dialogue reply, which is applied to a dialogue system. Figure 3 , is a block diagram of an embodiment of a device for generating a dialogue reply provided by an embodiment of the present invention. Figure 3 As shown, the device comprises:
[0097] A first acquisition module 301 is used to acquire user information of a target object in response to current dialogue input information of the target object during a dialogue process;
[0098] The second acquisition module 302 is used to acquire the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character;
[0099] The first generation module 303 is used to generate monologue information corresponding to the current dialogue input information according to the historical dialogue segments and character background information; wherein the monologue information is dialogue reply information that meets the characteristics of the target object character;
[0100] A determination module 304 is used to determine a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue;
[0101] The second generating module 305 is used to generate dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment.
[0102] The device for generating dialogue responses provided by the embodiment of the present invention includes: in response to the current dialogue input information of the target object in the dialogue process, obtaining the user information of the target object; obtaining the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is used to characterize the character characteristics of the target object, and the character background information includes the relationship information representing the relationship between the target object and the virtual character; generating monologue information according to the historical dialogue segments and the character background information; wherein the monologue information is the dialogue response information that conforms to the character characteristics of the target object; determining the target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the character relationship between the two parties in the dialogue; generating dialogue response information corresponding to the current dialogue input information according to the monologue information, the relationship information and the target original dialogue segment. The above technical scheme can dynamically select sentence paragraphs similar to the relationship between the two parties in the dialogue from the original dialogue library based on the relationship information and the monologue information, and generate dialogue content that is more in line with the relationship between the two parties, thereby breaking the singleness of the existing virtual character dialogue output and significantly improving the natural fluency and diversity of the dialogue.
[0103] Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention, Figure 4 The electronic device 500 shown includes: at least one processor 501, a memory 502, at least one network interface 504 and other user interfaces 503. The various components in the electronic device 500 are coupled together via a bus system 505. It is understood that the bus system 505 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 505 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 505 is not shown in FIG. Figure 4 Various buses are labeled as bus system 505 .
[0104] The user interface 503 may include a display, a keyboard, or a pointing device (eg, a mouse, a trackball, a touch pad, or a touch screen).
[0105] It can be understood that the memory 502 in the embodiment of the present invention can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM) and direct RAM bus random access memory (DRRAM). The memory 502 described herein is intended to include, but is not limited to, these and any other suitable types of memory.
[0106] In some implementations, the memory 502 stores the following elements, executable units or data structures, or a subset thereof, or an extended set thereof: an operating system 5021 and an application program 5022 .
[0107] The operating system 5021 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic services and process hardware-based tasks. The application 5022 includes various application programs, such as a media player (Media Player), a browser (Browser), etc., which are used to implement various application services. The program for implementing the method of the embodiment of the present invention can be included in the application 5022.
[0108] In the embodiment of the present invention, by calling the program or instruction stored in the memory 502, specifically, the program or instruction stored in the application 5022, the processor 501 is used to execute the method steps provided by each method embodiment, for example, including:
[0109] Responding to current dialogue input information of the target object during the dialogue process, acquiring user information of the target object;
[0110] Acquire historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information representing the relationship between the target object and the virtual character;
[0111] Generate monologue information corresponding to the current dialogue input information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that meets the characteristics of the target character;
[0112] Determine the target original dialogue segment from the original dialogue database based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue;
[0113] Generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0114] In a possible implementation, obtaining the historical dialogue segments and character background information of the target object based on the user information includes:
[0115] Querying and obtaining historical conversation segments matching the user information from the conversation database; wherein the conversation database stores the corresponding relationship between the historical conversation segments and the user information;
[0116] The character background information matching the user information is queried from the character background information database; wherein the character background information database stores the corresponding relationship between the character background information and the user information.
[0117] In a possible implementation, generating monologue information corresponding to current dialogue input information according to historical dialogue segments and character background information includes:
[0118] The historical dialogue segments, character background information and current dialogue input information are input into the large language model, and the large language model outputs monologue information.
[0119] In a possible implementation, the original dialogue library stores a plurality of original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment;
[0120] Search the target original dialogue segment from the original dialogue library based on the relationship information and monologue information, including:
[0121] Obtaining role information corresponding to the virtual role that is in dialogue with the target object;
[0122] Searching for a plurality of first matching original dialogue segments corresponding to specific character information matching the character information from an original dialogue library;
[0123] Searching for a plurality of second matching original dialogue segments corresponding to specific relationship information matching the relationship information from the plurality of first matching original dialogue segments;
[0124] The following processing is performed for each second matching original dialogue segment: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment;
[0125] The second matching original dialogue segment with the highest text similarity is determined as the target original dialogue segment.
[0126] In a possible implementation, generating dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment includes:
[0127] The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0128] In one possible implementation, the method further includes:
[0129] The current dialogue input information and dialogue reply information are stored in the dialogue library.
[0130] In one possible implementation, the method further includes:
[0131] Generate a dialogue reply text message or a dialogue reply voice message from the dialogue reply message;
[0132] The dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast.
[0133] The method disclosed in the above embodiment of the present invention can be applied to the processor 501, or implemented by the processor 501. The processor 501 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 501 or the instruction in the form of software. The above processor 501 can be a general processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or the hardware and software units in the decoding processor can be executed. The software unit can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 502, and the processor 501 reads the information in the memory 502 and completes the steps of the above method in combination with its hardware.
[0134] It is understood that the embodiments described herein may be implemented in hardware, software, firmware, middleware, microcode, or a combination thereof. For hardware implementation, the processing unit may be implemented in one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPDevice, DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for performing the functions described in the present application, or a combination thereof.
[0135] For software implementation, the technology described herein can be implemented by a unit that performs the functions described herein. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.
[0136] The electronic device provided in this embodiment may be Figure 4 The electronic device shown in FIG. 1 may perform the following steps: Figure 1-2 All steps of the method for generating dialogue responses in , thereby achieving Figure 1-2 For details, please refer to the technical effect of the method for generating dialogue replies shown in Figure 1-2 For the sake of brevity, the relevant description is not repeated here.
[0137] The embodiment of the present invention also provides a storage medium (computer-readable storage medium). The storage medium here stores one or more programs. The storage medium may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a read-only memory, a flash memory, a hard disk or a solid-state drive; the memory may also include a combination of the above-mentioned types of memory.
[0138] When one or more programs in the storage medium can be executed by one or more processors, the above-mentioned method of generating dialogue replies can be implemented.
[0139] The processor is used to execute the program for generating a dialogue reply stored in the memory to implement the steps of the following method for generating a dialogue reply:
[0140] Responding to current dialogue input information of the target object during the dialogue process, acquiring user information of the target object;
[0141] Acquire historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information representing the relationship between the target object and the virtual character;
[0142] Generate monologue information corresponding to the current dialogue input information based on the historical dialogue segments and character background information; wherein the monologue information is dialogue response information that meets the characteristics of the target character;
[0143] Determine the target original dialogue segment from the original dialogue database based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue;
[0144] Generate dialogue response information corresponding to the current dialogue input information based on the monologue information and the target original dialogue segment.
[0145] In a possible implementation, obtaining the historical dialogue segments and character background information of the target object based on the user information includes:
[0146] Querying and obtaining historical conversation segments matching the user information from the conversation database; wherein the conversation database stores the corresponding relationship between the historical conversation segments and the user information;
[0147] The character background information matching the user information is queried from the character background information database; wherein the character background information database stores the corresponding relationship between the character background information and the user information.
[0148] In a possible implementation, generating monologue information corresponding to current dialogue input information according to historical dialogue segments and character background information includes:
[0149] The historical dialogue segments, character background information and current dialogue input information are input into the large language model, and the large language model outputs monologue information.
[0150] In a possible implementation, the original dialogue library stores a plurality of original dialogue segments, as well as specific relationship information and specific role information corresponding to each original dialogue segment;
[0151] Search the target original dialogue segment from the original dialogue library based on the relationship information and monologue information, including:
[0152] Obtaining role information corresponding to the virtual role that is in dialogue with the target object;
[0153] Searching for a plurality of first matching original dialogue segments corresponding to specific character information matching the character information from an original dialogue library;
[0154] Searching for a plurality of second matching original dialogue segments corresponding to the specific relationship information matching the relationship information from the plurality of first matching original dialogue segments;
[0155] The following processing is performed for each second matching original dialogue segment: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment;
[0156] The second matching original dialogue segment with the highest text similarity is determined as the target original dialogue segment.
[0157] In a possible implementation, generating dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment includes:
[0158] The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model, and the large language model outputs the dialogue response information corresponding to the current dialogue input information.
[0159] In one possible implementation, the method further includes:
[0160] The current dialogue input information and dialogue reply information are stored in the dialogue library.
[0161] In one possible implementation, the method further includes:
[0162] Generate a dialogue reply text message or a dialogue reply voice message from the dialogue reply message;
[0163] The dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast.
[0164] The professionals should further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0165] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0166] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating a dialogue reply, characterized in that: The method is applied to a dialogue system, and the method comprises: In response to current dialogue input information of the target object during the dialogue process, acquiring user information of the target object; Acquire the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character; Generate monologue information corresponding to the current dialogue input information according to the historical dialogue segments and the character background information; wherein the monologue information is dialogue response information that conforms to the characteristics of the target object character; Determining a target original dialogue segment from the original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue; According to the monologue information and the target original dialogue segment, dialogue reply information corresponding to the current dialogue input information is generated.
2. The method according to claim 1, characterized in that The step of acquiring the historical dialogue segments and character background information of the target object based on the user information includes: Querying and acquiring historical conversation segments matching the user information from a conversation database; wherein the conversation database stores the corresponding relationship between the historical conversation segments and the user information; The character background information matching the user information is queried from the character background information database; wherein the character background information database stores the corresponding relationship between the character background information and the user information.
3. The method according to claim 1, characterized in that The step of generating monologue information corresponding to the current dialogue input information according to the historical dialogue segment and the character background information includes: The historical dialogue segments, the character background information and the current dialogue input information are input into a large language model, and the large language model outputs the monologue information.
4. The method according to claim 1, characterized in that: The original dialogue library stores a plurality of original dialogue segments, as well as specific relationship information and specific role information corresponding to each of the original dialogue segments; The step of searching the target original dialogue segment from the original dialogue library based on the relationship information and the monologue information includes: Acquire role information corresponding to the virtual role that is in dialogue with the target object; Searching the original dialogue library for a plurality of first matching original dialogue segments corresponding to the specific role information matching the role information; Searching for a plurality of second matching original dialogue segments corresponding to the specific relationship information matching the relationship information from the plurality of first matching original dialogue segments; The following processing is performed for each of the second matching original dialogue segments: determining the text similarity of the second matching original dialogue segment based on the monologue information and the second matching original dialogue segment; The second matching original dialogue segment with the highest text similarity is determined as the target original dialogue segment.
5. The method according to claim 3, characterized in that: The step of generating dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment includes: The monologue information, the target original dialogue segment and the current dialogue input information are input into the large language model, and the large language model outputs dialogue response information corresponding to the current dialogue input information.
6. The method according to claim 2, characterized in that The method further comprises: The current dialogue input information and the dialogue reply information are stored in a dialogue library.
7. The method according to claim 1, characterized in that The method further comprises: Generating a dialogue reply text message or a dialogue reply voice message from the dialogue reply information; The dialogue reply text information is sent to the text display module of the dialogue system for display, or the dialogue reply voice information is sent to the voice broadcast module of the dialogue system for broadcast.
8. A device for generating a dialogue reply, characterized in that: The device is applied to a dialogue system, and comprises: A first acquisition module, configured to acquire user information of a target object in response to current dialogue input information of the target object during a dialogue process; A second acquisition module is used to acquire the historical dialogue segments and character background information of the target object based on the user information; wherein the character background information is information used to characterize the character characteristics of the target object, and the character background information includes relationship information indicating the relationship between the target object and the virtual character; A first generating module is used to generate monologue information corresponding to the current dialogue input information according to the historical dialogue segment and the character background information; wherein the monologue information is dialogue reply information that meets the characteristics of the target object character; A determination module, configured to determine a target original dialogue segment from an original dialogue library based on the relationship information and the monologue information; wherein the target original dialogue segment is not only similar to the monologue information in content, but also consistent with the relationship between the two characters in the dialogue; The second generating module is used to generate dialogue reply information corresponding to the current dialogue input information according to the monologue information and the target original dialogue segment, and to generate dialogue reply information corresponding to the current dialogue input information.
9. An electronic device, characterized in that: include: A processor and a memory, wherein the processor is used to execute a program for generating a dialogue reply stored in the memory to implement the method for generating a dialogue reply according to any one of claims 1 to 7.
10. A storage medium, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method for generating a dialogue reply according to any one of claims 1 to 7.
Citation Information
Patent Citations
Instant messaging message interaction method and device and computer readable storage medium
CN110581772A
Dialogue method, device and equipment, computer readable storage medium and program product
CN114048299A
Conversation relation processing method, computer and readable storage medium
CN114676705A
Dialogue generation method, dialogue model training method and device
CN115309877A
Dialogue processing method and device based on large language model and electronic equipment
CN117251552A
