Text generation model training method and device, computer equipment and storage medium

Through text reconstruction and emotional feature processing, and combining preset templates to determine the training text, the problems of large amount of data and low model applicability in the prior art are solved, and efficient training and multi-scenario text generation models are realized.

CN119514502APending Publication Date: 2025-02-25PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411508336.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-25
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

In the prior art, training text generation models requires a large amount of data, and the trained model is less applicable, making it difficult to meet the needs of multiple dialogue scenarios.

Method used

By obtaining the first text, determining its emotional characteristic information, and performing text reconstruction processing to obtain the second text. Based on the preset text sentiment prompt template, the training text is determined in combination with the first text and the second text, and then the text generation model is trained and its parameters are adjusted.

Benefits of technology

The amount of training data required for text generation models is reduced and the applicability of the model is improved, allowing it to meet the needs of multiple dialogue scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119514502A_ABST
    Figure CN119514502A_ABST
Patent Text Reader

Abstract

The invention provides a text generation model training method and device, equipment and a storage medium. The method comprises the steps of obtaining a first text; determining first emotion feature information of the first text, and performing text reconstruction processing on the first text according to the first emotion feature information to obtain a second text; determining a training text according to the first text and the second text based on a preset text emotion prompt template; and training a to-be-trained text generation model according to the training text, and adjusting parameters of the to-be-trained text generation model according to a training result to obtain a target text generation model. According to the method, the training data volume required by the text generation model can be reduced, and the applicability of the trained text generation model can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of natural language technology, and in particular to a training method, apparatus, computer equipment and storage medium for a text generation model. Background Art

[0002] In the related art, training a dialogue generation model that can generate emotions that meet a specific dialogue scenario requires a large-scale data set that meets the emotional characteristics and semantic elements of the dialogue. Moreover, since the distribution of the data set is relatively single, the trained models can mostly only meet a single dialogue scenario. It can be seen that the related art has problems such as a large amount of training data and low applicability of the trained models. Summary of the invention

[0003] The present application provides a training method, apparatus, computer device and storage medium for a text generation model, aiming to reduce the amount of training data required for the text generation model and improve the applicability of the trained text generation model.

[0004] In a first aspect, the present application provides a method for training a text generation model, the method comprising the following steps:

[0005] Get the first text;

[0006] Determining first emotion characteristic information of the first text, and performing text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text;

[0007] Based on a preset text emotion prompt template, determining a training text according to the first text and the second text;

[0008] The training text generation model is trained according to the training text, and the parameters of the training text generation model are adjusted according to the training result to obtain the target text generation model.

[0009] In a second aspect, the present application further provides a training device for a text generation model, the training device for the text generation model comprising:

[0010] A first text acquisition module, used to acquire a first text;

[0011] A second text acquisition module, used to determine first emotion characteristic information of the first text, and perform text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text;

[0012] A training text determination module, used to determine a training text according to the first text and the second text based on a preset text emotion prompt template;

[0013] The model training module is used to train the training text generation model according to the training text, and adjust the parameters of the training text generation model according to the training result to obtain the target text generation model.

[0014] In a third aspect, the present application also provides a computer device, comprising a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the training method of the text generation model as described above are implemented.

[0015] In a fourth aspect, the present application further provides a storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the steps of the training method for the text generation model as described above are implemented.

[0016] The present application provides a training method, apparatus, device and storage medium for a text generation model. The training method for the text generation model includes obtaining a first text; determining first emotional feature information of the first text, and performing text reconstruction processing on the first text according to the first emotional feature information to obtain a second text; determining a training text according to the first text and the second text based on a preset text emotional prompt template; training a text generation model to be trained according to the training text, and adjusting parameters of the text generation model to be trained according to the training results to obtain a target text generation model. The present application determines the first emotional feature information of a first text, and fills the first text and the second text obtained by text reconstruction processing of the first text according to the first emotional feature information into a preset text emotion prompt template to obtain a training text, and trains the to-be-trained text generation model through the training text. Since the training text includes text emotional prompts, there is no need to input a large amount of training text into the to-be-trained text generation model for text emotion recognition. Therefore, the target text generation model can still have a better text generation effect when using less training text, thereby reducing the amount of training data required for the text generation model. Moreover, by adjusting the text emotional prompts in the preset text emotion prompt template, the text generation model can be trained with texts with different emotions, so that the target text generation model can meet the usage requirements of various dialogue scenarios, thereby improving the applicability of the target text generation model. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0018] Figure 1 A flowchart of a method for training a text generation model provided in an embodiment of the present application;

[0019] Figure 2 A flowchart of a method for training a text generation model provided in another embodiment of the present application;

[0020] Figure 3 A schematic diagram of the structure of a training device for a text generation model provided in one embodiment of the present application;

[0021] Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.

[0022] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0024] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0025] The embodiments of the present application provide a training method, device, computer equipment and storage medium for a text generation model. Among them, the training method of the text generation model can be applied to a terminal device, which can be an electronic device such as a tablet computer, a laptop computer, a desktop computer, etc. It can also be applied to a server, which can be a separate server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.

[0026] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0027] Please refer to Figure 1 , Figure 1Schematic flow chart of a method for training a text generation model provided by an embodiment of the present application.

[0028] As Figure 1 shown, the method for training the text generation model includes steps S101 to S104.

[0029] Step S101, obtain a first text.

[0030] Exemplarily, obtain a first text for model training, where the first text can be a text obtained by converting the voice of a user after collecting the voice through a voice collection device, or a text determined based on the input information of the user. It should be understood that the first text includes first emotional feature information, and the first emotional feature information is used to represent the emotion or feeling that the user wants to express in the first text. In some specific implementation processes, the first text includes multiple sentences, and the emotions corresponding to different sentences may be different, so that the first text includes multiple emotions. Therefore, in this case, the first text includes multiple first emotional feature information to indicate all the emotions contained in the first text.

[0031] Step S102, determine the first emotional feature information of the first text, and perform text reconstruction processing on the first text according to the first emotional feature information to obtain a second text.

[0032] Exemplarily, determine the first emotional feature information in the first text through an emotional feature recognition model, or determine the first emotional feature information in the first text according to the input data of the user, which is not limited in this application. In a specific implementation process, first texts with different emotions can be input into corresponding emotional feature recognition models, that is, through multiple emotional feature recognition models to identify first texts with multiple different emotions, so as to output the first emotional feature information corresponding to each first text; or through an emotional feature recognition model with multiple emotional feature recognition networks, recognize the text emotion of the first text and output the corresponding first emotional feature information.

[0033] In a specific implementation process, perform word segmentation processing on the first text to obtain multiple keywords in the first text. Among them, the obtained keywords include modal particles, mood words, punctuation marks, etc., so that the first emotional feature information of the first text can be determined by recognizing the modal particles, mood words, and punctuation marks in the first text. For example, the first text is: "After processing for so long, isn't it still not finished?", and the keywords obtained by word segmentation include the modal particle "isn't it" and the punctuation mark "?", and combined with other keywords such as "process", "long", "still not", etc., the first emotional feature information of the first text can be determined to at least include an impatient emotion, and then the first emotional feature information of the first text can be obtained.

[0034] It should be noted that the first emotion characteristic information of the first text can also be determined by, for example, a user directly inputting the first emotion characteristic information. The above-mentioned method for determining the first emotion characteristic information can be selected according to actual needs, and this application does not limit it.

[0035] Exemplarily, the first text is reconstructed according to the first emotional feature information, such as text rewriting, to obtain a second text. It should be understood that the emotional expression of the obtained second text is greater than that of the first text, so that the text generation model to be trained can more easily determine the emotional feature information corresponding to the second text, thereby achieving better text generation effect and improving the training efficiency of the model.

[0036] Step S103: determining a training text based on the first text and the second text based on a preset text emotion prompt template.

[0037] Exemplarily, after obtaining the second text, the first text and the second text are filled into corresponding positions in a preset text emotion prompt template to obtain a training text.

[0038] It should be understood that on the preset text emotion prompt template, there is a first position for inputting the first text and a second position for inputting the second text, so that the first text and the second text can be input into the text emotion prompt template to obtain the training text.

[0039] In some embodiments, the text emotion prompt template includes a first prompt text and a second prompt text; wherein, the first prompt text is used to indicate that the first text is the original reference text; and the second prompt text is used to indicate that the second text is a text obtained by rewriting the first text based on the first emotion feature information.

[0040] Exemplarily, the text emotion prompt template includes a first prompt text and a second prompt text, wherein, in the text emotion prompt template, the first prompt text is adjacent to the first text, and the second prompt text is adjacent to the second text, to indicate that the first text is the original reference text and the second text is the rewritten text.

[0041] Exemplarily, the text emotion prompt template also includes a third prompt text, which is used to prompt the emotion sign information of the first text, so that the obtained training text has more significant emotion feature information, thereby improving the effect of model training and reducing the amount of data required for model training.

[0042] In the specific implementation process, the text emotion prompt template includes but is not limited to at least one of the following:

[0043] Text emotion prompt template 1: Here is a text: "s pseudo" corresponds to a rewritten text based on emotion e: "r text "; Text emotional prompt template 2: Here is a text: "s pseudo ”. Rewrite it into a text with emotion e: “r text "; Text emotion prompt template 3: Here is a text: "e τ s pseudo ". The corresponding restatement is: "r text "; Text emotion prompt template 4: e τ s pseudo ,

[0044] r text .

[0045] Among them, s pseudo Used to indicate the first text, r text is used to indicate the second text, e is used to indicate the emotional feature information of the first text, and e τ Used to indicate the emotion expression keywords in the first text; it can be seen from the above-mentioned text emotion prompt template that in the text emotion prompt template 1-2, the third prompt text is included: "Based on emotion e", and in the text emotion prompt template prompt template 3-5, since the first text contains the emotion expression keywords, there is no need to record the third prompt text in the text emotion prompt template; it should be understood that the first prompt text is, for example, "Here is a text", and the second prompt text is, for example, "Change to text", "Rewrite as a...text", etc. It should be noted that technical personnel in this field can also modify the text emotion prompt template according to actual usage requirements, and this application does not limit the specific content of the text emotion prompt template.

[0046] By inputting the first text and the second text into a preset text emotion prompt template, the text generation model to be trained can achieve prompt-based learning during the text generation model training process, thereby achieving better model training effects.

[0047] Step S104: training a generation model for the text to be trained according to the training text, and adjusting parameters of the generation model for the text to be trained according to the training result to obtain a target text generation model.

[0048] Exemplarily, after generating the training text, the training text is input into the to-be-trained text generation model to train the to-be-trained text generation model to obtain the target text generation model. It should be understood that the trained target text generation model can output a corresponding response text with emotion based on the input dialogue text, thereby improving the user experience in the intelligent dialogue process and improving the accuracy of the text emotion of the text generated in the intelligent dialogue process.

[0049] In some embodiments, the training of a text generation model to be trained based on the training text and adjusting the parameters of the text generation model to be trained based on the training results to obtain a target text generation model include: inputting the training text into the text generation model to be trained to obtain a third text output by the text generation model to be trained; adjusting the parameters of the text generation model to be trained based on the third text and the first text to obtain the target text generation model.

[0050] In the specific implementation process, the training text including the first text and the second text is input into the text generation model to be trained to obtain the third text output by the text generation model to be trained, so that the parameters of the text generation model to be trained can be adjusted according to the first text and the third text to train the text generation model to be trained and obtain the target text generation model.

[0051] It should be understood that the training loss value can also be determined based on the first text and the third text based on the preset loss calculation function, so as to adjust the parameters of the text generation model to be trained based on the training loss value. Among them, the preset loss calculation function includes but is not limited to the MultiLabelSoftMarginLoss function and the MultiMarginLoss function. It should be noted that the loss calculation function can be designed and determined according to actual needs, and this application does not limit the specific loss calculation function.

[0052] In some embodiments, adjusting the parameters of the text generation model to be trained according to the third text and the first text to obtain the target text generation model includes: determining first probability distribution data that the third text, the first text and the first emotional characteristic information belong to the same conversation; determining second probability distribution data that the third text includes the first emotional characteristic information; determining third probability distribution data according to the text fluency of the third text; and adjusting the parameters of the text generation model to be trained according to at least one of the first probability distribution data, the second probability distribution data and the third probability distribution data to obtain the target text generation model.

[0053] Exemplarily, the training effect of the current time can be determined based on the relationship between the output third text and the first text, and the relationship between the output third text and the first emotional feature information, so as to adjust the parameters of the text model to be trained. Since it is expected that the text output by the target text generation model has specific dialogue behavior characteristics, the first probability distribution data of whether the third text, the first text and the first emotional feature information belong to the same dialogue can be determined to adjust whether the text output by the target text generation model has the performance of specific dialogue behavior characteristics; and it is expected that the text output by the target text generation model will not omit or add other emotional feature information, so the third text is determined to include the second probability distribution data of the first emotional feature information to ensure that the text emotion of the output text is the same or similar to that of the first text; and it is expected that the text output by the target text generation model has a certain readability and fluency, so the third probability distribution data of generating the third text is determined to adjust the readability and fluency of the text output by the text generation model. It should be understood that if the trained text generation model can meet the above expectations, the text generation model is determined as the target text generation model, thereby obtaining a trained target text generation model.

[0054] In some embodiments, the parameters of the text generation model to be trained are adjusted according to at least one of the first probability distribution data, the second probability distribution data and the third probability distribution data to obtain the target text generation model, including: determining the first probability distribution data, the second probability distribution data and the third probability distribution data corresponding to each training process of the text generation model to be trained; and determining the text generation model corresponding to when the first probability distribution data, the second probability distribution data and the third probability distribution data are all maximum as the target text generation model.

[0055] In the specific implementation process, multiple first texts are input into the text generation model to be trained multiple times to train the text generation model to be trained multiple times. In each training, the first probability distribution data, the second probability distribution data and the third probability distribution data can be obtained; in the data obtained by multiple trainings, the first probability distribution data, the second probability distribution data and the third probability distribution data are determined to be the maximum number of training times, and the text generation model obtained after the training is determined as the target text generation model, thereby completing the training of the text generation model. It should be understood that when the first probability distribution data is at a maximum value, it indicates that the text emotion of the third text currently output is closest to or the same as the text emotion of the first text, and the probability that the third text belongs to the same dialogue as the first text is also the largest; when the second probability distribution data is at a maximum value, it indicates that the accuracy of the third text currently output with the first emotional text information is the highest; when the third probability distribution data is at a maximum value, the fluency of the obtained third text is the highest, so the text generation model corresponding to the first probability distribution data, the second probability distribution data and the third probability distribution data are all at a maximum is determined as the target text generation model to complete the training of the text generation model to be trained.

[0056] See also Figure 2 , Figure 2 A flowchart of a method for training a text generation model provided in another embodiment of the present application.

[0057] like Figure 2 As shown, the training method of the text generation model also includes steps S105 to S10.

[0058] Step S105: Obtain the first conversation text.

[0059] Exemplarily, the first conversation text may be, for example, text or voice input by the customer in the intelligent customer service chat window, and this application is not limited thereto.

[0060] Exemplarily, after obtaining the target text generation model, the target text generation model can be applied to scenarios such as intelligent financial customer service, for example, in a banking application on a mobile terminal, providing dialogue information to customers through intelligent customer service.

[0061] Step S106: Based on the target text generation model, determine a second dialogue text according to the first dialogue text, where the second dialogue text is a response text to the first dialogue text.

[0062] Exemplarily, the target text generation model can output a second text with similar text emotion based on the first dialogue text input by the customer, thereby improving the customer's customer service dialogue experience. It should be understood that the similarity of text emotion information between the second dialogue text and the first dialogue text is less than or equal to a preset text emotion similarity threshold, and the second dialogue text also includes a response to the customer's demand information determined based on the first dialogue text, so that the customer can not only obtain the required information, but also experience an emotional dialogue, thereby realizing an emotional dialogue scenario and improving the customer's user experience.

[0063] Step S107: output the second dialogue text.

[0064] In a specific embodiment, the second conversation text is output to the chat window of the intelligent customer service so that the customer can get a response.

[0065] In some embodiments, the method of determining the second dialogue text according to the first dialogue text based on the target text generation model includes: determining multiple first candidate texts according to the second emotion feature information of the first dialogue text based on the emotion classification network of the target text generation model, wherein the similarity between the third emotion feature information of the first candidate text and the second emotion feature information is greater than or equal to a preset emotion feature information similarity threshold; determining the text whose text semantic accuracy is greater than or equal to the preset text semantic accuracy threshold among the multiple first candidate texts based on the text semantic screening network of the target text generation model as the second candidate text; determining the number of emotion features in the fourth emotion feature information corresponding to each second candidate text based on the emotion feature screening network of the target text generation model; and determining the second candidate text whose number of emotion features is less than or equal to the preset emotion feature number threshold as the third candidate text; determining the text with the highest text fluency among the multiple third candidate texts as the second dialogue text based on the text fluency screening network of the target text generation model.

[0066] Exemplarily, the target text generation model includes a sentiment classification network, a text semantic screening network, a second sentiment feature information screening network and a text fluency screening network; wherein the sentiment classification network is used to generate multiple first candidate texts according to the second sentiment feature information of the first dialogue text, and the similarity between the third sentiment feature information of the first candidate text and the second sentiment feature information is greater than or equal to the preset sentiment feature information similarity threshold; specifically, for example, if the third sentiment feature information includes happiness and the second sentiment feature information also includes happiness, then the similarity between the third sentiment feature information and the second sentiment feature information is 100%, and the sentiment feature information similarity threshold can also be set to 60% or 80%, which is not limited in this application. It should be understood that the similarity of sentiment feature information can also be determined by other means, which is not limited in this application; specifically, a sentiment classifier is set in the sentiment classification network to achieve the screening of texts that meet the sentiment category. The text semantic screening network is used to screen texts with text semantic accuracy greater than or equal to the preset text semantic accuracy threshold from multiple first candidate texts as second candidate texts, wherein the text semantics of the first candidate text includes but is not limited to the text semantics used to answer the first dialogue text, so that the final output text can be used to answer the first dialogue text. The sentiment feature screening network is used to determine at least one text with the least additional text sentiment among multiple second candidate texts, so that the output text has a high text sentiment similarity with the first dialogue text. The text fluency screening network is used to screen out the text with the highest text fluency to increase the readability of the text. Through the sequential screening of the above four networks, the final output second dialogue text can achieve a high semantic accuracy and text fluency, so as to achieve the effect of improving the second dialogue text output by the target text generation model, thereby improving the customer's user experience.

[0067] The training method of the text generation model provided in the above embodiment makes it easier for the text training model to determine the relationship between text and text emotion by setting text emotion prompt information in the training text. Therefore, there is no need to input a large amount of training text into the text generation model to be trained for text emotion recognition. As a result, the target text generation model can still have a better text generation effect with text emotion while using a smaller amount of training data, thereby reducing the amount of training data required for the text generation model. Moreover, by adjusting the text emotion prompt in the preset text emotion prompt template, the text generation model can be trained using texts with different emotions, so that the target text generation model can meet the usage requirements of various dialogue scenarios, thereby improving the applicability of the target text generation model.

[0068] See also Figure 3 , Figure 3 A schematic diagram of the structure of a training device for a text generation model provided in one embodiment of the present application.

[0069] like Figure 3 As shown, the training device 100 for the text generation model includes: a first text acquisition module 110 , a second text acquisition module 120 , a training text determination module 130 and a model training module 140 .

[0070] The first text acquisition module 110 is used to acquire a first text.

[0071] The second text acquisition module 120 is used to determine the first emotion characteristic information of the first text, and perform text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text.

[0072] The training text determination module 130 is used to determine the training text according to the first text and the second text based on a preset text emotion prompt template.

[0073] The model training module 140 is used to train the training text generation model according to the training text, and adjust the parameters of the training text generation model according to the training result to obtain the target text generation model.

[0074] Exemplarily, the model training module 140 includes a third text acquisition submodule.

[0075] The third text acquisition submodule is used to input the training text into the to-be-trained text generation model to obtain the third text output by the to-be-trained text generation model.

[0076] The model training module 140 is further used to adjust the parameters of the to-be-trained text generation model according to the third text and the first text to obtain the target text generation model.

[0077] Exemplarily, the model training module 140 also includes a first data determination submodule, a second data determination submodule and a third data determination submodule.

[0078] The first data determination submodule is used to determine the first probability distribution data that the third text, the first text and the first emotion feature information belong to the same conversation.

[0079] The second data determination submodule is used to determine that the third text includes second probability distribution data of the first emotional characteristic information.

[0080] The third data determination submodule is used to determine third probability distribution data according to the text fluency of the third text.

[0081] The model training module 140 is further used to adjust the parameters of the text generation model to be trained according to at least one of the first probability distribution data, the second probability distribution data and the third probability distribution data to obtain the target text generation model.

[0082] Exemplarily, the model training module 140 is also used to determine the first probability distribution data, the second probability distribution data and the third probability distribution data corresponding to each training process of the text generation model to be trained; and determine the text generation model corresponding to when the first probability distribution data, the second probability distribution data and the third probability distribution data are all maximum as the target text generation model.

[0083] Exemplarily, the text generation model training device 100 further includes a first dialogue text acquisition module, a second dialogue text generation module, and a text output module.

[0084] The first dialogue text acquisition module is used to acquire the first dialogue text.

[0085] The second dialogue text generation module is used to determine a second dialogue text based on the target text generation model and the first dialogue text, wherein the second dialogue text is a response text of the first dialogue text.

[0086] A text output module is used to output the second dialogue text.

[0087] Exemplarily, the second dialogue text generation module includes a sentiment classification submodule, a text semantic screening submodule, a sentiment feature screening submodule, and a text fluency screening submodule.

[0088] The sentiment classification submodule is used to determine multiple first candidate texts based on the sentiment classification network of the target text generation model according to the second sentiment characteristic information of the first dialogue text, and the similarity between the third sentiment characteristic information of the first candidate texts and the second sentiment characteristic information is greater than or equal to a preset sentiment characteristic information similarity threshold.

[0089] A text semantic screening submodule is used to determine, based on the text semantic screening network of the target text generation model, a text whose text semantic accuracy is greater than or equal to a preset text semantic accuracy threshold among the multiple first candidate texts as the second candidate text.

[0090] The emotional feature screening submodule is used to determine the number of emotional features in the fourth emotional feature information corresponding to each of the second candidate texts based on the emotional feature screening network of the target text generation model; and determine the second candidate text whose number of emotional features is less than or equal to a preset emotional feature number threshold as the third candidate text.

[0091] The text fluency screening submodule is used to determine the text with the highest text fluency among the plurality of third candidate texts as the second dialogue text based on the text fluency screening network of the target text generation model.

[0092] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0093] The method of the present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0094] Exemplarily, the above method and apparatus may be implemented in the form of a computer program. The computer program may be implemented in Figure 4 Runs on the computer device shown.

[0095] See also Figure 4 , Figure 4 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device may be a server or a terminal.

[0096] like Figure 4 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and an internal memory.

[0097] The storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any training method for a text generation model.

[0098] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.

[0099] The internal memory provides an environment for the operation of the computer program in the storage medium. When the computer program is executed by the processor, the processor can execute any training method for the text generation model.

[0100] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 4 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0101] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0102] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:

[0103] Get the first text;

[0104] Determining first emotion characteristic information of the first text, and performing text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text;

[0105] Based on a preset text emotion prompt template, determining a training text according to the first text and the second text;

[0106] The training text generation model is trained according to the training text, and the parameters of the training text generation model are adjusted according to the training result to obtain the target text generation model.

[0107] In one embodiment, when the processor implements training the to-be-trained text generation model according to the training text and adjusting the parameters of the to-be-trained text generation model according to the training result to obtain the target text generation model, it is used to implement:

[0108] Inputting the training text into a training text generation model to obtain a third text output by the training text generation model;

[0109] The parameters of the to-be-trained text generation model are adjusted according to the third text and the first text to obtain the target text generation model.

[0110] In one embodiment, when the processor adjusts the parameters of the to-be-trained text generation model according to the third text and the first text to obtain the target text generation model, it is configured to implement:

[0111] Determining first probability distribution data that the third text, the first text, and the first emotion feature information belong to the same conversation;

[0112] Determine that the third text includes second probability distribution data of the first emotional characteristic information;

[0113] Determining third probability distribution data according to the text fluency of the third text;

[0114] The parameters of the text generation model to be trained are adjusted according to at least one of the first probability distribution data, the second probability distribution data and the third probability distribution data to obtain the target text generation model.

[0115] In one embodiment, when the processor adjusts the parameters of the to-be-trained text generation model according to at least one of the first probability distribution data, the second probability distribution data, and the third probability distribution data to obtain the target text generation model, it is configured to implement:

[0116] Determine the first probability distribution data, the second probability distribution data, and the third probability distribution data corresponding to each training process of the to-be-trained text generation model;

[0117] The text generation model corresponding to when the first probability distribution data, the second probability distribution data and the third probability distribution data are all maximum is determined as the target text generation model.

[0118] In one embodiment, the processor, when implementing the training method of the text generation model, is used to implement:

[0119] Get the first conversation text;

[0120] Based on the target text generation model, determining a second dialogue text according to the first dialogue text, wherein the second dialogue text is a response text of the first dialogue text;

[0121] The second dialogue text is output.

[0122] In one embodiment, when the processor determines the second dialogue text according to the first dialogue text based on the target text generation model, it is configured to implement:

[0123] Based on the emotion classification network of the target text generation model, a plurality of first candidate texts are determined according to the second emotion characteristic information of the first dialogue text, wherein the similarity between the third emotion characteristic information of the first candidate texts and the second emotion characteristic information is greater than or equal to a preset emotion characteristic information similarity threshold;

[0124] Based on the text semantic screening network of the target text generation model, determining, among the plurality of first candidate texts, a text whose text semantic accuracy is greater than or equal to a preset text semantic accuracy threshold as a second candidate text;

[0125] Based on the sentiment feature screening network of the target text generation model, the number of sentiment features is determined in the fourth sentiment feature information corresponding to each of the second candidate texts; and the second candidate texts whose number of sentiment features is less than or equal to a preset sentiment feature number threshold are determined as third candidate texts;

[0126] Based on the text fluency screening network of the target text generation model, the text with the highest text fluency among the plurality of third candidate texts is determined to be the second dialogue text.

[0127] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the computer device described above can refer to the corresponding process in the aforementioned text generation model training method embodiment, and will not be repeated here.

[0128] An embodiment of the present application also provides a storage medium, on which a computer program is stored. The computer program includes program instructions. The method implemented when the program instructions are executed can refer to the various embodiments of the training method of the text generation model of the present application.

[0129] The storage medium may be an internal storage unit of the computer device described in the above embodiment, such as a hard disk or memory of the computer device. The storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.

[0130] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0131] It should also be understood that the term "and / or" used in the specification of this application and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0132] The serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description is only a specific implementation mode of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.

Claims

1. A training method for a text generation model, characterized in that: include: Get the first text; Determining first emotion characteristic information of the first text, and performing text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text; Based on a preset text emotion prompt template, determining a training text according to the first text and the second text; The training text generation model is trained according to the training text, and the parameters of the training text generation model are adjusted according to the training result to obtain the target text generation model.

2. The text generation model training method according to claim 1, characterized in that: The step of training a training text generation model according to the training text and adjusting parameters of the training text generation model according to the training result to obtain a target text generation model includes: Inputting the training text into a training text generation model to obtain a third text output by the training text generation model; The parameters of the to-be-trained text generation model are adjusted according to the third text and the first text to obtain the target text generation model.

3. The text generation model training method according to claim 2, characterized in that: The step of adjusting the parameters of the to-be-trained text generation model according to the third text and the first text to obtain the target text generation model includes: Determining first probability distribution data that the third text, the first text, and the first emotion feature information belong to the same conversation; Determine that the third text includes second probability distribution data of the first emotional characteristic information; Determining third probability distribution data according to the text fluency of the third text; The parameters of the text generation model to be trained are adjusted according to at least one of the first probability distribution data, the second probability distribution data and the third probability distribution data to obtain the target text generation model.

4. The text generation model training method according to claim 3, characterized in that: The adjusting the parameters of the to-be-trained text generation model according to at least one of the first probability distribution data, the second probability distribution data, and the third probability distribution data to obtain the target text generation model includes: Determine the first probability distribution data, the second probability distribution data, and the third probability distribution data corresponding to each training process of the to-be-trained text generation model; The text generation model corresponding to when the first probability distribution data, the second probability distribution data and the third probability distribution data are all maximum is determined as the target text generation model.

5. The text generation model training method according to any one of claims 1 to 4, characterized in that: The text emotion prompt template includes a first prompt text and a second prompt text; Among them, the first prompt text is used to indicate that the first text is the original reference text; the second prompt text is used to indicate that the second text is a text obtained by rewriting the first text based on the first emotional feature information.

6. The text generation model training method according to any one of claims 1 to 4, characterized in that: The method further comprises: Get the first conversation text; Based on the target text generation model, determining a second dialogue text according to the first dialogue text, wherein the second dialogue text is a response text of the first dialogue text; The second dialogue text is output.

7. The text generation model training method according to claim 6, characterized in that: The step of generating the target text model and determining the second dialogue text according to the first dialogue text includes: Based on the emotion classification network of the target text generation model, a plurality of first candidate texts are determined according to the second emotion characteristic information of the first dialogue text, wherein the similarity between the third emotion characteristic information of the first candidate texts and the second emotion characteristic information is greater than or equal to a preset emotion characteristic information similarity threshold; Based on the text semantic screening network of the target text generation model, determining, among the plurality of first candidate texts, a text whose text semantic accuracy is greater than or equal to a preset text semantic accuracy threshold as a second candidate text; Based on the sentiment feature screening network of the target text generation model, the number of sentiment features is determined in the fourth sentiment feature information corresponding to each of the second candidate texts; and the second candidate texts whose number of sentiment features is less than or equal to a preset sentiment feature number threshold are determined as third candidate texts; Based on the text fluency screening network of the target text generation model, the text with the highest text fluency among the plurality of third candidate texts is determined to be the second dialogue text.

8. A training device for a text generation model, characterized in that: The training device of the text generation model comprises: A first text acquisition module, used to acquire a first text; A second text acquisition module, used to determine first emotion characteristic information of the first text, and perform text reconstruction processing on the first text according to the first emotion characteristic information to obtain a second text; A training text determination module, used to determine a training text according to the first text and the second text based on a preset text emotion prompt template; The model training module is used to train the training text generation model according to the training text, and adjust the parameters of the training text generation model according to the training result to obtain the target text generation model.

9. A computer device, characterized in that: The computer device includes a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the text generation model training method as described in any one of claims 1 to 7 are implemented.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the text generation model training method according to any one of claims 1 to 7 are implemented.