Dialogue data generation method and device, electronic equipment and computer readable storage medium
By building a character type library and using the question model and response model to generate dialogue data, the problem of time-consuming acquisition of role-playing dialogue data and multiple rounds of dialogue coherence is solved, and the rapid and diverse dialogue data generation is achieved.
Patent Information
- Application Number
- CN202510591197.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-08
- Publication Date
- 2025-08-22
AI Technical Summary
In the prior art, the acquisition of role-playing dialogue data takes a long time to obtain manual annotation, and it is impossible to quickly generate a large amount of data. The existing automatic generation method is difficult to achieve the consistency and character consistency of multiple rounds of dialogue.
Build a character type library, including description information, dialogue reference information and dialogue topics of multiple character groups, use the question model and response model to generate question data and response data, and expand dialogue topics through large language models and adversarial generation networks to ensure data diversity and coherence.
It realizes the rapid generation of dialogue data, ensuring the consistency of multiple rounds of dialogue and the consistency of character characteristics, and avoiding problems and interference from the generation of a single model.
Smart Images

Figure CN120523905A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and device for generating dialogue data, an electronic device, and a computer-readable storage medium. Background Art
[0002] In recent years, role-playing chat models have demonstrated significant application value in virtual assistants, game NPC interactions, and immersive entertainment. The core of these models lies in adversarial training using massive amounts of character dialogue data, enabling them to accurately mimic the language style, behavioral logic, and personality traits of specific characters.
[0003] However, obtaining high-quality training data has become a key bottleneck hindering model performance improvement. This is because traditional role-playing dialogue data acquisition relies primarily on manual annotation, which requires people to review film and television scripts, novel texts, video footage, and other materials and then extract character dialogue data from them. This is time-consuming and cannot quickly generate large amounts of character dialogue data. Summary of the Invention
[0004] The object of the present invention is to provide a method, device, electronic device and computer-readable storage medium for generating conversation data, so as to improve the problems existing in the prior art.
[0005] The embodiments of the present invention can be implemented as follows:
[0006] In a first aspect, an embodiment of the present invention provides a method for generating conversation data, comprising:
[0007] Constructing a character type library; the character type library includes description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic;
[0008] When there is a need to generate a dialogue for a target person group and a target dialogue topic, the question model generates question data based on the target dialogue topic and the description information of the target person group;
[0009] The response model generates response data based on the question data, the target conversation topic, and the conversation reference information and description information of the target person group.
[0010] In a second aspect, an embodiment of the present invention further provides a conversation data generating device, comprising:
[0011] A construction module for constructing a character type library; the character type library includes description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic;
[0012] A generation module, configured to generate question data based on the target conversation topic and the description information of the target conversation group by the question model when there is a need to generate a conversation for the target person group and the target conversation topic;
[0013] The generation module is further configured to generate response data based on the question data, the target dialogue topic, and the dialogue reference information and description information of the target character group by the response model.
[0014] The third invention, an embodiment of the present invention further provides an electronic device, comprising: a memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the conversation data generation method as described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating conversation data described in the first aspect is implemented.
[0016] Compared to the prior art, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable storage medium for generating conversation data. First, a character type library is constructed, comprising descriptive information, conversation reference information, and at least one conversation topic associated with multiple character groups. When a conversation needs to be generated for a target character group and a target conversation topic, a question model generates question data based on the descriptive information of the target conversation topic and the target character group. A response model generates response data based on the question data, the target conversation topic, and the conversation reference information and descriptive information of the target character group. This method eliminates the need for manual extraction of conversation data. Instead, after constructing the character type library, the question model and response model are used to generate question data and response data, respectively, when a conversation needs to be generated for the target character group and the target conversation topic. This allows for rapid generation of conversation data. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 This is a flow chart of a method for generating conversation data provided by an embodiment of the present invention.
[0019] Figure 2 The second flowchart of a method for generating conversation data provided by an embodiment of the present invention.
[0020] Figure 3 This is an example diagram of a set of conversation data provided by an embodiment of the present invention.
[0021] Figure 4 A schematic structural diagram of a conversation data generating device provided by an embodiment of the present invention.
[0022] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings herein can be arranged and designed in various different configurations.
[0024] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention as claimed, but rather merely represents selected embodiments of the present invention. All other embodiments derived by persons of ordinary skill in the art based on the embodiments of the present invention without creative effort shall fall within the scope of protection of the present invention.
[0025] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, it does not need to be further defined or explained in subsequent drawings.
[0026] In addition, the terms "first", "second", etc., if used, are merely used to distinguish and describe, and should not be understood as indicating or implying relative importance.
[0027] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0028] As mentioned in the background technology section, traditional methods for acquiring role-playing dialogue data rely primarily on manual annotation, which requires people to review film and television scripts, novel texts, video materials, and other materials and then extract character dialogue data from them. This is time-consuming and cannot generate a large amount of character dialogue data.
[0029] While existing technologies can automatically generate conversational data, they often focus on single-round questions and answers, lacking dynamic control over contextual coherence and character consistency across multiple rounds. Therefore, using existing automated methods to generate role-playing conversational data is difficult to achieve coherent multi-round conversations.
[0030] Based on the discovery of the above technical problems, the inventors have proposed the following technical solutions after creative work to solve or improve the above problems. It should be noted that the defects existing in the solutions in the above prior art are the results obtained by the inventors after practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed in the embodiments of this application below for the above problems should all be the contributions made by the inventors to this application in the process of invention and creation, and should not be understood as technical contents known to those skilled in the art.
[0031] Please refer to Figure 1 , Figure 1 This is a flow chart of a method for generating conversation data provided by an embodiment of the present invention. The execution subject of this method can be, but is not limited to, electronic devices with computing and processing capabilities such as smart phones, personal notebooks, personal computers, and servers. Figure 1 The conversation data generation method may include the following steps S100 to S300.
[0032] S100, building a character type library;
[0033] In this embodiment, the character type library may include description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic.
[0034] S200: When there is a need to generate a dialogue for a target person group and a target dialogue topic, the question model generates question data according to the description information of the target dialogue topic and the target person group.
[0035] S300: The response model generates response data based on the question data, the target conversation topic, and the conversation reference information and description information of the target person group.
[0036] In this embodiment, the target character group can be any character group in the character type library, and the target dialogue topic can be any dialogue topic associated with the target character group, and the generated question data and answer data are developed around the target dialogue topic.
[0037] The method for generating conversation data provided by the present invention constructs a character type library comprising descriptive information, conversation reference information, and at least one conversation topic associated with multiple character groups. When a conversation generation requirement exists for a target character group and a target conversation topic, a question model generates question data based on the descriptive information of the target conversation topic and the target character group. A response model generates response data based on the question data, the target conversation topic, and the conversation reference information and descriptive information of the target character group. This method eliminates the need for manual conversation data extraction. Instead, after constructing the character type library, the question model and response model are used to generate question data and response data, respectively, when a conversation generation requirement exists for the target character group and the target conversation topic. This allows for rapid conversation data generation.
[0038] Next, we will introduce the process of building the character type library.
[0039] In an optional implementation, within the character type library, a character group can include a questioning avatar and a responding avatar. The descriptive information associated with a character group can include the character descriptions of the questioning avatar and the responding avatar within the group. The dialogue reference information associated with a character group can include the response reference data of the responding avatar within the group. The present invention can utilize a large language model to rapidly construct a character type library. Accordingly, the process of "constructing the character type library" in step S100 can include the following sub-steps S110 to S150.
[0040] S110: Obtain character descriptions of multiple answering virtual persons.
[0041] Optionally, multiple virtual responding characters can be preset. A virtual responding character can be identified by name or by a combination of identity and name. For example, virtual responding characters may include, but are not limited to, singing host Xiao Ming, outdoor host Xiao Hong, game commentator Xiao Zhang, e-sports player Xiao Zhao, and detective Sherlock Holmes. Character descriptions may include identity, personality, historical background, behavioral characteristics, and social attributes. Social attributes may include, but are not limited to, gender, age, ethnicity, and educational level.
[0042] The character description of each responding virtual person can be preset or generated by calling the large language model. Taking a responding virtual person (let's call it virtual person A) as an example, a simple description of virtual person A can be preset (for example, a simple description includes identity description and personality description), and then the large language model can be used to generate the character description of virtual person A as follows:
[0043] (1) Filling a simple description of the virtual person A into the first prompt template to obtain a first prompt text;
[0044] (2) Input the first prompt text into the large language model to obtain the character description of virtual person A.
[0045] The first prompt template can be used to instruct the model to expand and generate a more comprehensive character description based on a simple character description. In an optional example, the first prompt template could be: "The input content is: "{{Simple description of the virtual person being answered}}"; Based on the input content, please output a complete character description of the virtual person being answered in terms of identity, personality, historical background, behavioral characteristics, and social attributes (social attributes may include but are not limited to gender, age, education level, etc.)."
[0046] S120 . For each answering virtual person, based on the character description of the answering virtual person, call the large language model to generate a character description of at least one questioning virtual person associated with the answering virtual person.
[0047] Optionally, a second prompt template can be pre-set to instruct the model to output, based on the character description of the responding avatar, at least one questioning avatar that could potentially engage in a conversation with the responding avatar and its character description. Thus, for any responding avatar, the character description of that responding avatar can be entered into the second prompt template to generate a second prompt text. This second prompt text can then be input into the large language model to obtain at least one questioning avatar associated with that responding avatar and its character description.
[0048] In an optional example, the second prompt template can be: "The input content is: "{{Description of the answering virtual person}}"; based on the input content, please list at least K characters who may have a dialogue or chat with {{Answering virtual person}}, and provide a character description for each character. The output character description can involve aspects such as character identity, character personality, historical background, behavioral characteristics, and social attributes (social attributes may include but are not limited to gender, age, education level, etc.)." Among them, the K characters output in the template are the K questioning virtual persons. Among them, K is a positive integer, and the value of K can be 2, 3, 4, etc.
[0049] S130 : Based on the character description of each responding virtual person, call the large language model to generate response reference data for each responding virtual person.
[0050] In this embodiment, the response reference data may be a conversation between the response virtual person and others, words that the response virtual person has said, or a description of the speaking style of the response virtual person.
[0051] Optionally, a third prompt template can be pre-set to instruct the model to output reference data for the responding avatar based on the character description of the responding avatar. This allows the character description of each responding avatar to be entered into the third prompt template to generate third prompt text, which can then be input into the large language model to obtain reference data for each responding avatar's response.
[0052] In an optional example, assuming there are M responding virtual persons (M is a positive integer, and the value of M can be 10, 20, 100, etc.), the third prompt template can be: "Input content is: "{{Descriptions of M responding virtual persons}}"; based on the input content, please output the response reference data of each responding virtual person. The response reference data can be a conversation between the responding virtual person and others, words the responding virtual person has said, or a description of the responding virtual person's speaking style."
[0053] S140: Based on the character descriptions of each questioning virtual person and each answering virtual person, call the large language model to generate at least one dialogue topic associated with the character group consisting of each questioning virtual person and each answering virtual person.
[0054] In this embodiment, a questioning avatar and its associated answering avatar constitute a character group. The description information associated with this character group includes the character descriptions of both the questioning avatar and the answering avatar. Therefore, a fourth prompt template can be pre-set to instruct the model to output possible conversation topics within the character group based on the description information associated with the character group.
[0055] For each responding avatar, the large language model can be called separately through steps S120-S140 to ultimately complete the construction of the character type library. Alternatively, the large language model can be called only once for each responding avatar to generate a character description of at least one questioning avatar associated with the responding avatar, reference data for the responding avatar's response, and at least one conversation topic associated with the responding avatar and each questioning avatar, ultimately completing the construction of the character type library.
[0056] It should be noted that the large language model mentioned in steps S110 to S140 can be the same model. In the four prompt templates shown above, {{}} is a replacement placeholder. When filling in the template, the content in the {{}} part can be replaced with actual content. The above examples are merely illustrative, and the present invention does not limit the content and expression of the prompt templates, nor the replacement placeholders used in the prompt templates.
[0057] In an optional implementation, the conversation topic obtained in step S140 may be a relatively broad topic. To enhance data diversity, the conversation topic can be expanded and derived. That is, after step S140, any conversation topic obtained can be expanded by following the steps S150 to S160:
[0058] S150: Obtain a feature vector corresponding to the conversation topic and a randomly generated noise vector.
[0059] In this embodiment, any conversation topic obtained in step S140 can be encoded using natural language processing techniques (such as BERT or Word2Vec) to generate a feature vector. This feature vector is a high-dimensional vector, which can map the semantic features of the conversation topic into a high-dimensional space. The randomly generated noise vector can be Gaussian noise generated using a Gaussian operator.
[0060] S160: Input the feature vector and the noise vector into the trained generator for expansion to obtain at least one sub-dialogue topic derived from the dialogue topic.
[0061] In this embodiment, the trained generator can be a trained Generative Adversarial Network (GAN). The generator can combine the noise vector with the feature vector corresponding to the conversation topic to explore the semantic space surrounding the conversation topic, ultimately outputting at least one sub-conversation topic derived from the conversation topic. Thus, in the character type library, any conversation topic associated with each character group can be generated through step S140 or steps S150-S160.
[0062] For example, assuming that the answering avatar A is "Detective Sherlock Holmes," and the first language model outputs that the questioning avatar a1, which might potentially engage in a conversation with Holmes, is "Reporter Maria," then the conversation topics generated by step S140 between Maria and Holmes might include "Locked Room Mystery," "Suspenseful Reasoning," and "Daily Socializing." Taking the "Locked Room Mystery" conversation topic as an example, expanding it through steps S150-S160 yields three derived sub-conversation topics: "Locked Room Environment Reconstruction" and "Alibi Analysis." This example is merely illustrative and not limiting.
[0063] For the above steps S200 and S300, the question model and the answer model can be two different large language models.
[0064] For example, a question prompt template for a questioning model may be: "You are a questioning assistant. Assume that you are now a {{questioning virtual person}}. Based on the {{character descriptions of the questioning virtual person and the answering virtual person in the target character group}}, please ask questions to the {{answering virtual person}} around the topic of "{{target conversation topic}}."
[0065] For example, the answer prompt template of the answer model can be: "You are a response assistant. Assume that you are now "{{responding virtual person}}". Based on {{responding virtual person's response reference data}} and {{character descriptions of the questioning virtual person and the responding virtual person in the target character group}}, please answer the question {{question data}} around the topic "{{target conversation topic}}."
[0066] In an optional implementation, the response data output by the response model must match the character characteristics of the responding avatar to be usable. Therefore, after the response model outputs the response data, it can be determined whether the response data output by the response model matches the character description of the responding avatar. If not, a new reply text is generated. Therefore, after executing the above step S300, the character description of the responding avatar in the target character group is obtained, and then the following step S400 is continued.
[0067] S400: Based on the character description of the responding virtual person in the target character group, determine whether the response data matches the responding virtual person; if not, regenerate the response data using the questioning model.
[0068] In this embodiment, based on the response data and the character description of the responding avatar in the target character group, a large model can be called to determine whether the response data matches the character description of the responding avatar. The large model called in this case can be the same as or different from the large language model mentioned in steps S110 to S140 above.
[0069] For example, the prompt template for calling the large model can be: "You are a judgment assistant. Please analyze the character characteristics of {{responding virtual person}} from "{{character description of responding virtual person}}", and then judge whether "{{response data}}" meets the character characteristics of {{responding virtual person}}." This example is only an example and is not limited here.
[0070] Among them, if the response data does not match the response virtual person, then the response data will be discarded and the process will return to step S300 to obtain the response data regenerated by the question model, until the final response data matches the response virtual person, then the available response data will be obtained and the regeneration will stop.
[0071] In an optional implementation, the question data and response data obtained above can be combined to obtain the content of a round of dialogue. If multiple rounds of dialogue between two characters in the target character group are required, the question model and response model need to repeatedly generate dialogue content to obtain multiple rounds of dialogue content.
[0072] To ensure the continuity of the conversation, after generating a preset number of rounds (e.g., 3, 4, or 5 rounds), each subsequent round of conversation content can be generated by introducing the most recently generated N rounds (N is a positive integer, and the value of N can be 3, 5, or 7, etc.) of conversation content as historical conversation to guide the model to continue the conversation. That is, the generation process of each subsequent round of conversation content is as follows:
[0073] (1) The questioning model generates a new round of question data based on the latest N rounds of conversation content, the target conversation topic, and the description information of the target person group;
[0074] (2) The response model then generates a new round of response data based on the latest N rounds of dialogue content, question data, target dialogue topic, and dialogue reference information of the target character group.
[0075] When historical conversations are introduced, replacement placeholders for historical conversations will also be embedded in the templates that call the question model and the answer model respectively.
[0076] Optionally, each time the latest round of conversation content is obtained, it can be determined whether the latest round of conversation content meets the preset stop condition. If so, all generated conversation contents are combined in the order of generation to obtain a set of conversation data for the target person group.
[0077] Among them, the preset stop condition can be that the number of rounds of the latest round of dialogue content is equal to the preset stop rounds (such as 30 rounds or 50 rounds), or the preset stop condition can also be that the latest round of dialogue content includes a preset ending keyword or ending key sentence.
[0078] Exemplarily, the ending keywords may include but are not limited to: good night, bye, see you, talk next time, Goodbye, etc., and the ending key sentences may include but are not limited to: "Let's contact each other another day", "Let's talk about it later", "I'll leave first if I have something to do", "It's getting late, you should go to bed early", "Let's stop for today", etc.
[0079] Based on the above, it can be seen that when there is a need to generate a dialogue for a target person group and a target dialogue topic, the process of generating a set of dialogue data based on the target dialogue topic, the description information of the target person group and the dialogue reference information can be as follows: Figure 2 shown. Figure 2 In the process, step S3 and step S8 may or may not be performed, depending on the actual situation. Figure 2 The implementation principles of each step are as shown in the above content and will not be repeated here.
[0080] In an optional example, suppose that in the target group, the questioning virtual person is a cute girl who loves life, likes sweets, and likes picnics, and the answering virtual person is a girl who likes to go out and play with friends. Then the generated set of dialogue data can be as follows: Figure 3 As shown, Figure 3 For presentation purposes only, the conversation data can also be in JSON format.
[0081] Optionally, if the purpose is to construct a multi-role dialogue data set for training a role-playing model, for each dialogue topic associated with each character group in the character type library, the above Figure 2 This method generates a set of dialogue data, which can then yield several sets of dialogue data. All of the generated dialogue data can then be used to create a multi-character dialogue data set. In a multi-character dialogue data set, the dialogue data for the same character group may contain two sets of dialogue data with high repetition rates. Therefore, filtering can be done using the following two methods:
[0082] (1) Calculate the similarity coefficient (e.g., cosine similarity) between each two sets of dialogue data corresponding to a character group. If the similarity coefficient exceeds a set threshold (e.g., 0.85), delete either of the two sets of dialogue data.
[0083] (2) Randomly select two groups of dialogue data corresponding to a character group for manual verification. If the duplication is high, manually modify or delete it.
[0084] It should be noted that the execution order of the steps in the above method embodiment is not limited to that shown in the drawings, and the execution order of the steps shall be based on actual application conditions.
[0085] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0086] The present invention uses multiple preset answering virtual people and calls a large language model to build a character type library. During the construction process, the trained generator is used to expand the conversation topics, ensuring data diversity. The resulting character type library contains multiple character groups, and the conversation topics associated with each character group are also diverse.
[0087] When there is a need to conduct a dialogue with a virtual person and its associated target dialogue topic in relation to a target person group in a character type library and its associated target dialogue topic, the present invention, in the process of generating a round of dialogue content, respectively calls the question model to generate question data and calls the answer model to generate answer data. In this way, the two models are divided into two parts to obtain a round of dialogue content, thus avoiding interference and confusion caused by using the same large model to generate questions and answers.
[0088] In the process of generating a set of conversation data about a target person group and a target conversation topic, the present invention first generates N rounds of conversation content. In the process of generating each subsequent round of conversation content, the latest N rounds of conversation content are introduced as historical conversation to guide the model to continue the conversation, ensuring the coherence of the final conversation data.
[0089] In the process of generating the content of each round of dialogue, the present invention will determine whether the response data conforms to the character characteristics of the responding virtual person. If not, the response data will be regenerated, ensuring that the response data does not deviate from the character characteristics.
[0090] In order to execute the corresponding steps in the above method embodiment and various possible implementations, an implementation of a conversation data generating device is provided below.
[0091] See Figure 4 , Figure 4 The structure diagram of the conversation data generation device provided by the embodiment of the present invention is shown. The conversation data generation device 200 includes: a construction module 210 and a generation module 220.
[0092] A construction module 210 is configured to construct a character type library; the character type library includes description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic;
[0093] A generation module 220 is configured to generate question data based on the description information of the target conversation topic and the target conversation topic when there is a need to generate a conversation for the target person group and the target conversation topic;
[0094] The generation module 220 is further configured to generate response data based on the question data, the target conversation topic, and the conversation reference information and description information of the target character group by the response model.
[0095] Optionally, the description information includes a character description of each virtual person asking the question and each virtual person answering the question in the character group. Construction module 210 can be specifically configured to: obtain character descriptions of multiple virtual persons answering the question; for each virtual person answering the question, based on the virtual person answering the question's character description, invoke the large language model to generate a character description of at least one virtual person asking the question associated with the virtual person answering the question; based on the virtual person answering the question's character description, invoke the large language model to generate reference data for each virtual person answering the question; and based on the respective character descriptions of each virtual person asking the question and each virtual person answering the question, invoke the large language model to generate at least one conversation topic associated with the character group consisting of each virtual person asking the question and each virtual person answering the question.
[0096] Optionally, the construction module 210 can also be specifically used to: for each dialogue topic, obtain a feature vector and a randomly generated noise vector corresponding to the dialogue topic; input the feature vector and the noise vector into the trained generator for expansion to obtain at least one sub-dialogue topic derived from the dialogue topic.
[0097] Optionally, the description information includes a description of each of the questioning avatar and the answering avatar in the character group. The generation module 230 may also be configured to: obtain a description of the answering avatar in the target character group; determine, based on the description of the answering avatar, whether the answer data matches the answering avatar; and, if not, regenerate the answer data using the questioning model.
[0098] Optionally, the generation module 230 can also be used to: combine the question data and the answer data to obtain a round of dialogue content; repeatedly generate the dialogue content by the question model and the answer model to obtain multiple rounds of dialogue content; after generating the dialogue content of a preset round, the question model generates a new round of question data based on the latest generated N rounds of dialogue content, the target dialogue topic and the description information of the target character group; the answer model generates a new round of answer data based on the latest generated N rounds of dialogue content, the question data, the target dialogue topic and the dialogue reference information of the target character group.
[0099] Optionally, the generation module 230 may also be configured to: if the latest round of conversation content meets a preset stop condition, combine all generated conversation content in a generation order to obtain a set of conversation data for the target person group.
[0100] Optionally, the generation module 230 may also be used to: obtain at least one set of dialogue data for each character group; determine a similarity coefficient between every two sets of dialogue data; and if the similarity coefficient exceeds a set threshold, remove either set of dialogue data.
[0101] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working process of the conversation data generating device 200 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0102] See Figure 5 , Figure 5 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. The electronic device 300 includes a processor 310 , a memory 320 , and a bus 330 , wherein the processor 310 is connected to the memory 320 via the bus 330 .
[0103] Memory 320 can be used to store software programs, such as the software program corresponding to the conversation data generation device 200 provided in the embodiment of the present invention. Processor 310 executes the software program stored in memory 320 to perform various functional applications and data processing to implement the conversation data generation method provided in the embodiment of the present invention.
[0104] Among them, the memory 320 can be but is not limited to: RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0105] Processor 310 can be an integrated circuit chip with signal processing capabilities. Processor 310 can be a general-purpose processor, including a CPU (Central Processing Unit), a Network Processor (NP), or a System on Chip (SoC). It can also be a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0106] I understand. Figure 5 The structure shown is for illustration only. The electronic device 300 may also include Figure 5 More or fewer components than shown, or with Figure 5 Different configurations shown. Figure 5 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0107] Embodiments of the present invention further provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method for generating conversation data disclosed in the above embodiments. The computer-readable storage medium may be, but is not limited to, a USB flash drive, a mobile hard drive, ROM, RAM, PROM, EPROM, EEPROM, a FLASH disk, or an optical disk, among other media capable of storing program code.
[0108] In summary, embodiments of the present invention provide a method, apparatus, electronic device, and computer-readable storage medium for generating conversation data. First, a character type library is constructed, comprising descriptive information, conversation reference information, and at least one conversation topic associated with multiple character groups. When a conversation generation requirement exists for a target character group and a target conversation topic, a question model generates question data based on the descriptive information of the target conversation topic and the target character group. A response model generates question data based on the question data, the target conversation topic, and the conversation reference information and descriptive information of the target character group. This invention eliminates the need for manual extraction of conversation data. Instead, after constructing the character type library, if a conversation generation requirement exists for a target character group and a target conversation topic, the question model and response model are used to generate question data and response data, respectively, thereby enabling rapid generation of conversation data.
[0109] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.
Claims
1. A method for generating conversation data, characterized in that: include: Constructing a character type library; the character type library includes description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic; When there is a need to generate a dialogue for a target person group and a target dialogue topic, the question model generates question data based on the target dialogue topic and the description information of the target person group; The response model generates response data based on the question data, the target conversation topic, and the conversation reference information and description information of the target person group.
2. The method for generating conversation data according to claim 1, wherein: The description information includes a character description of each of the questioning virtual person and the answering virtual person in the character group; The dialogue reference information includes the response reference data of the response virtual person; The step of constructing a character type library includes: Obtain character descriptions of multiple responding virtual persons; For each of the answering virtual persons, based on the character description of the answering virtual person, calling a large language model to generate a character description of at least one questioning virtual person associated with the answering virtual person; Based on the character description of each responding virtual person, calling the large language model to generate response reference data of each responding virtual person; Based on the character descriptions of each questioning virtual person and the answering virtual person, the large language model is called to generate at least one dialogue topic associated with the character group composed of each questioning virtual person and the answering virtual person.
3. The method for generating conversation data according to claim 2, wherein: The step of constructing a character type library further includes: For each of the conversation topics, obtaining a feature vector corresponding to the conversation topic and a randomly generated noise vector; The feature vector and the noise vector are input into the trained generator for expansion to obtain at least one sub-dialogue topic derived from the dialogue topic.
4. The method for generating conversation data according to claim 1, wherein: The description information includes a character description of each of the questioning virtual person and the answering virtual person in the character group; the method further includes: Obtaining a character description of a responding virtual person in the target character group; Based on the character description of the responding virtual person, determining whether the responding data matches the responding virtual person; If not, the answer data is regenerated by the question model.
5. The method for generating conversation data according to any one of claims 1 to 4, characterized in that: The method further comprises: Combining the question data and the answer data to obtain a round of dialogue content; The questioning model and the answering model repeatedly generate dialogue content to obtain multiple rounds of dialogue content; After generating the preset rounds of conversation content, the questioning model generates a new round of question data based on the latest N rounds of conversation content, the target conversation topic, and the description information of the target person group; where N is a positive integer; The response model generates a new round of response data based on the latest generated N rounds of dialogue content, the question data, the target dialogue topic and the dialogue reference information of the target person group.
6. The method for generating conversation data according to claim 5, wherein: The method further comprises: If the latest round of conversation content meets the preset stop condition, all generated conversation contents are combined according to the generation order to obtain a set of conversation data of the target person group.
7. The method for generating conversation data according to claim 6, wherein: The method further comprises: Obtaining at least one set of dialogue data for each character group; Determine the similarity coefficient between each two sets of conversation data; If the similarity coefficient exceeds a set threshold, either of the two groups of conversation data will be eliminated.
8. A conversation data generating device, characterized in that: include: A construction module for constructing a character type library; the character type library includes description information associated with multiple character groups, dialogue reference information, and at least one dialogue topic; A generation module, configured to generate question data based on the target conversation topic and the description information of the target conversation group by the question model when there is a need to generate a conversation for the target person group and the target conversation topic; The generation module is further configured to generate response data based on the question data, the target dialogue topic, and the dialogue reference information and description information of the target character group by the response model.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory stores a software program, and when the electronic device is running, the processor executes the software program to implement the conversation data generation method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for generating conversation data according to any one of claims 1 to 7 is implemented.