Role dialogue generation method and device, equipment, storage medium and program product

By obtaining dialogue context and role information in group chat scenarios, and using a model to predict the roles in the next round of group chat and generate dialogue content, the problem of inaccurate role matching in group chat scenarios is solved, the accuracy and flexibility of dialogue generation are improved, and the user experience is enhanced.

CN119808945BActive Publication Date: 2025-10-24BEIJING VOLCANO ENGINE TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411876530.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-10-24
Estimated Expiration
2044-12-18

AI Technical Summary

Technical Problem

In current group chat scenarios, it is difficult to accurately match the dialogue role corresponding to the user's dialogue request, resulting in insufficient flexibility in dialogue content generation, which affects the accuracy of generation and user experience.

Method used

By obtaining the conversation context data and role information of the group chat scenario, and using the role speech prediction model and the group chat conversation model, the group chat roles of the next round of group chat conversation are predicted and the corresponding conversation content is generated.

Benefits of technology

The accuracy and flexibility of generating conversation content in group chat scenarios have been improved, enhancing the user's group chat experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119808945B_ABST
    Figure CN119808945B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of computers, and discloses a role dialogue generation method and device, equipment, a storage medium and a program product. The method comprises: obtaining dialogue context data and group chat role information of a current group chat scene; determining a group chat role participating in a next round of group chat dialogue in the current group chat scene based on dialogue features of the dialogue context data and role features of the group chat role information; and generating dialogue content of the group chat role in the current group chat scene based on the dialogue context data. Through the technical solution of the present disclosure, the determination of the group chat role and the generation of the dialogue content can accurately simulate the actual group chat scene, improve the generation accuracy and flexibility of the dialogue content in the group chat scene, and ensure the group chat experience of the user.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the technical field of computer, in particular to a role dialogue generation method and device, equipment, storage medium and program product. BACKGROUND

[0002] With the wide application of large language models, many current application programs can construct a group chat scene based on a large model to provide a group chat experience of a user with a virtual object. However, the current group chat scene is difficult to accurately match a dialogue role corresponding to a dialogue request of the user, resulting in that the generation of dialogue content is not flexible enough, which affects the generation accuracy of dialogue content and the group chat experience of the user. SUMMARY

[0003] Therefore, the present disclosure provides a role dialogue generation method and device, equipment, storage medium and program product to solve the problem that the dialogue content generation effect is poor due to the difficulty in accurately predicting the dialogue role.

[0004] In a first aspect, the present disclosure provides a role dialogue generation method, comprising: obtaining dialogue context data and group chat role information of a current group chat scene; determining a group chat role participating in a next round of group chat dialogue in the current group chat scene based on dialogue features of the dialogue context data and role features of the group chat role information; and generating dialogue content of the group chat role in the current group chat scene based on the dialogue context data.

[0005] In a second aspect, the present disclosure provides a role dialogue generation device, comprising: an obtaining module configured to obtain dialogue context data and group chat role information of a current group chat scene; a group chat role determination module configured to determine a group chat role participating in a next round of group chat dialogue in the current group chat scene based on dialogue features of the dialogue context data and role features of the group chat role information; and a dialogue content generation module configured to generate dialogue content of the group chat role in the current group chat scene based on the dialogue context data.

[0006] In a third aspect, the present disclosure provides a computer device, comprising a memory and a processor, which are in communication connection with each other, and the memory stores computer instructions, and the processor executes the computer instructions to perform the role dialogue generation method of the first aspect or any of the corresponding embodiments thereof.

[0007] In a fourth aspect, the present disclosure provides a computer readable storage medium, which stores computer instructions, and the computer instructions are used to make a computer execute the role dialogue generation method of the first aspect or any of the corresponding embodiments thereof.

[0008] In a fifth aspect, the present disclosure provides a computer program product, comprising computer instructions for causing a computer to execute the method for generating a character dialogue according to the first aspect or any corresponding embodiment thereof.

[0009] The disclosed method, apparatus, device, storage medium, and program product for generating role conversations combine conversation context data obtained from the current group chat scenario and information about the group chat roles participating in the current group chat scenario to predict the group chat roles that will participate in the next round of group chat conversations based on the conversation characteristics of the conversation context data and the role characteristics of the group chat role information. This allows for accurate matching of conversation requests in the current group chat scenario with corresponding group chat roles. At the same time, the corresponding conversation content is generated for the group chat roles based on the conversation context data. This allows the determination of group chat roles and the generation of conversation content to accurately simulate actual group chat scenarios, improving the accuracy and flexibility of conversation content generation in group chat scenarios and ensuring a user-friendly group chat experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the related technologies, the following briefly introduces the drawings required for use in the specific embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0011] Figure 1 is a flowchart of a method for generating character dialogue according to an embodiment of the present disclosure;

[0012] Figure 2 is a flowchart of another method for generating character dialogue according to an embodiment of the present disclosure;

[0013] Figure 3 is a schematic diagram of generating group chat roles and their conversation contents according to an embodiment of the present disclosure;

[0014] Figure 4 is a flowchart of a model training method according to an embodiment of the present disclosure;

[0015] Figure 5 is a schematic diagram of a specific implementation of model training according to an embodiment of the present disclosure;

[0016] Figure 6 is a structural block diagram of a device for generating character dialogues according to an embodiment of the present disclosure;

[0017] Figure 7 Schematic diagram of the hardware structure of the computer device according to the embodiment of the present disclosure. DETAILED DESCRIPTION

[0018] The technical solutions of the embodiments of the present disclosure will be described clearly and completely below with reference to the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by a person skilled in the art without creative work are within the protection scope of the present disclosure.

[0019] It can be understood that, before using the technical solutions disclosed in the embodiments of the present disclosure, the type, use range, use scenario, etc. of the personal information involved in the present disclosure should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.

[0020] For example, in response to receiving the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require obtaining and using the personal information of the user. Thus, the user can voluntarily choose whether to provide the personal information to the electronic device, application program, server or storage medium, etc. software or hardware performing the operation of the technical solutions of the present disclosure according to the prompt information.

[0021] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending prompt information to the user may, for example, be a pop-up window manner, and the prompt information may be presented in the form of text in the pop-up window. In addition, the pop-up window may also carry selection controls for the user to select "agree" or "disagree" to provide personal information to the electronic device.

[0022] It can be understood that the above notification and user authorization process is only illustrative and does not limit the implementation of the present disclosure, and other manners meeting the relevant laws and regulations can also be applied to the implementation of the present disclosure.

[0023] It can be understood that the data involved in the present technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of the relevant laws and regulations and relevant provisions.

[0024] Many application programs can currently construct a group chat scene based on a large model to provide a group chat experience of a virtual object for a user. When the user initiates a dialogue request, the group chat scene can determine a dialogue role that needs to be replied according to the dialogue request, but due to a large number of virtual objects in the group chat scene, it is difficult to accurately match the dialogue role corresponding to the dialogue request of the user, resulting in that the generation of dialogue content is not flexible enough, which affects the generation accuracy of dialogue content and the group chat experience of the user.

[0025] Based on this, the technical scheme of the present disclosure can predict the group chat role participating in the next round of group chat dialogue in combination with the context data and the pre-set group chat role information, and generate dialogue content matched therewith, so as to ensure that the determination of the group chat role and the generation of the dialogue content can accurately simulate the actual group chat scene and improve the group chat experience of the user.

[0026] According to the embodiments of the present disclosure, a role dialogue generation method is provided. It should be noted that the steps shown in the flowchart can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in a different order.

[0027] In the present embodiment, a role dialogue generation method is provided, which can be used in computer devices such as computers, mobile phones, tablet computers, etc. Figure 1 is a flowchart of the role dialogue generation method according to the embodiments of the present disclosure, as shown in Figure 1 The flowchart includes the following steps:

[0028] In step S101, dialogue context data and group chat role information of the current group chat scene are obtained.

[0029] The current group chat scene is a dialogue scene composed of multiple dialogue objects. Specifically, the multiple dialogue objects include multiple virtual objects and at least one real object, and each dialogue object has a corresponding role setting. The group chat scene is constructed by the user through an application program deployed in the computer device. The dialogue information generated by each dialogue object in the group chat scene is collected according to the dialogue order, and the dialogue context data generated in the current group chat scene is obtained.

[0030] The group chat role information is the role information possessed by each dialogue object in the group chat scene, including the role personality, background, and ability of the dialogue object. The group chat role information is pre-set by the user according to the group chat requirements, and can be determined by analyzing the attribute information of each dialogue object.

[0031] In step S102, based on the dialogue features of the dialogue context data and the role features of the group chat role information, the group chat role participating in the next round of group chat dialogue in the current group chat scene is determined.

[0032] Conversation features are characteristics of the conversation information of each conversation partner in a group chat scenario. These features may include conversation participation, value information contribution, and other factors. Specifically, by analyzing the conversation context data, we can identify the most active conversation partner in the conversation and detect whether their speech receives responses and interactions from other conversation partners. This allows us to determine the participation and contribution of each conversation partner in the conversation context data. Combined with these participation and contribution levels, we can determine the conversation features possessed by each conversation partner.

[0033] Role characteristics are attributes of group chat roles, which may include each group chat role's activity level within the conversation context, role background, social knowledge, etc. Specifically, by analyzing conversation context data and group chat role information, we can determine the more active group chat roles in the group chat scene and identify group chat roles with social knowledge or social skills on specific topics.

[0034] By combining conversational and role characteristics, we match the participation and contribution levels in conversational context data with the social knowledge, activity, and background of group chat roles. Based on the roles' historical performance and their current conversational performance, we predict which group chat roles are likely to participate in the next round of conversation. This matching analysis allows us to more accurately identify the group chat roles most likely to participate in the next round of conversation.

[0035] In some specific examples, if a character provides key information during a chat and other conversation partners express interest in that key information, that character can be selected as a group chat role to continue participating in the next round of conversation. If a character raises a question in a group chat that sparks discussion, that character can be selected as a group chat role to guide the conversation in the next round. If a character shows a strong desire to participate in the conversation and is able to actively respond to the comments of other conversation partners, that character can be selected as a group chat role to actively participate in the next round of conversation.

[0036] Step S103: Generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.

[0037] Analyze the conversation context data generated in the current group chat scenario to determine the conversation logic of the group chat role in the conversation context data. Then, based on the conversation logic and historical conversation information, generate the conversation content that the group chat role needs to respond to in the current group chat scenario.

[0038] The method for generating role conversations provided in this embodiment combines conversation context data obtained from the current group chat scenario with information about the group chat roles participating in the current group chat scenario to predict the group chat roles that will participate in the next round of group chat conversations based on the conversation characteristics of the conversation context data and the role characteristics of the group chat role information. This method accurately matches the corresponding group chat roles to the conversation requests in the current group chat scenario and simultaneously generates corresponding conversation content for the group chat roles based on the conversation context data. This allows the determination of group chat roles and the generation of conversation content to accurately simulate actual group chat scenarios, improving the accuracy and flexibility of conversation content generation in group chat scenarios and ensuring a superior user experience.

[0039] In this embodiment, a method for generating character dialogues is provided, which can be used on computer devices such as computers, mobile phones, tablet computers, etc. Figure 2 is a flow chart of a method for generating character dialogues according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:

[0040] Step S201: Acquire the conversation context data and group chat role information of the current group chat scene. Please refer to the description of the corresponding steps in the above embodiment for details, which will not be repeated here.

[0041] Step S202: determining the group chat roles that will participate in the next round of group chat dialogue in the current group chat scenario based on the dialogue features of the dialogue context data and the role features of the group chat role information.

[0042] Specifically, the above step S202 includes: based on the conversation features of the conversation context data and the role features of the group chat role information, determining the group chat role participating in the next round of group chat conversation in the current group chat scene through the trained role speech prediction model.

[0043] The role speech prediction model is used to predict the group chat role in the next round of group chat dialogue. The role speech prediction model is deployed in a computer device. Figure 3 As shown, the conversation context data of the current group chat scene and the group chat role information are input into the role speech prediction model, so that the role speech prediction model can extract the conversation features possessed by the conversation context data and the role features possessed by the group chat role information, so that the role speech prediction model can combine the conversation features and the role features to output the group chat roles participating in the next round of group chat conversation in the current group chat scene.

[0044] Among them, the role speech prediction model can be obtained by training based on the model architecture of a large language model, or by training based on the model architecture of a neural network. Of course, it can also be trained based on other model architectures. There is no specific limitation here, as long as it can complete the prediction of group chat roles.

[0045] In some optional implementations, the method further includes: in response to a role selection operation for the current group chat scenario, determining a group chat role to participate in a next round of group chat dialogue based on the role selection operation.

[0046] The role selection operation is the selection operation of the real dialogue object in the current group chat scene for the next round of group chat roles. Figure 3 As shown, when the real dialogue object (ie, user) participating in the group chat triggers a role selection operation, the current group chat scene can respond to the role selection operation and select a group chat role to participate in the next round of group chat dialogue from multiple dialogue roles in the current group chat scene.

[0047] In the above implementation, the group chat role participating in the next round of group chat dialogue is determined through a role selection operation, which improves the flexibility of selecting the group chat role.

[0048] Step S203: Generate the conversation content of the group chat role in the current group chat scene based on the conversation context data.

[0049] Specifically, the above step S203 includes: based on the conversation context data, generating the conversation content of the group chat role in the current group chat scene through the trained group chat conversation model.

[0050] The group chat dialogue model is used to generate dialogue content that matches the group chat role, and the group chat dialogue model is deployed in a computer device. Figure 3 As shown, the conversation context data of the current group chat scenario is input into the group chat conversation model, so that the group chat conversation model can extract conversation attribute information such as conversation information, conversation order, and conversation logic from the conversation context data, so that the group chat conversation model can output the conversation content of the group chat role in the next round of group chat conversation in combination with the extracted conversation attribute information.

[0051] Among them, the group chat dialogue model can be obtained by training based on the model architecture of a large language model, based on the model architecture of deep learning, or based on the model architecture of a neural network. Of course, it can also be trained based on other model architectures. There is no specific limitation here, as long as it can complete the generation of dialogue content that matches the group chat role.

[0052] The role dialogue generation method provided by the embodiment determines the group chat role participating in the next round of group chat dialogue in the current group chat scene through the trained role utterance prediction model, and generates the dialogue content of the group chat role in the current group chat scene through the trained group chat dialogue model. Thus, the prediction of the group chat role and the generation of the dialogue content are controlled by two models respectively, the independence of the group chat role determination and the dialogue content generation is realized, the role utterance prediction model and the group chat dialogue model can be flexibly adjusted, and the accuracy of determining the group chat role and the accuracy of generating the dialogue content are improved.

[0053] In some optional embodiments, as shown in Figure 4 The training manner of the role utterance prediction model and the group chat dialogue model includes:

[0054] In step S301, dialogue data between roles is collected, and role information participating in the dialogue is extracted from the dialogue data.

[0055] The dialogue data is data generated by dialogue between different roles, and the role information is information such as role attributes, personalities, backgrounds, and language styles possessed by dialogue objects participating in the dialogue. Specifically, dialogue data between roles is extracted from an authorized access data source, and role-related content carried in the dialogue data is parsed. Role information for each role is generated in reverse by a large model according to the role-related content, and specifically includes personalities of each role, association relationships between different roles, background knowledge of each role, and abilities possessed by each role.

[0056] In some optional embodiments, the above step S301 includes:

[0057] In step a1, a first dialogue data source of a literary genre is obtained, and dialogue data between roles is extracted from the first dialogue data source.

[0058] The first dialogue data source is a data source of a literary genre, that is, dialogue data included in a literary work. The first dialogue data source can be a novel, a fairy tale, a short story, a poem, a drama, etc., and the type of the literary genre is not specifically limited here.

[0059] The text content in the first dialogue data source is parsed, and text content irrelevant to the dialogue data is filtered out, and relevant content corresponding to each role contained in the text content is extracted from the text content, and dialogue data between each role is extracted from the relevant content.

[0060] In step a2, a second dialogue data source of a social genre is obtained, and dialogue data between roles is extracted from the second dialogue data source.

[0061] The second dialogue data source is a social genre data source, i.e., dialogue data included in a social application. The second dialogue data source includes a plurality of different roles. By analyzing different roles in the social application, dialogue data generated by different roles in the social application is determined. Then, the dialogue data is directly pulled, as shown in Figure 5

[0062] In the above embodiments, dialogue data between roles is extracted from different dialogue data sources, which makes the dialogue data more abundant and helps improve the model training effect.

[0063] In some optional embodiments, the step a1 includes:

[0064] Step a11, extracting dialogue slices from the first dialogue data source according to a preset length.

[0065] Step a12, extracting dialogue data between roles from the dialogue slices according to a dialogue order between roles.

[0066] The preset length is a pre-set slice length, for example, slicing according to a page length or slicing according to a chapter length, and the preset length is not limited here.

[0067] As shown in Figure 5 , the dialogue text content in the first dialogue data source is sliced according to the preset length to obtain a plurality of dialogue slices. The dialogue content in each dialogue slice is analyzed to determine the roles present in the dialogue slice and the dialogue order of the roles in the dialogue content. Thus, dialogue data generated between different roles is extracted from the dialogue content of the dialogue slice according to the dialogue order.

[0068] In the above embodiments, the first dialogue data source of the literature genre is processed by dialogue slicing according to a preset length, and dialogue data between roles is extracted from the slices according to a dialogue order. Thus, the processing difficulty of long text content is reduced, the processing efficiency of long text content is improved, and the extraction error of dialogue data is avoided, thereby improving the extraction accuracy of dialogue data.

[0069] In some optional embodiments, after collecting dialogue data between roles, the above method further includes:

[0070] Filtering irrelevant content in the dialogue data to obtain filtered dialogue data; and / or, converting the data format of the dialogue data according to a preset format.

[0071] ​Irrelevant content is content irrelevant to the dialogue data, and specifically can include meaningless dialogue content (e.g., a work introduction of a literary work, etc.), non-compliant dialogue content (e.g., insults, immoral text content, etc.), and repetitive dialogue content. The dialogue content in the dialogue data is parsed, it is detected whether the irrelevant content is contained therein, if the dialogue data contains meaningless dialogue content, non-compliant dialogue content, and repetitive dialogue content, etc. irrelevant content, the meaningless dialogue content, non-compliant dialogue content, and repetitive dialogue content in the dialogue data are filtered, and filtered dialogue data is obtained.

[0072] The preset format is a pre-set data format. In order to be able to unify the dialogue data extracted from the first dialogue data source, after the dialogue data is collected, if the data format of the dialogue data does not match the preset format, the data format of the dialogue data is converted according to the preset format, so as to obtain a dialogue data format matching the preset format. For example, add a pair of parentheses to the dialogue data generated for each role.

[0073] As shown in Figure 5 After collecting the dialogue data between the roles, the irrelevant content in the dialogue data is filtered, and the data format of the filtered dialogue data is converted according to the preset format, so as to complete the data cleaning of the dialogue data.

[0074] In the above embodiment, the collected dialogue data is filtered and / or data format converted to improve the quality of the dialogue data, further improving the model training effect.

[0075] Step a3, analyzing the role dialogue features of each role participating in the dialogue in the dialogue data.

[0076] Step a4, determining the role information of the role participating in the dialogue based on the role dialogue features.

[0077] The role dialogue features are the features possessed by the role in the dialogue generation, such as language style, dialogue words, attitude, etc. The dialogue content corresponding to each role in the dialogue data is analyzed to determine the language style, words, tone, attitude, and dialogue purpose of each role in the dialogue. Then, the role dialogue features possessed by each role in the dialogue are analyzed, and the role information of each role participating in the dialogue, such as the role personality, role relationship, and knowledge possessed by the role, is extracted from the role dialogue features.

[0078] In the above embodiment, the role dialogue features of each role are analyzed to determine the role information of the role participating in the dialogue, so that the role information can accurately match each role, ensure that the predicted group chat role can meet the role setting, and at the same time ensure that the dialogue content corresponding to the group chat role can meet the dialogue logic.

[0079] In step S302, a multi-turn role conversation of the group chat scene is constructed based on the role information and the dialogue data.

[0080] The multi-turn role conversation is a multi-turn conversation constructed for each role. Figure 5 As shown in the figure, according to the role information corresponding to each role, for any one of the roles, a multi-turn conversation between the role and the remaining roles is constructed according to the dialogue data collected from each data source.

[0081] In some optional embodiments, the above step S302 includes:

[0082] In step b1, the dialogue data is parsed to determine the number of speeches of each role.

[0083] In step b2, the dialogue main role is determined based on the number of speeches.

[0084] In step b3, the multi-turn role conversation for the dialogue main role in the group chat scene is constructed using the role information of the dialogue main role and the dialogue data.

[0085] The number of speeches is the number of speeches of each role in the dialogue data, and each role has a unique role identifier in the dialogue data. By parsing the dialogue data, the number of times each role identifier appears in the dialogue data can be counted, which is the number of speeches.

[0086] The dialogue main role is the main speaking role in the current dialogue data. For example, there are four roles A, B, C, and D in the current dialogue data. By comparing the number of speeches of the four roles in the dialogue data, it can be determined that the dialogue main roles with more speeches are role A and role D. At this time, the dialogue data can be used to construct a multi-turn role conversation for role A; at the same time, the dialogue data can also be used to construct a multi-turn role conversation for role D. In this way, multiple role conversation training samples corresponding to the same dialogue data can be constructed.

[0087] In the above embodiments, the number of speeches of each role is determined by parsing the dialogue data, and the dialogue main role is determined according to the number of speeches, so that the multi-turn role conversation for the dialogue main role can be constructed, the dialogue training samples corresponding to multiple dialogue main roles can be constructed at the same time, the utilization rate of the dialogue data is improved, the number of constructed dialogue training samples is increased, and the dialogue training samples are enhanced. Further, on the basis of ensuring that the constructed multi-turn role conversation can meet the dialogue logic of the dialogue main role, the generation accuracy of subsequent dialogue content is improved.

[0088] Specifically, the above step b2 includes:

[0089] Step b21, compare the number of speeches of each role and determine the target role with the most speeches.

[0090] Step b22: determine the target character as the main character of the dialogue.

[0091] Compare the number of times each character speaks in the conversation data to determine the relative importance of their speech counts. Based on this relative importance, extract the target character with the most speeches from each character participating in the conversation and determine this target character as the primary character in the conversation.

[0092] In the above implementation, the number of times each character speaks is combined to determine the character with the most speeches as the main character of the dialogue, thereby ensuring the accuracy of extracting the main character of the dialogue.

[0093] Step S303 : training a role speech prediction model using the dialogue sequence and role information of multiple dialogue rounds, so that the role speech prediction model can infer the dialogue role of the next round.

[0094] The dialogue order is the order in which different characters talk to each other. Figure 5 As shown, the multiple rounds of dialogue constructed for each role have a corresponding dialogue sequence. The role speech prediction model is trained according to the dialogue sequence generated by each role during the dialogue and the role information possessed by each role, so that the role speech prediction model has the ability to predict the dialogue role. Therefore, the role speech prediction model can infer the dialogue role participating in the next round of dialogue based on the dialogue context data and group chat role information in the group chat scenario.

[0095] Step S304: Use multiple rounds of dialogue to train the group chat dialogue model so that the group chat dialogue model generates the dialogue content of the dialogue roles in the next round.

[0096] like Figure 5 As shown, the group chat dialogue model is trained for multiple rounds of dialogue constructed for each role, so that the group chat dialogue model has the ability to generate dialogue content that matches each role. Therefore, the group chat dialogue model can infer the dialogue content of the dialogue roles participating in the next round of dialogue based on the dialogue context data in the group chat scene.

[0097] The model training method provided in this embodiment uses the conversation order and role information of multiple rounds of conversations to train the role speech prediction model, and uses multiple rounds of conversations to train the group chat conversation model. In this way, the role speech prediction model and the group chat conversation model are simultaneously trained through the same set of training data, which improves the utilization rate of the training data, facilitates the improvement of the matching degree between the role speech prediction model and the group chat conversation model, ensures the fit between the group chat role prediction and the conversation content generation in the group chat scenario, and is conducive to improving the user's group chat experience.

[0098] An apparatus for generating a role dialogue is also provided in the embodiments, which is used to implement the above embodiments and preferred embodiments, and will not be described again. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementation of hardware, or a combination of software and hardware, is also possible and contemplated.

[0099] The embodiments provide an apparatus for generating a role dialogue, as shown in Figure 6 The apparatus comprises:

[0100] The obtaining module 401 is configured to obtain dialogue context data of a current group chat scenario and group chat role information.

[0101] The group chat role determining module 402 is configured to determine a group chat role participating in a next round of group chat dialogue in the current group chat scenario based on a dialogue feature of the dialogue context data and a role feature of the group chat role information.

[0102] The dialogue content generating module 403 is configured to generate dialogue content of the group chat role in the current group chat scenario based on the dialogue context data.

[0103] In some optional embodiments, the apparatus further comprises:

[0104] The role selecting module is configured to determine the group chat role participating in the next round of group chat dialogue based on a role selection operation in response to the role selection operation for the current group chat scenario.

[0105] In some optional embodiments, the apparatus further comprises:

[0106] The model training module is configured to train a role speech prediction model and a group chat dialogue model. The role speech prediction model is configured to determine the group chat role participating in the next round of group chat dialogue in the current group chat scenario, and the group chat dialogue model is configured to generate the dialogue content of the group chat role in the current group chat scenario.

[0107] In some optional embodiments, the model training module comprises:

[0108] The data collection unit is configured to collect dialogue data between roles and extract role information participating in dialogue from the dialogue data.

[0109] The dialogue construction unit is configured to construct a multi-round role dialogue of a group chat scenario based on the role information and the dialogue data.

[0110] The first model training unit is configured to train the role speech prediction model using dialogue sequences and role information of the multi-round dialogue, so that the role speech prediction model predicts dialogue roles of the next round.

[0111] The second model training unit is configured to train the group chat dialogue model by using the multi-round dialogue, so that the group chat dialogue model generates dialogue content of a dialogue role in a next round.

[0112] In some optional embodiments, the data collection unit comprises:

[0113] The first data collection sub-unit is configured to obtain a first dialogue data source of a literary genre, and extract dialogue data between roles from the first dialogue data source.

[0114] The second data collection sub-unit is configured to obtain a second dialogue data source of a social genre, and extract dialogue data between roles from the second dialogue data source.

[0115] The feature analysis sub-unit is configured to analyze role dialogue features of each role participating in the dialogue in the dialogue data.

[0116] The role information determination sub-unit is configured to determine role information of the roles participating in the dialogue based on the role dialogue features.

[0117] In some optional embodiments, the first data collection sub-unit is specifically configured to extract dialogue slices from the first dialogue data source according to a preset length, and extract dialogue data between roles from the dialogue slices according to a dialogue order between the roles.

[0118] In some optional embodiments, the data collection unit further comprises:

[0119] The filtering sub-unit is configured to filter irrelevant content in the dialogue data to obtain filtered dialogue data.

[0120] The format conversion sub-unit is configured to convert a data format of the dialogue data according to a preset format.

[0121] In some optional embodiments, the dialogue construction unit comprises:

[0122] The speaking frequency determination sub-unit is configured to analyze the dialogue data to determine a speaking frequency of each role.

[0123] The main role determination sub-unit is configured to determine a dialogue main role based on the speaking frequency.

[0124] The construction sub-unit is configured to construct multi-round role dialogues of the dialogue main role in the group chat scene by using the role information of the dialogue main role and the dialogue data.

[0125] In some optional embodiments, the main role determination sub-unit is specifically configured to compare the speaking frequencies of the roles to determine a target role with a high speaking frequency, and determine the target role as the dialogue main role.

[0126] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0127] The device for generating character dialogues in this embodiment is presented in the form of functional units, where the units refer to ASIC (Application Specific Integrated Circuit) circuits, processors and memories that execute one or more software or fixed programs, and / or other devices that can provide the above functions.

[0128] The device for generating role conversations provided in this embodiment combines conversation context data acquired from the current group chat scenario with information about the group chat roles participating in the current group chat scenario to predict the group chat roles that will participate in the next round of group chat conversations based on the conversational features of the conversation context data and the role features of the group chat role information. This accurately matches the corresponding group chat roles for the conversation requests in the current group chat scenario and, based on the conversation context data, generates corresponding conversation content for the group chat roles. This allows the determination of group chat roles and the generation of conversation content to accurately simulate actual group chat scenarios, improving the accuracy and flexibility of conversation content generation in group chat scenarios and ensuring a superior user experience.

[0129] The present disclosure also provides a computer device having the above Figure 6 A device for generating character dialogues shown.

[0130] See also Figure 7 , Figure 7 is a structural diagram of a computer device provided by an optional embodiment of the present disclosure, such as Figure 7 As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.

[0131] The processor 10 can be a central processing unit, a network processing unit, or a combination thereof. The processor 10 can further include a hardware chip. The hardware chip can be an application specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device can be a complex programmable logic device, a field programmable logic device, a general array logic, or any combination thereof.

[0132] The memory 20 stores instructions executable by the at least one processor 10 to cause the at least one processor 10 to perform the methods illustrated in the above embodiments.

[0133] The memory 20 can include a program storage area and a data storage area. The program storage area can store an operating system and application programs required by at least one function. The data storage area can store data created according to the use of the computer device, etc. In addition, the memory 20 can include a high-speed random access memory, and can further include a non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state memory device. In some alternative embodiments, the memory 20 can optionally include a memory disposed remotely with respect to the processor 10, and these remote memories can be connected to the computer device through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.

[0134] The memory 20 can include a volatile memory, such as a random access memory, and can also include a non-volatile memory, such as a flash memory, a hard disk, or a solid state disk. The memory 20 can further include a combination of the above-mentioned types of memories.

[0135] The computer device further includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30, and the output device 40 can be connected by a bus or other means, Figure 7 For example, by a bus connection.

[0136] The input device 30 can receive input digital or character information, and generate key signal inputs related to the user settings and function controls of the computer device, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, a pointing stick, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 can include a display device, an auxiliary lighting device (e.g., an LED), a tactile feedback device (e.g., a vibration motor), etc. The display device includes, but is not limited to, a liquid crystal display, a light emitting diode, a display, and a plasma display. In some alternative embodiments, the display device can be a touch screen.

[0137] The computer device further includes a communication interface for communication of the computer device with other devices or communication networks.

[0138] The embodiments of the present disclosure further provide a computer readable storage medium, and the method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or recorded in a storage medium, or be implemented as computer code originally stored in a remote storage medium or a non-transitory machine readable storage medium downloaded through a network and stored in a local storage medium, so that the method described herein can be processed by such software on a storage medium using a general purpose computer, a special purpose processor, or programmable or special purpose hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory, a random access memory, a flash memory, a hard disk or a solid state disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that the computer, processor, microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code, when the software or computer code is accessed and executed by the computer, processor or hardware, the method shown in the above embodiments is implemented.

[0139] Part of the present disclosure can be applied as a computer program product, for example, computer program instructions, when executed by a computer, through the operation of the computer, the method and / or technical solutions according to the present disclosure can be called or provided. Those skilled in the art should understand that the form of computer program instructions in computer readable medium includes but is not limited to source file, executable file, installation package file, etc., accordingly, the way of computer program instructions executed by computer includes but is not limited to: the computer directly executes the instructions, or the computer compiles the instructions and then executes the corresponding compiled program, or the computer reads and executes the instructions, or the computer reads and installs the instructions and then executes the corresponding installed program. Here, the computer readable medium can be any available computer readable storage medium or communication medium accessible to the computer.

[0140] Although the embodiments of the present disclosure are described in conjunction with the accompanying drawings, various modifications and changes can be made by those skilled in the art without departing from the spirit and scope of the present disclosure, and such modifications and changes fall within the scope defined by the appended claims.

Claims

1. A method for generating a role dialogue, characterized by, The method comprises: obtaining dialogue context data and group chat role information of a current group chat scene; determining a group chat role participating in a next round of group chat dialogue in the current group chat scene based on dialogue features of the dialogue context data and role features of the group chat role information, the dialogue features including at least one of dialogue participation degree and value information contribution degree, the group chat role participating in the next round of group chat dialogue in the current group chat scene being determined by a trained role speech prediction model; generating dialogue content of the group chat role in the current group chat scene based on the dialogue context data, the dialogue content of the group chat role in the current group chat scene being generated by a trained group chat dialogue model; wherein the training method of the role speech prediction model and the group chat dialogue model comprises: collecting dialogue data between roles, and extracting role information participating in dialogue from the dialogue data; constructing multi-round role dialogue of a group chat scene based on the role information and the dialogue data; the construction of the multi-round role dialogue of the group chat scene based on the role information and the dialogue data comprises: analyzing the dialogue data to determine the number of speeches of each role, the number of speeches being the number of speeches of each role in the dialogue data; determining a dialogue main role based on the number of speeches; constructing multi-round role dialogue of the group chat scene for the dialogue main role using the role information of the dialogue main role and the dialogue data; training a role speech prediction model using the dialogue order of the multi-round dialogue and the role information, so that the role speech prediction model predicts the dialogue role of the next round; training a group chat dialogue model using the multi-round dialogue, so that the group chat dialogue model generates dialogue content of the dialogue role of the next round.

2. The method of claim 1, wherein, It also includes: in response to a role selection operation for the current group chat scene, determining the group chat role participating in the next round of group chat dialogue based on the role selection operation.

3. The method of claim 1, wherein, The collection of dialogue data between roles comprises: obtaining a first dialogue data source of a literary genre, and extracting the dialogue data between roles from the first dialogue data source; and / or, obtaining a second dialogue data source of a social genre, and extracting the dialogue data between roles from the second dialogue data source.

4. The method of claim 3, wherein, The extraction of the dialogue data between roles from the first dialogue data source comprises: extracting dialogue slices from the first dialogue data source according to a preset length; extracting the dialogue data between roles from the dialogue slices according to the dialogue order between roles.

5. The method according to any one of claims 1 to 4, characterized in that, After collecting the dialogue data between roles, it further comprises: filtering irrelevant content in the dialogue data to obtain filtered dialogue data; and / or, converting the data format of the dialogue data according to a preset format.

6. The method of claim 1, wherein, The extraction of the role information participating in dialogue from the dialogue data comprises: analyzing role dialogue features of each role participating in dialogue in the dialogue data; determining the role information participating in dialogue based on the role dialogue features.

7. The method of claim 6, wherein, The determination of the dialogue main role from the role information based on the number of speeches comprises: Determine a target role with a large number of speeches based on the number of speeches of each role; Determine the target role as the main role in the conversation.

8. A device for generating character dialogues, characterized in that: The device comprises: An acquisition module configured to acquire conversation context data and group chat role information of a current group chat scenario; A group chat role determination module configured to determine a group chat role participating in a next round of group chat conversation in the current group chat scenario based on a conversation feature of the conversation context data and a role feature of the group chat role information, wherein the conversation feature comprises at least one of a conversation participation degree and a value information contribution degree, and the group chat role participating in the next round of group chat conversation in the current group chat scenario is determined by a trained role speech prediction model; A conversation content generation module configured to generate a conversation content of the group chat role in the current group chat scenario based on the conversation context data, wherein the conversation content of the group chat role in the current group chat scenario is generated by a trained group chat conversation model; and wherein the training method of the role speech prediction model and the group chat conversation model comprises: collecting conversation data between roles, and extracting role information participating in the conversation from the conversation data; constructing a multi-round role conversation of a group chat scenario based on the role information and the conversation data; the construction of the multi-round role conversation of the group chat scenario based on the role information and the conversation data comprises: analyzing the conversation data to determine the number of speeches of each role, wherein the number of speeches is the number of speeches of each role in the conversation data; determining a main role in the conversation based on the number of speeches; constructing a multi-round role conversation for the main role in the group chat scenario using the role information of the main role and the conversation data; training a role speech prediction model using the conversation order of the multi-round conversation and the role information, so that the role speech prediction model predicts a role in the next round of conversation; and training a group chat conversation model using the multi-round conversation, so that the group chat conversation model generates a conversation content of the role in the next round of conversation.

9. A computer device, comprising: Comprise: A memory and a processor, which are communicatively connected, and the memory stores computer instructions, and the processor executes the computer instructions to perform the role conversation generation method in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a computer to perform the role conversation generation method in any one of claims 1 to 7.

11. A computer program product, characterised in that, Comprise computer instructions for causing a computer to perform the role conversation generation method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and device for recognizing character in text, readable medium and electronic equipment

    CN112906380A

  • Conversation processing method and device for virtual scene, electronic equipment and storage medium

    CN115293132A

  • Multi-role dialogue implementation method and device, electronic equipment and readable storage medium

    CN118551007A