Text information generation method, device, storage medium and equipment
By identifying and predicting labels on text information and adjusting the text generation model, the problems of high training complexity and low generation accuracy in the existing technology are solved, and efficient and accurate text generation is achieved.
Patent Information
- Application Number
- CN202010949883.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-10
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-09-10
AI Technical Summary
Existing text generation models have high training complexity and require a large amount of annotated data, resulting in low training efficiency and low accuracy of generated text.
By obtaining original text information, perform label recognition and prediction, and adjust the text generation model so that it can automatically generate text information with attribute emotion labels, reduce training complexity and improve accuracy.
It reduces the training complexity of the text generation model, improves the accuracy and efficiency of text generation, and enables the model to accurately control the attribute-level emotions of text information.
Smart Images

Figure CN112100375B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a method, device, storage medium and equipment for generating text information. Background Art
[0002] With the rapid development of Internet technology, text generation models for automatically generating text information have emerged. For example, applications such as e-commerce provide comment functions for services or products. After purchasing a product or experiencing a service, users can use text generation models to comment on the product or service. User text is of great significance to consumers and suppliers. For example, for consumers, they can not only comment on products or services, but also browse other users' comments to understand the quality of products and services and help themselves make reliable decisions. For suppliers, users' comments can be analyzed, and then the analysis results can be used to provide users with better services. In practice, it is found that large-scale annotated data is needed to train the text generation model to ensure the accuracy of the text information generated by the text generation model, which leads to the high complexity of training the text generation model. Summary of the invention
[0003] The technical problem to be solved by the embodiments of the present application is to provide a text information generation method, device, storage medium and equipment that can reduce the complexity of training a text generation model and improve the accuracy of the text generation model.
[0004] An embodiment of the present application provides a method for generating text information, including:
[0005] Obtaining first original text information;
[0006] Performing label recognition on the first original text information to obtain a first predicted attribute sentiment label of the first original text information;
[0007] Using a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and performing label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information;
[0008] The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label to obtain a target text generation model for generating target text information.
[0009] An embodiment of the present application provides a text information generating device, including:
[0010] An acquisition module, used for acquiring first original text information;
[0011] A label recognition module, used to perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information;
[0012] A text prediction module, configured to use a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and perform label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information;
[0013] The adjustment module is used to adjust the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label to obtain a target text generation model for generating target text information.
[0014] An embodiment of the present application provides a text information generating device, including:
[0015] An acquisition module, used to acquire the attribute information of the target object and the emotion information of the attribute information of the target object;
[0016] A generating module, used for generating a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object;
[0017] The text recognition module is used to use the target text generation model to perform text recognition on the target attribute sentiment label to obtain target text information; the target text generation model is obtained by adjusting the text generation model using the above-mentioned text information generation method.
[0018] In one aspect, the present application provides a computer device, including: a processor and a memory;
[0019] Among them, the above-mentioned memory is used to store the computer program, and the above-mentioned processor is used to call the above-mentioned computer program to execute the above-mentioned text information generation method in the embodiment of the present application.
[0020] In one aspect, the present application provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the text information generation method in the present application embodiment.
[0021] In the present application, a computer device performs label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information; a text generation model is used to perform text prediction on the first predicted attribute emotion label to obtain the first predicted text information; a label prediction is performed on the first predicted text information to obtain a second predicted attribute emotion label of the first predicted text information. The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute emotion label, and the second predicted attribute emotion label to obtain a target text generation model for generating target text information, that is, the target text information has a target attribute emotion label. That is, by performing label recognition on the original text information to obtain the predicted attribute emotion label of the original comment information, label recognition on the original text information to obtain the attribute emotion label of the original text information, there is no need to manually annotate a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; it can enable the trained (i.e. adjusted) text generation model to have the ability to generate text information belonging to the attribute emotion label, accurately control the attribute level emotion of the text information, and improve the accuracy of the text generation model to generate text. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 It is a schematic diagram of the architecture of a text information generation system provided by this application;
[0024] Figure 2a It is a schematic diagram of an interaction scenario between various devices of a text information generation system provided by the present application;
[0025] Figure 2b It is a schematic diagram of an interaction scenario between various devices of a text information generation system provided by the present application;
[0026] Figure 2c It is a schematic diagram of an interaction scenario between various devices of a text information generation system provided by the present application;
[0027] Figure 3 It is a flowchart of a text information generation method provided by the present application;
[0028] Figure 4 It is a schematic diagram of a scenario for adjusting a text generation model provided by the present application;
[0029] Figure 5 It is a flowchart of a text information generation method provided by the present application;
[0030] Figure 6 It is a structural diagram of a text generation model provided by this application;
[0031] Figure 7 It is a schematic diagram of a scenario in which a tag recognition model provided in this application is adjusted;
[0032] Figure 8 It is a flowchart of a text information generation method provided by the present application;
[0033] Fig. 9 It is a structural schematic diagram of a text information generating device provided in an embodiment of the present application;
[0034] Fig.10 It is a structural schematic diagram of a text information generating device provided in an embodiment of the present application;
[0035] Fig.11 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] 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 only 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.
[0037] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0038] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, large text information generation technology, operation / interaction systems, and mechatronics. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. The key technologies of speech technology include automatic speech recognition technology (ASR), speech synthesis technology (TTS), and voiceprint recognition technology. Enabling computers to listen, see, speak, and feel is the future development direction of human-computer interaction, among which speech has become one of the most promising human-computer interaction methods in the future.
[0039] Among them, natural language processing (NLP) is an important direction in the fields of computer science and artificial intelligence. It studies various theories and methods that can achieve effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field will involve natural language, that is, the language people use in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question answering, knowledge graph and other technologies.
[0040] Among them, the text information generation method provided in the embodiment of the present application mainly involves artificial intelligence-natural language processing technology, which automatically generates text information of the target object according to the attribute information and emotional information of the target object, thereby improving the efficiency and accuracy of generating text information.
[0041] First, a text information generation system for implementing the text information generation method of the present application is introduced, such as Figure 1 As shown, the text information generating system includes a server and a terminal.
[0042] Among them, the terminal may refer to a user-oriented device, which may include a text application platform for editing text on a target object, which may receive text information edited by a user and display the text information to the user; the text application platform here may refer to a shopping application platform, a multimedia website platform (such as a forum, a post bar), a social application platform, a content interaction platform (such as a review application platform), etc. The server may refer to a device for providing background services for the text application platform, which may be used to generate text information of the target object according to the user's emotional information on the attributes of the target object, and upload the generated text information to the text application platform.
[0043] Among them, the server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, 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. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. Each terminal and server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0044] Among them, this scheme can be used in dialogue scenarios, comment generation scenarios, and literary creation scenarios, etc. In the dialogue scenario, the above-mentioned target object can refer to the dialogue content, and the attribute information of the target object includes the keywords of the dialogue content. The emotional information of the target object refers to the emotional information corresponding to the keywords. For example, the dialogue content is "S is really fun", the attribute information of the target object is S, and the emotional information is "fun". In the comment generation scenario, the above-mentioned target object can refer to a product or a service. Products can include applications (social applications, game applications, office applications, etc.), articles, clothing, food, equipment, and books, etc.; services can refer to catering services, psychological counseling, online courses, and legal counseling, etc. The target object has attribute information, and the attribute information of the target object is used to reflect the user's consumption experience of the target object. For example, the target object is a product, and the attributes of the product include appearance, price, logistics, performance, etc.; for another example, the target object is a catering service, and the attributes of the catering service include environment, price, service, etc. After purchasing or experiencing the target object, the user can evaluate the attribute information of the target object. Here, evaluating the attribute information of the target object may include: scoring the attribute information of the target object to obtain the scoring information corresponding to the attribute information of the target object. Here, the scoring information may refer to the user's emotional information about the target object. The scoring information corresponding to the attribute information of the target object is used to reflect the user's satisfaction with the attributes of the target object. The scoring information may be specifically expressed in numbers such as 8 points, 9 points, etc., that is, the higher the score, the higher the user's satisfaction with the attributes of the target object; the lower the score, the lower the user's satisfaction with the attributes of the target object; or. The scoring information may also be expressed in symbols, such as three stars, four stars, five stars, etc., that is, the more stars there are, the higher the user's satisfaction with the attributes of the target object; the fewer stars there are, the lower the user's satisfaction with the attributes of the target object. In the context of literary creation, the target object may refer to the object to be described in the literary creation (such as an event or an item). For example, the object to be described in the literary creation is an event. The attribute information of the target object includes keywords of the event. The emotional information of the target object refers to the emotional information corresponding to the keywords, which is used to reflect the user's preference for the attribute information of the object to be described in the literary creation object.
[0045] Among them, obtaining the text information corresponding to the attribute information of the target object by manual editing is cumbersome and time-consuming. Therefore, in this solution, a text generation model is used to perform text recognition on the attribute information of the target object and the emotional information corresponding to the attribute information of the target object, and the text information of the target object is automatically obtained, which can improve the efficiency of generating text information. First, for example, to improve the accuracy of text generation by the text generation model, the text generation model can be trained. Specifically, the text generation model can be trained in an unsupervised manner, or the text generation model can be trained in a semi-supervised manner. Among them, the unsupervised method can refer to training the text generation model with original text information without annotated labels, and the semi-supervised method can refer to training the text generation model with a small amount of original text information with annotated labels and original text information without annotated labels.
[0046] Optional, as follows Figure 2a-2c Taking the comment generation scenario as an example, the text information generation method in this solution is explained. Figure 2aAs shown, the server can train the text generation model in an unsupervised manner. Specifically, the server can obtain the first original text information from the terminal. The first original text information can refer to the user's evaluation of the attribute information of a certain object. The object can refer to a product or a service. The product can include applications (social applications, game applications, office applications, etc.), articles, clothing, food, equipment, and books, etc.; services can refer to catering services, psychological counseling, online courses, and legal counseling, etc. The first original text information can refer to the original text information without annotated labels, that is, the first original text information is not annotated with attribute emotion labels; the attribute emotion label of the first original text information can refer to the attribute label used to reflect the object corresponding to the first original text information, and the emotion label reflecting the attribute information of the object. The attribute label can refer to the attribute information of the object corresponding to the first original text information, and the emotion label can be used to reflect the scoring information of the attribute information of the object corresponding to the first original text information. For example, the object corresponding to the first original text information is a product, and the attribute label of the product includes appearance, price, logistics, performance, etc.; for another example, the object corresponding to the first original text information is a catering service, and the attribute label of the catering service includes environment, price, service, etc. Sentiment labels may include positive, negative, and neutral. Positive means that the user is very satisfied with a certain attribute information of the object, negative means that the user is dissatisfied with a certain attribute information of the object, and neutral means that the user is between very satisfied and dissatisfied with a certain attribute information of the object. After the server obtains the first original text information, a label recognition model may be obtained. The label recognition model refers to a model used to perform attribute sentiment label recognition on the first original text information, and the label recognition model may be used to perform label recognition on the first original text information to obtain a predicted attribute sentiment label of the first original text information as a first predicted attribute sentiment label. Further, a text generation model may be obtained. The text generation model refers to a model used to generate text information, and the text generation model may be used to perform text prediction on the first predicted attribute sentiment label to obtain the first predicted text information; and the text generation model may be used to perform label prediction on the first predicted text information to obtain a predicted attribute sentiment label of the first predicted text information as a second predicted attribute sentiment label. Then, the text generation model is adjusted according to the first predicted attribute sentiment label, the second predicted attribute sentiment label, the first original text information, and the first predicted text information, and the adjusted text generation model is used as the target text generation model, that is, the target text generation model has the ability to generate text information of the object according to the attribute sentiment label of the object.By using the above-mentioned unlabeled original text information to train the text generation model, that is, there is no need to manually label a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; it can enable the trained (i.e. adjusted) text generation model to have the ability to generate text information belonging to attribute sentiment labels, accurately control the attribute level sentiment of the text information, and improve the accuracy of the generated text of the text generation model.
[0047] Optional, such as Figure 2b As shown, the server can train the text generation model in a semi-supervised manner. Specifically, the server can obtain the first original text information and the second original text information from the terminal, and the second original text information has a first annotation attribute emotion label. That is, the first original text information can refer to the original text information without annotated labels, and the second original text information can refer to the original text information with annotated labels, that is, the second original text information has a first annotation attribute emotion label, and the first annotation attribute emotion label can refer to the user annotating the second original text information. The object corresponding to the first original text information and the object corresponding to the second original text can be the same, such as the object corresponding to the first original text information and the object corresponding to the second original text are the same restaurant; the object corresponding to the first original text information and the object corresponding to the second original text can also be the same, such as the object corresponding to the first original text information is a restaurant, and the object corresponding to the second original text information is a book. The first original text information and the second original text information can be edited by the same user, or edited by different users.
[0048] like Figure 2bIn the example, after obtaining the first original text information and the second original text information, the server uses the label recognition model to perform label recognition on the first original text information, and obtains the predicted attribute sentiment label of the first original text information as the first predicted attribute sentiment label. The text generation model can be used to perform text prediction on the first predicted attribute sentiment label to obtain the first predicted text information, perform text prediction on the first annotated attribute sentiment label to obtain the second predicted text information, perform label prediction on the first predicted text information to obtain the second predicted attribute sentiment label, and perform label prediction on the second predicted text information to obtain the third predicted attribute sentiment label. Further, the text generation model can be adjusted according to the prediction result corresponding to the first original data without annotated labels, the prediction result corresponding to the second original text information with annotated labels, the first original text information, the second original text information, and the first annotated attribute sentiment label to obtain the target text generation model. The prediction result corresponding to the first original data without annotated labels includes: the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label; the prediction result corresponding to the second original text information with annotated labels includes: the second predicted text information and the third predicted attribute sentiment label. By using the above-mentioned original text information without labeled labels and the original text information with labeled labels to train the text generation model, that is, only a small amount of original text information needs to be labeled, and there is no need to manually label a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; it can enable the trained (i.e. adjusted) text generation model to have the ability to generate text information belonging to attribute sentiment labels, accurately control the attribute level sentiment of the text information, and improve the text generation accuracy of the text generation model.
[0049] It should be noted that the above-mentioned unsupervised training of the text generation model can be adapted to: when the label recognition model is an enhanced label recognition model, for example, the enhanced label recognition model is obtained by training the label recognition model by other devices (devices other than the above-mentioned server); the enhanced label recognition model may refer to the label recognition model whose attribute emotion label recognition accuracy is greater than the accuracy threshold (such as 0.8, 0.9). The above-mentioned semi-supervised training of the text generation model can be adapted to: when the label recognition model is a non-enhanced label recognition model, for example, the label recognition model can be trained by the server through a small amount of original text information with annotated labels.
[0050] After the server obtains the target text model, the target text generation model can be sent to the terminal. When the text information of an object needs to be generated, the object that needs the text can be called the target object. Figure 2cIn this paper, the target object is restaurant A as an example to illustrate the process of generating text information. After user P has a meal at restaurant A, he can perform text on restaurant A on the text application platform, such as Figure 2b In the text application platform, the user performs a text evaluation on the attributes of Hotel A on the text interface 11, and obtains the rating information of the attribute information of Hotel A. The attribute information of Hotel A includes environment, service, price and food. The rating information of the environment is 5 stars, the rating information of the service is 3 stars, the rating information of the price is 4 stars, and the rating information of the food is 4 stars. The terminal can generate the attribute emotion label of Hotel A according to the attribute information of Hotel A and the rating information of the attributes of Hotel A. The attribute emotion label of Hotel A includes attribute label and emotion label, that is, the attribute label is generated according to the attribute information of Hotel A, and the emotion label is generated according to the rating information of the attributes of Hotel A. The attribute label includes environment, service, price and food. The emotion labels corresponding to environment, service, price and food are positive, negative, neutral and neutral respectively. After obtaining the attribute emotion label of Hotel A, the overall rating information of Hotel A can be generated according to the rating information corresponding to the attributes of Hotel A, and the overall emotion label of Hotel A can be generated according to the overall rating information of Hotel A; Figure 2c In the example, the overall rating information of Hotel A is 4 stars, and the overall sentiment label of Hotel A is neutral. Alternatively, the overall sentiment label of the target object can be generated according to the sentiment label corresponding to the attribute label of Hotel A.
[0051] After the terminal obtains the attribute emotion label of Hotel A, it can use the target text generation model to generate text information of Hotel A. Specifically, the target text generation model can be used to perform text recognition on the attribute label and emotion label of Hotel A to obtain text information corresponding to the attribute information of Hotel A, and the overall emotion label of Hotel A can be recognized to obtain the overall text information of Hotel A. The text information of Hotel A is generated based on the text information corresponding to the attribute information of Hotel A and the overall text information of Hotel A; the text information corresponding to the attribute information of Hotel A is used to reflect the user's satisfaction with the attribute information of Hotel A, and the overall text information of Hotel A is used to reflect the user's overall satisfaction with Hotel A. Figure 2cAmong them, "the interior of Hotel A is relatively clean and tidy" refers to the text information of the environmental attributes of Hotel A, and "the serving speed is relatively slow, and there are few waiters" refers to the text information of the service attributes of Hotel A. "The price of the dishes is average" refers to the text information of the price attributes of Hotel A, "the taste of the dishes is quite satisfactory" refers to the text information of the food attributes of Hotel A, and "Restaurant A is OK, but it has no special features" refers to the overall text information of Hotel A. By generating the attribute sentiment label of Hotel A based on the attribute information of Hotel A and the user's rating information on the attributes of Hotel A, and generating the text information of Hotel A based on the attribute sentiment label of Hotel A, it is possible to achieve attribute-level sentiment control of the text information of Hotel A, improve the diversity and accuracy of the generated text information; and do not require users to manually edit the text information, thereby improving the efficiency of generating text information.
[0052] It should be noted that the above-mentioned process of training the text model and generating the text information of the object can be Figure 1 The server in the process may execute the process alone, or the terminal may execute the process alone, or the server and the terminal may assist in executing the process, which is not limited in the present application.
[0053] Based on the above description, please see Figure 3 , is a flowchart of a text information generation method provided in an embodiment of the present application. The method can be executed by a computer device, which can refer to Figure 1 The service equipment or terminal in Figure 3 As shown, the text information generating method may include the following steps S101 to S104.
[0054] S101: Obtain first original text information.
[0055] The computer device can obtain the first original text information from a text application platform such as a web page or an application interface. The first original text information may refer to original platform information without annotated labels, that is, the attribute label and emotion label corresponding to each sentence in the first original text information are not labeled.
[0056] S102: Perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information.
[0057] The computer device can perform semantic analysis on the first original text information to obtain a first predicted attribute sentiment label of the first original text information; or, the computer device can input the first original text information into a label recognition model, and the label recognition model can perform label recognition on the first original text information to obtain a predicted attribute sentiment label of the first original text information, and use the predicted attribute sentiment label of the first original text information as the first predicted attribute sentiment label, that is, use the first predicted attribute sentiment label as the annotation label of the first original text information.
[0058] S103: Use a text generation model to perform text prediction on the first predicted attribute sentiment label to obtain first predicted text information, perform label prediction on the first predicted text information to obtain a second predicted attribute sentiment label of the first predicted text information.
[0059] After obtaining the first predicted attribute sentiment label of the first original text information, the first predicted attribute sentiment label can be used as the annotation label of the first original text information, and the text generation model is used to perform text prediction on the first attribute sentiment label to obtain the first predicted text information. Label prediction is performed on the first predicted text information to obtain the predicted attribute sentiment label of the first predicted text information, and the predicted attribute sentiment label of the first predicted text information is used as the second predicted attribute sentiment label.
[0060] S104: According to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label, the text generation model is adjusted to obtain a target text generation model for generating target text information.
[0061] The computer device can adjust the text generation model according to the first original text information, the first predicted text information, the first predicted attribute emotion label and the second predicted attribute emotion label to obtain a target text generation model for generating target text information; that is, the quality of the text information generated by the text generation model is adjusted according to the first original text information and the first predicted text information, and the attribute level emotion control accuracy of the text information generated by the text generation model is adjusted according to the first predicted attribute emotion label and the second predicted attribute emotion label. The above-mentioned target text information is text information with a target attribute emotion label, and the target attribute emotion label can be generated according to the attribute information of the target object and the emotion information of the attribute information of the target object, and the emotion information of the attribute information of the target object is obtained by the user scoring the attributes of the target object or editing it.
[0062] In the present application, a computer device obtains a first predicted attribute emotion label of the first original text information by performing label recognition on the first original text information; performs text prediction on the first predicted attribute emotion label using a text generation model to obtain first predicted text information; performs label prediction on the first predicted text information to obtain a second predicted attribute emotion label of the first predicted text information. The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute emotion label, and the second predicted attribute emotion label to obtain a target text generation model for generating target text information, that is, the target text information has a target attribute emotion label. That is, by performing label recognition on the original text information to obtain the predicted attribute emotion label of the original comment information, there is no need to manually annotate a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; it can enable the trained (i.e. adjusted) text generation model to have the ability to generate text information belonging to the attribute emotion label, accurately control the attribute level emotion of the text information, and improve the accuracy of the text generation model to generate text.
[0063] Optionally, the above step S104 may include the following steps s11 and s12.
[0064] s11. Generate a loss value of an unlabeled label of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label.
[0065] s12. If the loss value of the unlabeled label of the text generation model does not meet the convergence condition, the text generation model is adjusted according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information.
[0066] In steps s11 and s12, the computer device can generate the loss value of the unlabeled label of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label; the loss value of the unlabeled label of the text generation model can refer to: when the original text information without labeled labels is used to train the text generation model, the loss value of the text generation model. The loss value of the unlabeled label of the text generation model is used to reflect the accuracy of the text information generated by the text generation model, that is, if the loss value of the unlabeled label of the text generation model does not meet the convergence condition, it indicates that the accuracy of the text information generated by the text generation model is relatively low. Therefore, the text generation model can be adjusted according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information. If the loss value of the unlabeled label of the text generation model meets the convergence condition, it indicates that the accuracy of the text generation model generating text information is relatively high, so the text generation model can be determined as the target text generation model. By adjusting the text generation model according to the loss value of the unlabeled label of the text generation model, the text generation model can be trained in an unsupervised manner without the need for manual labeling of a large amount of original text information. The accuracy of text generated by the text generation model can be improved, as well as the training efficiency of the text generation model.
[0067] Optionally, the above step s12 may include the following steps s21 to s23.
[0068] s21. Generate a text recognition loss value of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label as a first text recognition loss value.
[0069] s22. Generate an attribute emotion recognition loss value of the text generation model according to the first predicted attribute emotion label and the second predicted attribute emotion label as the first attribute emotion recognition loss value.
[0070] s23. Obtain the sum of the first text recognition loss value and the first attribute emotion recognition loss value to obtain the loss value of the unlabeled label of the text generation model.
[0071] In steps s21 to s23, the computer device can generate a text recognition loss value of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute emotion label and the second predicted attribute emotion label, and use the text recognition loss value of the text generation model as the first text recognition loss value. That is, the first text recognition loss value is used to reflect the quality of the text generated by the text generation model, that is, to reflect the difference between the first original text information and the first predicted text information. The greater the difference between the first original text information and the first predicted text information, the greater the first text recognition loss value; conversely, the smaller the difference between the first original text information and the first predicted text information, the smaller the first text recognition loss value. Further, the attribute emotion recognition loss value of the text generation model can be generated according to the first predicted attribute emotion label and the second predicted attribute emotion label as the first attribute emotion recognition loss value, that is, the first attribute emotion recognition loss value is used to reflect the control accuracy of the attribute emotion label of the text information by the text generation model; that is, it reflects the difference between the first predicted attribute emotion label and the second predicted attribute emotion label. The greater the difference between the first predicted attribute emotion label and the second predicted attribute emotion label, the greater the first attribute emotion recognition loss value, and the lower the control accuracy of the attribute emotion label of the text information by the text generation model; conversely, the smaller the difference between the first predicted attribute emotion label and the second predicted attribute emotion label, the smaller the first attribute emotion recognition loss value, and the higher the control accuracy of the attribute emotion label of the text information by the text generation model. After the computer device obtains the first text recognition loss value and the first attribute emotion recognition loss value, the sum of the first text recognition loss value and the first attribute emotion recognition loss value can be obtained to obtain the loss value of the unlabeled label of the text generation model. By obtaining the sum of the first text recognition loss value and the first attribute emotion recognition loss value to obtain the loss value of the unlabeled label of the text generation model, the text generation model can be trained according to the first text recognition loss value and the first attribute emotion recognition loss value, so as to improve the quality of the text information generated by the text generation model and improve the accuracy of the text generation model's emotion control on the attribute level of the text information.
[0072] For example, the loss value of the unlabeled label of the text generation model can be expressed by the following formula (1).
[0073]
[0074] In formula (1), The loss value of the unlabeled label for the text generation model, is the text recognition loss value of the text generation model, L sq Attribute sentiment loss value for the text generation model.
[0075] Optionally, the first predicted attribute emotion label includes a first predicted attribute label and a first predicted emotion label, and the second predicted attribute emotion label includes a second predicted attribute label and a second predicted emotion label; Figure 4 As shown, the above step s22 may include the following steps s31 to s34.
[0076] s31. Generate an attribute recognition confidence of the text generation model according to the first predicted attribute label, and generate an emotion recognition confidence of the text generation model according to the first predicted emotion label.
[0077] s32. Generate an attribute recognition loss value of the text generation model according to the attribute recognition confidence and the second predicted attribute label as a first attribute recognition loss value.
[0078] s33. Generate an emotion recognition loss value of the text generation model according to the emotion recognition confidence and the second predicted emotion label as a first emotion recognition loss value.
[0079] s34. Obtain the sum of the first attribute recognition loss value and the first emotion recognition loss value to obtain the first attribute emotion recognition loss value.
[0080] In steps s31 to s34, the first predicted attribute emotion label includes a first predicted attribute label and a first predicted emotion label. The first predicted attribute label can be used to reflect the attribute information of the first original text information, and the first predicted emotion label can be used to reflect the emotion information of the user for the first original text information. The second predicted attribute emotion label includes a second predicted attribute label and a second predicted emotion label; the second predicted attribute label can be used to reflect the attribute information of the first predicted text information, and the second predicted emotion label can be used to reflect the emotion information of the user for the first predicted text information. For the original text information without labeled labels, the first predicted attribute emotion label generated by the label recognition model is used as the input of the text generation model. Considering the noise brought by the first predicted attribute emotion label, a confidence mechanism is introduced into the text generation model, that is, the prediction probability corresponding to the first predicted attribute emotion label is used as the confidence and introduced into the attribute emotion recognition loss value of the text generation model, which is conducive to improving the accuracy of the text generated by the text generation model.
[0081] Specifically, the computer device can generate the attribute recognition confidence of the text generation model according to the first predicted attribute label, and generate the emotion recognition confidence of the text generation model according to the first predicted emotion label; that is, generate the attribute recognition confidence of the text generation model according to the predicted probability corresponding to the first predicted attribute label, and generate the emotion recognition confidence of the text generation model according to the predicted probability corresponding to the first predicted emotion label. Then, the attribute recognition loss value of the text generation model can be generated according to the attribute recognition confidence and the predicted probability corresponding to the second predicted attribute label as the first attribute recognition loss value; the emotion recognition loss value of the text generation model can be generated according to the emotion recognition confidence and the predicted probability corresponding to the second predicted emotion label as the first emotion recognition loss value. The sum of the first attribute recognition loss value and the first emotion recognition loss value can be obtained to obtain the first attribute emotion recognition loss value; by generating attribute recognition confidence and emotion recognition confidence according to the first predicted attribute emotion label generated by the label recognition model, and introducing the attribute recognition confidence and emotion recognition confidence into the attribute emotion loss value of the text generation model, the noise caused by the first predicted attribute emotion label generated by the label recognition model can be avoided, which is beneficial to improving the accuracy of the text generation model's emotion control on the attribute level of the text information.
[0082] For example, the attribute sentiment loss value of the text generation model can be expressed by the following formula (2).
[0083]
[0084] Among them, in formula (2) Attribute recognition loss value for text generation model, is the sentiment recognition loss value of the text generation model; the attribute recognition loss value of the text generation model can be expressed by the following formula (3).
[0085]
[0086] In formula (3), The second attribute label a of the i-th text sentence representing the first predicted text information i The corresponding probability is Represents the first predicted attribute label a′ of the i-th text sentence in the original text information i The corresponding frequency. represents the attribute recognition confidence of the text generation model, α is the hyperparameter of the text generation model, and I x () represents the index of the specified element in the vector. The sentiment recognition loss value of the text generation model can be expressed by the following formula (4).
[0087]
[0088] In formula (4), The second sentiment label y of the i-th text sentence representing the first predicted text information i The corresponding probability is Represents the first predicted sentiment label y′ of the i-th text sentence in the original text information i The corresponding probability. represents the sentiment recognition confidence of the text generation model, and β is the hyperparameter of the text generation model.
[0089] Optional, such as Figure 4 As shown, the above step s21 may include the following steps s41 to s42.
[0090] s41. Determine the attribute emotion confidence of the text generation model according to the attribute recognition confidence and the emotion recognition confidence.
[0091] s42. Determine the first text recognition loss value according to the attribute emotion confidence, the first original text information and the first predicted text information.
[0092] In steps s41 to s42, similarly, considering the noise brought by the first predicted attribute emotion label, a confidence mechanism is introduced into the text generation model, that is, the prediction probability corresponding to the first predicted attribute emotion label is introduced as confidence into the text recognition loss value of the text generation model, which is beneficial to improving the accuracy of the text generated by the text generation model. Specifically, the computer device can determine the attribute emotion confidence of the text generation model according to the attribute recognition confidence and the emotion recognition confidence, such as the attribute emotion confidence of the text generation model can be obtained by summing, multiplying, etc. the attribute recognition confidence and the emotion recognition confidence. Further, the first text recognition loss value can be determined according to the attribute emotion confidence, the first original text information and the first predicted text information, and the attribute emotion recognition confidence is generated according to the first predicted attribute emotion label generated by the label recognition model, and the attribute emotion recognition confidence is introduced into the text recognition loss value of the text generation model, which can avoid the noise brought by the first predicted attribute emotion label generated by the label recognition model, which is beneficial to improving the quality of the text information generated by the text generation model.
[0093] For example, the first text recognition loss value can be expressed using the following formula (5).
[0094]
[0095] In formula (5), p i,t is the generation probability corresponding to the t-th word of the ith text sentence in the first predicted text information, Attributed sentiment recognition confidence for text generation models.
[0096] Based on the above description, please see Figure 5 , is a flowchart of a text information generation method provided in an embodiment of the present application. The method can be executed by a computer device, which can refer to Figure 1 The service equipment or terminal in Figure 5 As shown, the text information generating method may include the following steps S201 to S204.
[0097] S201, obtaining first original text information and second original text information; the second original text information has a first annotation attribute emotion label.
[0098] The computer device can obtain the first original text information and the second original text information from a text application platform such as a web page or an application interface, and the second original text information has a first annotation attribute sentiment label; that is, the first original text information belongs to the original text information without an annotation label, and the second original text information belongs to the original text information with an annotation label, and the first annotation attribute sentiment label of the second original text information can refer to the one obtained by manual annotation.
[0099] S202: Perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information.
[0100] The computer device can input the first original text information into the label recognition model, and the label recognition model can perform label recognition on the first original text information to obtain the predicted attribute sentiment label of the first original text information, and use the predicted attribute sentiment label of the first original text information as the first predicted attribute sentiment label.
[0101] S203, using a text generation model to perform text prediction on the first predicted attribute sentiment label to obtain first predicted text information, perform label prediction on the first predicted text information to obtain a second predicted attribute sentiment label of the first predicted text information, and perform text prediction on the first labeled attribute sentiment label to obtain second predicted text information, perform label prediction on the second predicted text information to obtain a third predicted attribute sentiment label of the second predicted text information.
[0102] After obtaining the first predicted attribute sentiment label of the first original text information, the first predicted attribute sentiment label can be used as the annotation label of the first original text information, and the text generation model can be used to perform text prediction on the first attribute sentiment label to obtain the first predicted text information, and the label prediction can be performed on the first predicted text information to obtain the predicted attribute sentiment label of the first predicted text information, and the predicted attribute sentiment label of the first predicted text information can be used as the second predicted attribute sentiment label. The first annotation attribute sentiment label can be used to perform text prediction to obtain the second predicted text information, and the label prediction can be performed on the second predicted text information to obtain the third predicted attribute sentiment label of the second predicted text information.
[0103] S204. According to the first original text information, the first predicted text information, the first predicted attribute sentiment label, the second predicted attribute sentiment label, the second original text information, the second predicted text information, the first marked attribute sentiment label and the third predicted attribute sentiment label, the text generation model is adjusted to obtain a target text generation model for generating target text information.
[0104] The computer device can adjust the text generation model according to the first original text information, the first predicted text information, the first predicted attribute emotion label, the second predicted attribute emotion label, the second original text information, the second predicted text information, the first annotated attribute emotion label and the third predicted attribute emotion label to obtain a target text generation model for generating target text information; that is, according to the first original text information, the first predicted text information, the second original text information and the second predicted text information, adjust the quality of the text information generated by the text generation model; according to the first predicted attribute emotion label, the second predicted attribute emotion label, the first annotated attribute emotion label and the third predicted attribute emotion label, adjust the attribute-level emotion control accuracy of the text information generated by the text generation model.
[0105] In the present application, by performing label recognition on the original text information, the predicted attribute sentiment label of the original comment information is obtained, and the first original text information without labeled labels and the second original text information with labeled labels are used to train the text generation model. In this way, it is possible to train the text generation model using a small amount of original text information with labeled labels and a large amount of unlabeled labels; there is no need to manually label a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; the trained (i.e. adjusted) text generation model can have the ability to generate text information belonging to attribute sentiment labels, can accurately control the attribute level sentiment of the text information, and improve the accuracy of text generation by the text generation model.
[0106] Optionally, the above step S204 may include the following steps s51 to s53.
[0107] s51. Generate a loss value of the unlabeled label of the text generation model as a first loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label.
[0108] s52. Generate a loss value of the annotation label of the text generation model as a second loss value based on the second original text information, the second predicted text information, the first annotation attribute sentiment label and the third predicted attribute sentiment label.
[0109] s53. Adjust the text generation model according to the first loss value and the second loss value.
[0110] In steps s51 to s53, the computer device may generate the loss value of the unlabeled label of the text generation model as the first loss value based on the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label; the loss value of the unlabeled label of the text generation model may refer to: the loss value of the text generation model when the original text information without labeled labels is used to train the text generation model. Further, the loss value of the labeled label of the text generation model may be generated as the second loss value based on the second original text information, the second predicted text information, the first labeled attribute sentiment label and the third predicted attribute sentiment label; the loss value of the labeled label of the text generation model may refer to: the loss value of the text generation model when the original text information with labeled labels is used to train the text generation model. The text generation model can be adjusted according to the first loss value and the second loss value; by adjusting the text generation model according to the loss value of the unlabeled label of the text generation model and the loss value of the labeled label of the text generation model, the text generation model can be trained in a semi-supervised manner without the need for manual labeling of a large amount of original text information, which can improve the accuracy of text generated by the text generation model and improve the training efficiency of the text generation model.
[0111] It should be noted that the above-mentioned implementation method of generating the loss value of the unlabeled label of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label can refer to Figure 1 The implementation method of generating the loss value of the unlabeled label of the text generation model in , will not be repeated in the repeated parts.
[0112] Optionally, the above step s53 may include the following steps s61 to s62.
[0113] s61. Obtain the sum of the first loss value and the second loss value to obtain the total loss value of the text generation model.
[0114] s62. If the total loss value of the text generation model does not meet the convergence state, the text generation model is adjusted according to the total loss value of the text generation model to obtain a target text generation model for generating target text information.
[0115] In steps s61 to s62, the computer device can obtain the sum of the first loss value and the second loss value to obtain the total loss value of the text generation model. The total loss value of the text generation model is used to reflect the accuracy of the text information generated by the text generation model, that is, if the total loss value of the text generation model does not meet the convergence condition, it indicates that the accuracy of the text information generated by the text generation model is relatively low. Therefore, the text generation model can be adjusted according to the total loss value of the text generation model to obtain a target text generation model for generating target text information. If the total loss value of the text generation model meets the convergence condition, it indicates that the accuracy of the text generation model generating text information is relatively high, and the text generation model can be used as the target text generation model. By adjusting the text generation model by the sum of the loss value of the unlabeled label and the loss value of the labeled label of the text generation model, the text generation model can be trained by using a small amount of original text information with labeled labels combined with a large amount of original text information with labeled labels, without the need to manually label a large amount of original text information, which can improve the accuracy of the text generated by the text generation model and improve the training efficiency of the text generation model.
[0116] For example, the total loss value of the text generation model can be expressed by the following formula (6).
[0117]
[0118] In formula (6), L z Represents the total loss value of the text generation model, Represents the loss value of the unlabeled label of the text generation model, The loss value of the annotation label of the text generation model can be expressed by the following formula (7).
[0119]
[0120] Among them, in formula (7) Generate a text recognition loss value in the first predicted text information for the text generation model with the annotated label, Attribute recognition loss value of the text generation model with annotated labels, Represents the emotion recognition loss value of the text generation model with the annotated label. The text recognition loss value, attribute recognition loss value, and emotion recognition loss value in the first predicted text information generated by the text generation model with the annotated label can be represented by the following formulas (8), (9), and (10), respectively.
[0121]
[0122]
[0123]
[0124] Optionally, the text generation model includes a feature extraction layer, a text recognition layer, and a label recognition layer;
[0125] The above-mentioned steps S103 and S203 use a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain the first prediction text information, perform label prediction on the first prediction text information to obtain the second prediction attribute sentiment label of the first prediction text information, which may include the following steps s71 to s73.
[0126] s71. Use the feature extraction layer to extract features of the first predicted attribute emotion label to obtain label feature information.
[0127] s72. Use the text recognition layer to perform text prediction on the label feature information to obtain the first predicted text information.
[0128] s73. Use the label recognition layer to perform label prediction on the first predicted text information to obtain the second predicted attribute emotion label.
[0129] In steps s71 to s73, if Figure 6 As shown, the computer device can use the feature extraction layer to perform feature extraction on the first predicted attribute sentiment label to obtain label feature information, and the label feature information is used to reflect the attribute label and sentiment label of the first original text information; the text recognition layer can be used to perform text prediction on the label feature information to obtain the first predicted text information, and the label recognition layer can be used to perform label prediction on the first predicted text information to obtain the second predicted attribute sentiment label.
[0130] Optionally, the first predicted attribute sentiment label includes a first predicted attribute label and a first predicted sentiment label; the first predicted attribute label is used to reflect the attributes of the object corresponding to the first original text information, and the first predicted sentiment label is used to reflect the score of the attributes of the object corresponding to the first original text information; the above step s73 may include the following steps s81 to s85.
[0131] s81. Use the feature extraction layer to obtain the score corresponding distribution function of the attribute of the object.
[0132] s82. Perform sampling processing on the distribution function to obtain statistical feature information corresponding to the score of the attribute of the object.
[0133] s83. Get the sum of the scores of the attributes of the object to obtain the overall score of the object.
[0134] s84. Extract features from the overall score of the object to obtain overall feature information of the object.
[0135] s85. The overall feature information of the object and the statistical feature information are concatenated to obtain the label feature information.
[0136] In steps s81 to s85, the computer device may use the feature extraction layer to obtain the distribution function corresponding to the score of the attribute of the object, and the distribution function may refer to a Gaussian distribution function or other functions; the distribution function may be sampled to obtain the statistical feature information corresponding to the score of the attribute of the object, that is, the statistical feature information may refer to the attribute emotion joint feature vector of the first predicted attribute emotion label. Further, the sum of the scores of the attributes of the object may be obtained to obtain the overall score of the object, and the overall score of the object may be feature extracted to obtain the overall feature information of the object, and the overall feature information of the object and the statistical feature information may be spliced to obtain the label feature information. By obtaining the overall feature information of the object and the statistical feature information (attribute emotion joint feature vector), the diversity of feature information may be improved, and then, text information of multiple dimensions may be generated to improve the diversity of the generated text information.
[0137] For example, the computer device can use the feature extraction layer to obtain the multidimensional Gaussian distribution function corresponding to the score of the attribute of the object, perform sampling processing on the multidimensional Gaussian distribution function, and obtain the statistical feature information corresponding to the score of the attribute of the object, that is, the joint feature vector of the attribute emotion of the object. The attribute emotion joint feature vector of the object can be expressed by the following formula (11).
[0138]
[0139] Among them, z i represents the attribute sentiment joint feature vector of the object, μ represents the mean vector of the attribute scores of the object, and ∑ represents the covariance matrix of the attribute scores of the object; μ and ∑ are the first predicted attribute label a′ of the i-th text sentence in the first original text information i and the first predicted sentiment label y′ i The overall feature information of the object can be expressed by the following formula (12).
[0140] o i =MLP([u,p,s,c i ]) (12)
[0141] In formula (12), o i represents the overall characteristic information of the object, u represents the user ID of the editor of the first original text information, p represents the object, s represents the overall emotional characteristics of the object, c i The sentence vectors of the first i-1 text sentences in the first original text information. The sentence vectors of the first i-1 text sentences in the first original text information c i It can be expressed by the following formula (13).
[0142] c i =MLP(c i-1 , x i-1 ) (13)
[0143] In formula (13), x i-1 The sentence vector representing the i-1th text sentence in the first predicted text information and the sentence vector representing the i-1th text sentence in the first original text information can be represented by the following formula (14).
[0144] x i-1 =Conv([x i-1,1 , …, x i-1,m ]) (14)
[0145] Among them, in formula (14), the sentence vector of the i-1th text sentence in the first original text information is obtained by convolution processing of the words in the i-1th text sentence in the first original text information. m is the number of words in the i-1th text sentence in the first original text information. After the joint feature vector of the overall feature information and attribute sentiment of the object is obtained, the joint feature vector of the overall feature information and attribute sentiment of the object can be input into the label recognition layer, and the label recognition layer can refer to a decoder composed of a gated recurrent unit (GRU). The way in which the label recognition layer generates the first predicted text information can be expressed by the following formulas (15) to (18).
[0146]
[0147]
[0148]
[0149]
[0150] From formula (15) to formula (18), it can be seen that the label recognition layer includes a multi-layer perception layer, a gated recurrent unit and a logic layer. First, the joint feature vector of the overall feature information and attribute emotion of the object is input into the multi-layer perception layer to obtain the initial value of the hidden layer state of the gated recurrent unit: According to the initial value of the hidden state of the gated recurrent unit and the tth word x in the i-th text sentence in the first original text information i,t Vectors of each hidden layer state of the gated recurrent unit are generated According to the hidden state of each gated recurrent unit and the weight W of the logic layer G Generate the probability of the tth word in the i-th text sentence in the first predicted text information Formula (18) [ ] j Represents the j-th dimension of a vector.
[0151] In order to improve the accuracy of emotion control at the attribute level of text information generated by the text generation model, the text generation model includes a label recognition layer, which performs label prediction on the first predicted text information. The process of obtaining the second predicted attribute emotion label can be expressed by the following formulas (19) to (21).
[0152]
[0153]
[0154]
[0155] From formula (19) to formula (21), it can be seen that the label recognition layer may include an average pooling layer and a logic layer. The average pooling layer is used to average the hidden state of each gated recurrent unit to obtain the average value of the hidden state The logistic layer is used to calculate the average value of the hidden layer state and the weight W of the logistic layer. Ga Generate the probability corresponding to the predicted attribute label of the i-th text sentence in the first predicted text information And according to the average value of the hidden layer state and the weight W of the logical layer Gy Generate the probability corresponding to the predicted sentiment label of the i-th text sentence in the first predicted text information
[0156] Optionally, the label recognition model includes a gated recurrent unit GRU, a multi-layer perception layer and a logic layer; the above-mentioned label recognition model is used to perform label recognition on the first original text information to obtain the first predicted attribute emotion label of the first original text information, including: using a gated recurrent unit to encode the first original text information, and obtaining the hidden layer state of the gated recurrent unit at time t The hidden layer state of the gated recurrent unit at time t can be expressed by the following formula (22).
[0157]
[0158] Then, the attention mechanism is introduced to generate the vector of the predicted attribute label of the first original text information according to the hidden state of the gated recurrent unit at time t The vector of the predicted attribute label of the first original text information can be expressed using the following formula (23).
[0159]
[0160] In formula (23), represents the attention weight of the hidden layer of the label recognition model at time t. The attention weight of the hidden layer can be determined according to the parameter vector V of the label recognition model and the state of the hidden layer. The attention weight of the hidden layer can be expressed by formula (24).
[0161]
[0162] Similarly, the vector of the predicted attribute label of the first original text information can be generated according to the hidden state of the gated recurrent unit at time t The vector of predicted attribute labels of the first original text information and the vector of predicted attribute labels of the first original text information Input the multi-layer perception layer and logic layer to obtain the probability of the first predicted attribute label corresponding to the first original text information and the probability of the first predicted sentiment label The probability of the first predicted attribute label and the probability of the first predicted sentiment label It can be expressed by the following formula (25) and formula (26) respectively.
[0163]
[0164]
[0165] Among them, W in formula (25) Ca and W in formula (26) Cy These are the parameter matrices of the label recognition model.
[0166] Optional, Figure 3 or Figure 5 The text information generating method may include the following steps s91 to s94.
[0167] s91. Obtain third original text information.
[0168] s92. Use the label recognition model to perform label recognition on the third original text information to obtain a predicted attribute sentiment label of the third original text information as a fourth predicted attribute sentiment label.
[0169] s93. If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth prediction attribute emotion label to obtain third prediction text information.
[0170] s94. Adjust the label recognition model according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model.
[0171] In steps s91 to s94, when the loss value of the adjusted text generation model meets the convergence state, that is, when the adjusted text generation model is an enhanced text generation model, the label recognition model can be trained according to the adjusted text generation model to improve the ability of the label recognition model to recognize labels, and then the label recognition model can be used to train the adjusted text generation model, that is, the text generation model and the label recognition model form a mutual learning framework. The loss value of the above-mentioned adjusted text generation model can refer to the loss value of the unlabeled label of the adjusted text generation model, or it can refer to the sum of the loss value of the labeled label of the adjusted text generation model and the loss value of the unlabeled label. Specifically, when the loss value of the adjusted text generation model is in a convergence state, the label recognition model can be trained in an unsupervised manner, that is, the label recognition model is trained using the original text information of the unlabeled label. That is, the computer device can obtain the third original text information from a text application platform such as a web page or an application interface, and the third original text information can refer to the original text information without annotated tags; the label recognition model is used to perform label recognition on the third original text information to obtain the predicted attribute sentiment label of the third original text information, and the predicted attribute sentiment label of the third original text information is used as the fourth predicted attribute sentiment label. If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth predicted attribute sentiment label to obtain the third predicted text information. Further, the label recognition model can be adjusted according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model; that is, the label recognition capability of the label recognition model is adjusted according to the third predicted text information and the third original text information. By adopting an enhanced text generation model, the label recognition model is trained to obtain an enhanced label recognition model, and the enhanced label recognition model can be used to train the adjusted text generation model, that is, the text generation model and the label recognition model form a framework for mutual learning, which can improve the accuracy of label recognition of the label recognition model, and improve the accuracy of text information generated by the text generation model. In the process of training the label recognition model, by adopting the third original text information without annotated labels to train the label recognition model, there is no need to manually annotate a large amount of original text information, thereby improving the training efficiency of the label recognition model.
[0172] Optionally, the above step s94 may include the following steps s111 to s112.
[0173] s111. Generate a loss value of the unlabeled label of the label recognition model based on the third predicted text information and the third original text information.
[0174] s112. If the loss value of the unlabeled label of the label recognition model does not meet the convergence condition, the label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0175] In steps s111 to s112, the computer device may generate the loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information; the loss value of the unlabeled label of the label recognition model may refer to: when the label recognition model is trained using the original text information of the unlabeled label, the loss value of the unlabeled label of the label recognition model is used to reflect: the accuracy of label recognition of the label recognition model. If the loss value of the unlabeled label of the label recognition model does not meet the convergence condition, it indicates that the accuracy of label recognition of the label recognition model is relatively low; therefore, according to the loss value of the unlabeled label of the label recognition model, the label recognition model is adjusted to obtain a target label recognition model for training the adjusted text generation model. If the loss value of the unlabeled label of the label recognition model meets the convergence condition, it indicates that the accuracy of label recognition of the label recognition model is relatively high; therefore, the label recognition model is used as the target label recognition model. By adjusting the label recognition model using the unlabeled loss value of the label recognition model, it is beneficial to improve the label recognition accuracy of the label recognition model.
[0176] Optionally, the above step s111 may include the following steps s211 to s212.
[0177] s211. Generate a reconstruction weight of the label recognition model according to the third predicted text information.
[0178] s212. Determine the loss value of the unlabeled label of the label recognition model based on the reconstruction weight and the third original text information.
[0179] In steps s211 to s212, if Figure 7 As shown, for the original text information without labeled labels, since the true attribute sentiment label is unknown, a reconstruction reward function can be introduced to train the label recognition model to improve the label recognition accuracy of the label recognition model. Specifically, the probability corresponding to the third predicted text information generated by the adjusted text generation model can be used to generate the reconstruction weight of the label recognition model, and the loss value of the unlabeled label of the label recognition model is determined based on the reconstruction weight and the third original text information. In the process of training the label recognition model, the label recognition accuracy of the label recognition model can be improved by introducing a reconstruction reward function (i.e., reconstruction weight).
[0180] For example, a reconstruction function may be constructed based on the prediction probability corresponding to the third prediction text information, and the reconstruction function may be expressed using the following formula (27).
[0181]
[0182] In formula (27), a k ′ and y k ′ respectively represent the predicted attribute label and predicted sentiment label of the kth text sentence of the third original text information output by the label recognition model, Represents the adjusted text generation model according to a k ′ and y k ′ is the probability corresponding to the third predicted text information generated by the adjusted text generation model. Considering the low accuracy of text information generated by the adjusted text generation model and the noise impact, a threshold λ is introduced here to constrain the reconstruction reward function and obtain the reconstruction weight, which can be expressed by the following formula (28).
[0183]
[0184] The threshold λ in formula (28) can be determined according to the accuracy of the text information generated by the adjusted text generation model, or can be manually set. Then, the loss value of the unlabeled label of the label recognition model can be determined according to the reconstruction weight, the fourth prediction attribute sentiment label and the fifth prediction attribute sentiment label. The loss value of the unlabeled label of the label recognition model can be expressed by the following formula (29).
[0185]
[0186] In formula (29), and are the predicted attribute labels a of the kth text sentence of the third original text information output by the label recognition model k ′ and the predicted sentiment label y k The probability of ′, Representation calculation expectations.
[0187] Optional, Figure 3 or Figure 5 The text information generating method may include the following steps s311 to s314.
[0188] s311, obtaining third original text information and fourth original text information; the fourth original text information has a second annotation attribute emotion label.
[0189] s312. Use the label recognition model to perform label recognition on the third original text information to obtain a fourth predicted attribute sentiment label, and perform label recognition on the fourth original text information to obtain a fifth predicted attribute sentiment label.
[0190] s313. If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth prediction attribute emotion label to obtain third prediction text information.
[0191] s314. According to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label and the second labeled attribute sentiment label, the label recognition model is adjusted to obtain a target label recognition model for training the adjusted text generation model.
[0192] In steps s311 to s314, when the loss value of the adjusted text generation model is in a convergence state, that is, when the adjusted text generation model is an enhanced text generation model, the label recognition model can be trained in a semi-supervised manner, that is, the label recognition model is trained by combining the original text information without annotated labels with the original text information with annotated labels. Specifically, the computer device can obtain the third original text information and the fourth original text information from a text application platform such as a web page or an application interface; the fourth original text information has a second annotated attribute sentiment label; that is, the third original text information is the original text information without annotated labels, and the fourth original text information can refer to the original text information with annotated labels. Further, the label recognition model can be used to perform label recognition on the third original text information to obtain the fourth predicted attribute sentiment label, and the label recognition on the fourth original text information can be performed to obtain the fifth predicted attribute sentiment label. If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth predicted attribute sentiment label to obtain the third predicted text information. According to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label and the second labeled attribute sentiment label, the label recognition model is adjusted to obtain a target label recognition model for training the adjusted text generation model. By using the third original text information without labeled labels and the fourth original text information with labeled labels to train the label recognition model, it is possible to use a large amount of original text information without labeled labels and a small amount of original text information with labeled labels to train the label recognition model, without the need to manually label a large amount of original text information, thereby improving the training efficiency of the label recognition model and the accuracy of the label recognition model in identifying labels.
[0193] Optionally, the above step s314 may include the following steps s411 to s413.
[0194] s411. Generate a loss value of the unlabeled label of the label recognition model based on the third predicted text information and the third original text information.
[0195] s412. Generate a loss value of the labeled label of the label recognition model based on the fifth predicted attribute sentiment label and the second labeled attribute sentiment label.
[0196] s413. Adjust the label recognition model according to the loss value of the unlabeled label of the label recognition model and the loss value of the labeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0197] In steps s411 to s413, the computer device can generate the loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information; that is, the loss value of the unlabeled label of the label recognition model can refer to: when the label recognition model is trained using the original text information without the labeled label, the loss value of the label recognition model. The loss value of the labeled label of the label recognition model can be generated according to the fifth predicted attribute sentiment label and the second labeled attribute sentiment label; that is, the loss value of the labeled label of the label recognition model can refer to: when the label recognition model is trained using the original text information with the labeled label, the loss value of the label recognition model. The loss value of the unlabeled label of the label recognition model and the loss value of the labeled label can both be used to reflect: the accuracy of label recognition of the label recognition model; therefore, the label recognition model can be adjusted according to the loss value of the unlabeled label of the label recognition model and the loss value of the labeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model. For example, the sum of the loss value of the unlabeled labels of the label recognition model and the loss value of the labeled labels of the label recognition model can be obtained to obtain the total loss value of the label recognition model. If the total loss value of the label recognition model meets the convergence condition, the label recognition model is used as the target label recognition model; if the total loss value of the label recognition model does not meet the convergence condition, the label recognition model can be adjusted according to the total loss value of the label recognition model to obtain the target label recognition model for training the adjusted text generation model.
[0198] It should be noted that the implementation process of generating the loss value of the unlabeled label of the label recognition model based on the third predicted text information and the third original text information in step s411 can refer to the implementation process of generating the loss value of the unlabeled label of the label recognition model in the above step s111, and the repeated parts will not be repeated here.
[0199] For example, for the original text information with annotated labels, the loss value of the unlabeled labels of the label recognition model can be obtained according to the cross entropy of the predicted attribute sentiment label and the annotated attribute sentiment label. The loss value of the unlabeled labels of the label recognition model can be expressed by the following formula (30).
[0200]
[0201] In formula (30), Represents the probability corresponding to the predicted attribute label of the kth text sentence of the fourth original text information; Represents the probability corresponding to the predicted sentiment label of the kth text sentence of the fourth original text information.
[0202] Based on the above description, please see Figure 8 , is a flowchart of a text information generation method provided in an embodiment of the present application. The method can be executed by a computer device, which can refer to Figure 1 The service equipment or terminal in Figure 8 As shown, the text information generating method may include the following steps S301 to S303.
[0203] S301, obtaining attribute information of the target object and emotion information of the attribute information of the target object.
[0204] The attribute information of the target object may refer to the attribute information of the object to be commented on in the comment scene; or to the keywords of the dialogue content in the dialogue scene; or to the attribute information of the object described in the article (poem) in the literary creation scene. The emotional information of the attribute information of the target object may refer to the emotional information input by the user, which is used to reflect the user's satisfaction with the attribute information of the target object, or reflect the user's preference for the attribute information of the target object.
[0205] S302: Generate a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object.
[0206] The computer device can generate a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object. The attribute emotion label of the target object includes the attribute label of the target object and the emotion label of the target object.
[0207] S303, using the target text generation model to perform text recognition on the target attribute sentiment label to obtain target text information; the target text generation model is obtained by adjusting the text generation model using the text information generation method.
[0208] The computer device can use the target text generation model to perform text recognition on the target attribute emotion label to obtain the target text information; that is, the target text information has the target attribute emotion label, and the target text generation model is an enhanced text generation model. By using the target text generation model, text information with attribute emotion labels can be generated, attribute-level emotion control of text information can be achieved, and the diversity and richness of generated text information can be improved; and the user does not need to manually edit the text information, thereby improving the efficiency of generating text information.
[0209] For example, in a comment generation scenario, the emotional information is the rating information of the target object. After the user purchases or experiences the target object, the attribute information of the target object can be rated; accordingly, the computer device can obtain the attribute information of the target object and the rating information of the user for the attribute information of the target object. For example, if the target object is an item purchased by the user from the Internet, the attribute information of the target object includes at least one of appearance, price, logistics, and performance, etc.; for another example, if the target object is a restaurant where the user dines, the attribute information of the target object includes at least one of environment, price, service, etc. The rating information for the attribute information of the target object can refer to the user's satisfaction with the attribute information of the target object, which can be represented by numbers or symbols. Further, based on the attribute information of the target object and the emotional information of the attribute information of the target object, a target attribute emotional label of the target object is generated, and the attribute emotional label of the target object includes the attribute label of the target object and the emotional label; the attribute label of the target object is the attribute information of the target object, and the emotional label of the target object can include positive (i.e., good reviews), neutral, and negative (bad reviews). Then, the target text generation model may be used to perform text recognition on the emotional attribute label of the target object to obtain target text information, which is the comment text of the target object.
[0210] For another example, in a literary creation scenario, if a user needs to create a poem, the user can input the target object to be described in the poem, the attribute information of the target object, and the emotional information corresponding to the attribute information of the target object; accordingly, the computer device can obtain the attribute information and emotional information of the target object input by the user. For example, the target object to be described in the poem is "hometown", and the attribute information of the target object is the mountains, water, and people of the hometown; the emotional information corresponding to the mountains and water can be like, and the emotional information corresponding to the people can be respect, etc. The attribute label of the target object is the attribute information of the target object, and the emotional label of the target object can include like, sadness, joy, respect, etc. Then, the target text generation model can be used to perform text recognition on the emotional attribute label of the target object to obtain the target text information, which is the generated poem.
[0211] In the present application, an attribute emotion tag of the target object is generated according to the attribute information of the target object and the emotion information of the attribute information of the target object, and a target text generation model is used to perform text recognition on the attribute emotion tag of the target object to obtain target text information; by adopting the target text generation model, text information with attribute emotion tags can be generated, attribute-level emotion control of the text information can be achieved, and the diversity and richness of the generated text information can be improved; and there is no need for users to manually edit the text information, thereby improving the efficiency of generating text information.
[0212] Optionally, the attribute sentiment label of the target object includes the attribute label of the target object and a sentiment label for the attribute information of the target object;
[0213] The above step S103 may include the following steps s511 to s514.
[0214] s511. Using the target text generation model, determine the overall sentiment label of the target object according to the sentiment label of the attribute information of the target object.
[0215] s512, performing overall text recognition on the overall sentiment label of the target object to obtain the overall text information of the target object.
[0216] s513, performing attribute text recognition on the attribute label of the target object and the sentiment label of the attribute information of the target object, and generating text information corresponding to the attribute information of the target object.
[0217] s514. Generate the target text information according to the overall text information of the target object and the text information corresponding to the attribute information of the target object.
[0218] In steps s511 to s514, the computer device can use the target text generation model to determine the overall emotional label of the target object according to the emotional label of the attribute information of the target object; the overall emotional label of the target object is used to reflect the user's overall satisfaction with the target object. The overall emotional label of the target object can be subjected to overall text recognition to obtain the overall text information of the target object, and the attribute label of the target object and the emotional label of the attribute information of the target object can be subjected to attribute text recognition to generate text information corresponding to the attribute information of the target object. Here, the overall text information of the target object is used to describe the user's comprehensive satisfaction with the target object, and the text information corresponding to the attribute information of the target object is used to describe the user's satisfaction with the attribute information of the target object. Further, the overall text information of the target object and the text information corresponding to the attribute information of the target object can be arranged to obtain the target text information. By generating the overall text information of the target object and the text information corresponding to the attribute information of the target object according to the overall emotional label of the target object and the emotional label of the attribute information of the target object, multi-dimensional text information of the target object can be generated, thereby improving the diversity and richness of the text information; and the emotional control of the attribute level of the text information can be realized to improve the accuracy of the generated text information.
[0219] See also Fig. 9 , is a schematic diagram of the structure of a text generation device 1 provided in an embodiment of the present application. The above-mentioned text generation device can be a computer program (including program code) running in a computer device, for example, the text generation device is an application software; the device can be used to execute the corresponding steps of the method provided in an embodiment of the present application. Fig. 9 As shown, the text generation device may include:
[0220] An acquisition module 901 is used to acquire first original text information;
[0221] A label recognition module 902 is used to perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information;
[0222] A text prediction module 903 is used to perform text prediction on the first prediction attribute sentiment label using a text generation model to obtain first prediction text information, and perform label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information;
[0223] The adjustment module 904 is used to adjust the text generation model according to the first original text information, the first predicted text information, the first predicted attribute emotion label and the second predicted attribute emotion label to obtain a target text generation model for generating target text information.
[0224] Optionally, the adjustment module 904 is specifically configured to generate a loss value of an unlabeled label of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0225] If the loss value of the unlabeled label of the text generation model does not meet the convergence condition, the text generation model is adjusted according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information.
[0226] Optionally, the adjustment module 904 is specifically configured to generate a text recognition loss value of the text generation model as a first text recognition loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0227] Generate an attribute emotion recognition loss value of the text generation model according to the first predicted attribute emotion label and the second predicted attribute emotion label as a first attribute emotion recognition loss value;
[0228] The sum of the first text recognition loss value and the first attribute emotion recognition loss value is obtained to obtain the loss value of the unlabeled label of the text generation model.
[0229] Optionally, the first predicted attribute emotion label includes a first predicted attribute label and a first predicted emotion label, and the second predicted attribute emotion label includes a second predicted attribute label and a second predicted emotion label; the adjustment module 904 is specifically used to generate the attribute recognition confidence of the text generation model according to the first predicted attribute label, and generate the emotion recognition confidence of the text generation model according to the first predicted emotion label;
[0230] generating an attribute recognition loss value of the text generation model according to the attribute recognition confidence and the second predicted attribute label as a first attribute recognition loss value;
[0231] Generate an emotion recognition loss value of the text generation model according to the emotion recognition confidence and the second predicted emotion label as a first emotion recognition loss value;
[0232] The sum of the first attribute recognition loss value and the first emotion recognition loss value is obtained to obtain the first attribute emotion recognition loss value.
[0233] Optionally, the adjustment module 904 is specifically used to determine the attribute emotion confidence of the text generation model according to the attribute recognition confidence and the emotion recognition confidence;
[0234] The first text recognition loss value is determined according to the attribute sentiment confidence, the first original text information and the first predicted text information.
[0235] According to one embodiment of the present application, Figure 3 The steps involved in the text information generation method shown can be Fig. 9 The various modules in the text generation device shown are executed. For example, Figure 3 The step S101 shown in FIG. 1 can be performed by Fig. 9 The acquisition module 901 in is executed, Figure 3 The step S102 shown in FIG. 1 can be performed by Fig. 9 The tag identification module 902 is used to execute; Figure 3 The step S103 shown in FIG. 1 can be performed by Fig. 9 The text prediction module 903 is used to perform; Figure 3 The step S104 shown in FIG. 1 can be performed by Fig. 9 The adjustment module 904 in is used for execution.
[0236] According to one embodiment of the present application, Fig. 9 The various modules in the text generation device shown can be separately or all combined into one or several units to form, or one (some) of the units can be further divided into multiple smaller sub-units in function, and the same operation can be achieved without affecting the realization of the technical effects of the embodiments of the present application. The above modules are divided based on logical functions. In practical applications, the functions of one module can also be realized by multiple units, or the functions of multiple modules can be realized by one unit. In other embodiments of the present application, the text generation device can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0237] According to one embodiment of the present application, the program can be executed by running on a general-purpose computer device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in Fig. 9 The text generation device shown in the embodiment of the present application is implemented to realize the text information generation method of the embodiment of the present application. The above computer program can be recorded on a computer readable recording medium, for example, and loaded into the above computing device through the computer readable recording medium and run therein.
[0238] In the present application, a computer device performs label recognition on the first original text information through a label recognition model to obtain a first predicted attribute emotion label of the first original text information; a text generation model is used to perform text prediction on the first predicted attribute emotion label to obtain a first predicted text information; a label prediction is performed on the first predicted text information to obtain a second predicted attribute emotion label of the first predicted text information. The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute emotion label, and the second predicted attribute emotion label to obtain a target text generation model for generating target text information, that is, the target text information has a target attribute emotion label. By performing label recognition on the original text information, the first predicted attribute emotion label of the original comment information is obtained, and the first predicted attribute emotion label is used as an annotation label of the original text information; there is no need to manually annotate a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; the trained (i.e. adjusted) text generation model can have the ability to generate text information belonging to the attribute emotion label, accurately control the attribute level emotion of the text information, and improve the accuracy of the text generation model to generate text.
[0239] Optionally, the acquisition module 901 is used for second original text information; the second original text information has a first annotation attribute sentiment label;
[0240] A text prediction module 903 is used to perform text prediction on the first annotation attribute sentiment label using a text generation model to obtain second predicted text information, and perform label prediction on the second predicted text information to obtain a third predicted attribute sentiment label of the second predicted text information;
[0241] The adjustment module 904 is used to adjust the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, the second predicted attribute sentiment label, the second original text information, the second predicted text information, the first marked attribute sentiment label and the third predicted attribute sentiment label to obtain a target text generation model for generating target text information.
[0242] Optionally, the adjustment module 904 is specifically configured to generate a loss value of an unlabeled label of the text generation model as a first loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0243] Generate a loss value of the annotation label of the text generation model as a second loss value according to the second original text information, the second predicted text information, the first annotation attribute sentiment label, and the third predicted attribute sentiment label;
[0244] The text generation model is adjusted according to the first loss value and the second loss value.
[0245] Optionally, the adjustment module 904 is specifically configured to obtain the sum of the first loss value and the second loss value to obtain a total loss value of the text generation model;
[0246] If the total loss value of the text generation model does not meet the convergence state, the text generation model is adjusted according to the total loss value of the text generation model to obtain a target text generation model for generating target text information.
[0247] Optionally, the text generation model includes a feature extraction layer, a text recognition layer, and a label recognition layer;
[0248] Optionally, a label recognition module 902 is specifically configured to extract features of the first predicted attribute emotion label using the feature extraction layer to obtain label feature information;
[0249] Using the text recognition layer to perform text prediction on the label feature information to obtain the first predicted text information;
[0250] The label recognition layer is used to perform label prediction on the first predicted text information to obtain the second predicted attribute sentiment label.
[0251] Optionally, the first predicted attribute sentiment label includes a first predicted attribute label and a first predicted sentiment label; the first predicted attribute label is used to reflect the attribute of the object corresponding to the first original text information, and the first predicted sentiment label is used to reflect the score of the attribute of the object corresponding to the first original text information; the label identification module 902 is specifically used to use the feature extraction layer to obtain the score corresponding distribution function of the attribute of the object;
[0252] Performing sampling processing on the distribution function to obtain statistical feature information corresponding to the score of the attribute of the object;
[0253] Obtaining the sum of the scores of the attributes of the object to obtain an overall score of the object;
[0254] Performing feature extraction on the overall score of the object to obtain overall feature information of the object;
[0255] The overall feature information of the object and the statistical feature information are concatenated to obtain the label feature information.
[0256] Optionally, the acquisition module 901 is further configured to acquire third original text information;
[0257] Optionally, the label recognition module 902 is further configured to use the label recognition model to perform label recognition on the third original text information to obtain a predicted attribute sentiment label of the third original text information as a fourth predicted attribute sentiment label;
[0258] Optionally, the text prediction module 903 is further configured to, if the loss value of the adjusted text generation model satisfies a convergence condition, use the adjusted text generation model to perform text prediction on the fourth prediction attribute emotion label to obtain third predicted text information;
[0259] Optionally, the adjustment module 904 is further used to adjust the label recognition model according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model.
[0260] Optionally, the adjustment module 904 is specifically configured to generate a loss value of an unlabeled label of the label recognition model according to the third predicted text information and the third original text information;
[0261] If the loss value of the unlabeled label of the label recognition model does not meet the convergence condition, the label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0262] Optionally, an adjustment module 904 is specifically configured to generate a reconstruction weight of the tag recognition model according to the third predicted text information;
[0263] The loss value of the unlabeled label of the label recognition model is determined according to the reconstruction weight, the fourth prediction attribute sentiment label and the fifth prediction attribute sentiment label.
[0264] Optionally, the acquisition module 901 is further used to acquire third original text information and fourth original text information; the fourth original text information has a second annotation attribute sentiment label;
[0265] Optionally, a label recognition module 902 is used to use the label recognition model to perform label recognition on the third original text information to obtain a fourth predicted attribute sentiment label, and to perform label recognition on the fourth original text information to obtain a fifth predicted attribute sentiment label;
[0266] Optionally, a text prediction module 903 is used to perform text prediction on the fourth prediction attribute sentiment label using the adjusted text generation model to obtain third prediction text information if the loss value of the adjusted text generation model meets the convergence condition, and perform label prediction on the third prediction text information to obtain a fifth prediction attribute sentiment label;
[0267] Optionally, the adjustment module 904 is used to adjust the label recognition model according to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label and the second annotation attribute sentiment label to obtain a target label recognition model for training the adjusted text generation model.
[0268] Optionally, an adjustment module 904 is used to generate a loss value of an unlabeled label of the label recognition model according to the third predicted text information and the third original text information;
[0269] Generate a loss value of the labeling label of the label recognition model according to the fifth predicted attribute sentiment label and the second labeling attribute sentiment label;
[0270] The label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model and the loss value of the labeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0271] In the present application, by performing label recognition on the original text information, the predicted attribute sentiment label of the original comment information is obtained, and the first original text information without labeled labels and the second original text information with labeled labels are used to train the text generation model. In this way, it is possible to train the text generation model using a small amount of original text information with labeled labels and a large amount of unlabeled labels; there is no need to manually label a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; the trained (i.e. adjusted) text generation model can have the ability to generate text information belonging to attribute sentiment labels, can accurately control the attribute level sentiment of the text information, and improve the accuracy of text generation by the text generation model.
[0272] See also Fig.10 , is a schematic diagram of the structure of a text generation device 2 provided in an embodiment of the present application. The above-mentioned text generation device can be a computer program (including program code) running in a computer device, for example, the text generation device is an application software; the device can be used to execute the corresponding steps of the method provided in the embodiment of the present application. Fig.10 As shown, the text generation device may include:
[0273] An acquisition module 110 is used to acquire the attribute information of the target object and the emotion information of the attribute information of the target object;
[0274] A generating module 111, configured to generate a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object;
[0275] The text recognition module 112 is used to use a target text generation model to perform text recognition on the target attribute sentiment label to obtain target text information; the target text generation model is obtained by adjusting the text generation model using the text information generation method.
[0276] Optionally, the text recognition module 112 is specifically configured to use the target text generation model to determine the overall emotion label of the target object according to the emotion label of the attribute information of the target object;
[0277] Performing overall text recognition on the overall sentiment label of the target object to obtain overall text information of the target object;
[0278] Performing attribute text recognition on the attribute label of the target object and the sentiment label of the attribute information of the target object to generate text information corresponding to the attribute information of the target object;
[0279] The target text information is generated according to the overall text information of the target object and the text information corresponding to the attribute information of the target object.
[0280] In the present application, an attribute emotion tag of the target object is generated according to the attribute information of the target object and the emotion information of the attribute information of the target object, and a target text generation model is used to perform text recognition on the attribute emotion tag of the target object to obtain target text information; by adopting the target text generation model, text information with attribute emotion tags can be generated, attribute-level emotion control of the text information can be achieved, and the diversity and richness of the generated text information can be improved; and there is no need for users to manually edit the text information, thereby improving the efficiency of generating text information.
[0281] See also Fig.11 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Fig.11As shown, the above-mentioned computer device 1000 may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the above-mentioned computer device 1000 may also include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may optionally also be at least one storage device located away from the aforementioned processor 1001. As Fig.11 As shown, the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application program.
[0282] exist Fig.11 In the computer device 1000 shown, the network interface 1004 can provide a network communication function; the user interface 1003 is mainly used to provide an input interface for the user; and the processor 1001 can be used to call the device control application stored in the memory 1005 to achieve:
[0283] Obtaining first original text information;
[0284] Performing label recognition on the first original text information to obtain a first predicted attribute sentiment label of the first original text information;
[0285] Using a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and performing label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information;
[0286] The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label to obtain a target text generation model for generating target text information.
[0287] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0288] Generate a loss value of an unlabeled label of the text generation model according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0289] If the loss value of the unlabeled label of the text generation model does not meet the convergence condition, the text generation model is adjusted according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information.
[0290] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0291] Generate a text recognition loss value of the text generation model as a first text recognition loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0292] Generate an attribute emotion recognition loss value of the text generation model according to the first predicted attribute emotion label and the second predicted attribute emotion label as a first attribute emotion recognition loss value;
[0293] The sum of the first text recognition loss value and the first attribute emotion recognition loss value is obtained to obtain the loss value of the unlabeled label of the text generation model.
[0294] Optionally, the first predicted attribute emotion label includes a first predicted attribute label and a first predicted emotion label, and the second predicted attribute emotion label includes a second predicted attribute label and a second predicted emotion label;
[0295] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0296] Generating an attribute recognition confidence of the text generation model according to the first predicted attribute label, and generating an emotion recognition confidence of the text generation model according to the first predicted emotion label;
[0297] generating an attribute recognition loss value of the text generation model according to the attribute recognition confidence and the second predicted attribute label as a first attribute recognition loss value;
[0298] Generate an emotion recognition loss value of the text generation model according to the emotion recognition confidence and the second predicted emotion label as a first emotion recognition loss value;
[0299] The sum of the first attribute recognition loss value and the first emotion recognition loss value is obtained to obtain the first attribute emotion recognition loss value.
[0300] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0301] Determining the attribute emotion confidence of the text generation model according to the attribute recognition confidence and the emotion recognition confidence;
[0302] The first text recognition loss value is determined according to the attribute sentiment confidence, the first original text information and the first predicted text information.
[0303] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0304] Acquire second original text information; the second original text information has a first annotation attribute sentiment label;
[0305] Using a text generation model to perform text prediction on the first annotation attribute sentiment label to obtain second predicted text information, and performing label prediction on the second predicted text information to obtain a third predicted attribute sentiment label of the second predicted text information;
[0306] According to the first original text information, the first predicted text information, the first predicted attribute sentiment label, the second predicted attribute sentiment label, the second original text information, the second predicted text information, the first annotated attribute sentiment label and the third predicted attribute sentiment label, the text generation model is adjusted to obtain a target text generation model for generating target text information.
[0307] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0308] Generate a loss value of an unlabeled label of the text generation model as a first loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label;
[0309] Generate a loss value of the annotation label of the text generation model as a second loss value according to the second original text information, the second predicted text information, the first annotation attribute sentiment label, and the third predicted attribute sentiment label;
[0310] The text generation model is adjusted according to the first loss value and the second loss value.
[0311] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0312] Obtaining the sum of the first loss value and the second loss value to obtain a total loss value of the text generation model;
[0313] If the total loss value of the text generation model does not meet the convergence state, the text generation model is adjusted according to the total loss value of the text generation model to obtain a target text generation model for generating target text information.
[0314] Optionally, the text generation model includes a feature extraction layer, a text recognition layer, and a label recognition layer;
[0315] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0316] Using the feature extraction layer to extract features of the first predicted attribute sentiment label to obtain label feature information;
[0317] Using the text recognition layer to perform text prediction on the label feature information to obtain the first predicted text information;
[0318] The label recognition layer is used to perform label prediction on the first predicted text information to obtain the second predicted attribute sentiment label.
[0319] Optionally, the first predicted attribute sentiment label includes a first predicted attribute label and a first predicted sentiment label; the first predicted attribute label is used to reflect the attribute of the object corresponding to the first original text information, and the first predicted sentiment label is used to reflect the score of the attribute of the object corresponding to the first original text information;
[0320] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0321] Using the feature extraction layer to obtain a score corresponding distribution function of the attribute of the object;
[0322] Performing sampling processing on the distribution function to obtain statistical feature information corresponding to the score of the attribute of the object;
[0323] Obtaining the sum of the scores of the attributes of the object to obtain an overall score of the object;
[0324] Performing feature extraction on the overall score of the object to obtain overall feature information of the object;
[0325] The overall feature information of the object and the statistical feature information are concatenated to obtain the label feature information.
[0326] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0327] Obtaining third original text information;
[0328] Using the label recognition model to perform label recognition on the third original text information, and obtaining a predicted attribute sentiment label of the third original text information as a fourth predicted attribute sentiment label;
[0329] If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth prediction attribute emotion label to obtain third prediction text information;
[0330] The label recognition model is adjusted according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model.
[0331] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0332] Generate a loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information;
[0333] If the loss value of the unlabeled label of the label recognition model does not meet the convergence condition, the label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0334] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0335] Generating a reconstruction weight of the tag recognition model according to the third predicted text information;
[0336] The loss value of the unlabeled label of the label recognition model is determined according to the reconstruction weight, the fourth prediction attribute sentiment label and the fifth prediction attribute sentiment label.
[0337] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0338] Acquire third original text information and fourth original text information; the fourth original text information has a second annotation attribute sentiment label;
[0339] Using the label recognition model to perform label recognition on the third original text information to obtain a fourth predicted attribute sentiment label, and performing label recognition on the fourth original text information to obtain a fifth predicted attribute sentiment label;
[0340] If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth prediction attribute sentiment label to obtain third prediction text information, and label prediction is performed on the third prediction text information to obtain a fifth prediction attribute sentiment label;
[0341] According to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label and the second labeled attribute sentiment label, the label recognition model is adjusted to obtain a target label recognition model for training the adjusted text generation model.
[0342] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0343] Generate a loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information;
[0344] Generate a loss value of the labeling label of the label recognition model according to the fifth predicted attribute sentiment label and the second labeling attribute sentiment label;
[0345] The label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model and the loss value of the labeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
[0346] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0347] Acquire attribute information of the target object and sentiment information of the attribute information of the target object;
[0348] Generate a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object;
[0349] The target text generation model is adopted to perform text recognition on the target attribute sentiment label to obtain target text information; the target text generation model is obtained by adjusting the text generation model using the text information generation method.
[0350] Optionally, the attribute sentiment label of the target object includes the attribute label of the target object and the sentiment label for the attribute information of the target object;
[0351] Optionally, the processor 1001 may be configured to call a device control application stored in the memory 1005 to implement:
[0352] Using the target text generation model, according to the emotion label of the attribute information of the target object, determine the overall emotion label of the target object;
[0353] Performing overall text recognition on the overall sentiment label of the target object to obtain overall text information of the target object;
[0354] Performing attribute text recognition on the attribute label of the target object and the sentiment label of the attribute information of the target object to generate text information corresponding to the attribute information of the target object;
[0355] The target text information is generated according to the overall text information of the target object and the text information corresponding to the attribute information of the target object.
[0356] In the present application, the computer device obtains the first predicted attribute emotion label of the first original text information by performing label recognition on the first original text information; uses the text generation model to perform text prediction on the first predicted attribute emotion label to obtain the first predicted text information; performs label prediction on the first predicted text information to obtain the second predicted attribute emotion label of the first predicted text information. The text generation model is adjusted according to the first original text information, the first predicted text information, the first predicted attribute emotion label, and the second predicted attribute emotion label to obtain the target text generation model for generating the target text information, that is, the target text information has the target attribute emotion label. That is, by performing label recognition on the original text information, the first predicted attribute emotion label of the original comment information is obtained, and the first predicted attribute emotion label is used as the annotation label of the original text information; there is no need to manually annotate a large amount of original text information, which can reduce the complexity of training the text generation model and improve the efficiency of training the text generation model; it can enable the trained (i.e. adjusted) text generation model to have the ability to generate text information belonging to the attribute emotion label, accurately control the attribute level emotion of the text information, and improve the accuracy of the text generation model to generate text.
[0357] It should be understood that the computer device 1000 described in the embodiment of the present application can execute the above Figure 3 , Figure 5 And the previous article Figure 8 The description of the above text information generation method in the corresponding embodiment can also be performed as described above. Figure 9-10 The description of the above-mentioned text generation device in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.
[0358] In addition, it should be pointed out here that: the present invention provides a computer program product or a computer program, which includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device can perform the above Figure 3 , Figure 5 and Figure 8 The description of the above-mentioned text information generation method in the corresponding embodiment, therefore, will not be repeated here. In addition, the description of the beneficial effects of the same method will not be repeated. For the technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the above-mentioned program instructions can be deployed on a computer device for execution, or deployed on multiple computer devices located at one location for execution, or, distributed in multiple locations and interconnected through a communication network. Multiple computer devices interconnected by a communication network can form a blockchain network. A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and the program can include the processes of the embodiments of the above-mentioned methods when executed. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc. The above disclosure is only the preferred embodiment of the present application, which certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A method for generating text information, characterized in that: include: Obtaining first original text information; Performing label recognition on the first original text information to obtain a first predicted attribute sentiment label of the first original text information; Using a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and performing label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information; Generate a text recognition loss value of the text generation model as a first text recognition loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label; Generate an attribute emotion recognition loss value of the text generation model according to the first predicted attribute emotion label and the second predicted attribute emotion label as a first attribute emotion recognition loss value; Obtaining the sum of the first text recognition loss value and the first attribute emotion recognition loss value to obtain the loss value of the unlabeled label of the text generation model; If the loss value of the unlabeled label of the text generation model does not meet the convergence condition, the text generation model is adjusted according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information.
2. The method according to claim 1, characterized in that The first predicted attribute emotion label includes a first predicted attribute label and a first predicted emotion label, and the second predicted attribute emotion label includes a second predicted attribute label and a second predicted emotion label; The step of generating the attribute emotion recognition loss value of the text generation model according to the first predicted attribute emotion label and the second predicted attribute emotion label as the first attribute emotion recognition loss value includes: Generating an attribute recognition confidence of the text generation model according to the first predicted attribute label, and generating an emotion recognition confidence of the text generation model according to the first predicted emotion label; generating an attribute recognition loss value of the text generation model according to the attribute recognition confidence and the second predicted attribute label as a first attribute recognition loss value; Generate an emotion recognition loss value of the text generation model according to the emotion recognition confidence and the second predicted emotion label as a first emotion recognition loss value; The sum of the first attribute recognition loss value and the first emotion recognition loss value is obtained to obtain the first attribute emotion recognition loss value.
3. The method according to claim 2, characterized in that The step of generating a text recognition loss value of the text generation model as a first text recognition loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label includes: Determining the attribute emotion confidence of the text generation model according to the attribute recognition confidence and the emotion recognition confidence; The first text recognition loss value is determined according to the attribute sentiment confidence, the first original text information and the first predicted text information.
4. A data processing method, characterized in that: include: Obtaining first original text information; Performing label recognition on the first original text information to obtain a first predicted attribute sentiment label of the first original text information; Using a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and performing label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information; Acquire second original text information; the second original text information has a first annotation attribute sentiment label; Using the text generation model to perform text prediction on the first annotation attribute sentiment label to obtain second predicted text information, and performing label prediction on the second predicted text information to obtain a third predicted attribute sentiment label of the second predicted text information; Generate a loss value of an unlabeled label of the text generation model as a first loss value according to the first original text information, the first predicted text information, the first predicted attribute sentiment label, and the second predicted attribute sentiment label; Generate a loss value of the annotation label of the text generation model as a second loss value according to the second original text information, the second predicted text information, the first annotation attribute sentiment label, and the third predicted attribute sentiment label; The text generation model is adjusted according to the first loss value and the second loss value to obtain a target text generation model for generating target text information.
5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: Obtaining third original text information; Using a label recognition model to perform label recognition on the third original text information, and obtaining a predicted attribute sentiment label of the third original text information as a fourth predicted attribute sentiment label; If the loss value of the adjusted text generation model meets the convergence condition, the adjusted text generation model is used to perform text prediction on the fourth prediction attribute emotion label to obtain third prediction text information; The label recognition model is adjusted according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model.
6. The method according to claim 5, characterized in that The step of adjusting the label recognition model according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model includes: Generate a loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information; If the loss value of the unlabeled label of the label recognition model does not meet the convergence condition, the label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
7. The method according to claim 6, characterized in that The step of generating the loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information includes: Generating a reconstruction weight of the tag recognition model according to the third predicted text information; According to the reconstruction weight and the third original text information, a loss value of the unlabeled label of the label recognition model is determined.
8. The method according to claim 5, characterized in that The method further comprises: Acquire fourth original text information; the fourth original text information has a second annotation attribute sentiment label; Using the label recognition model to perform label recognition on the fourth original text information to obtain a fifth predicted attribute sentiment label; The step of adjusting the label recognition model according to the third predicted text information and the third original text information to obtain a target label recognition model for training the adjusted text generation model includes: According to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label and the second labeled attribute sentiment label, the label recognition model is adjusted to obtain a target label recognition model for training the adjusted text generation model.
9. The method according to claim 8, characterized in that The step of adjusting the label recognition model according to the third predicted text information, the third original text information, the fifth predicted attribute sentiment label, and the second labeled attribute sentiment label to obtain a target label recognition model for training the adjusted text generation model includes: Generate a loss value of the unlabeled label of the label recognition model according to the third predicted text information and the third original text information; Generate a loss value of the labeling label of the label recognition model according to the fifth predicted attribute sentiment label and the second labeling attribute sentiment label; The label recognition model is adjusted according to the loss value of the unlabeled label of the label recognition model and the loss value of the labeled label of the label recognition model to obtain a target label recognition model for training the adjusted text generation model.
10. A method for generating text information, characterized in that: include: Acquire attribute information of a target object and sentiment information of the attribute information of the target object; Generate a target attribute emotion label of the target object according to the attribute information of the target object and the emotion information of the attribute information of the target object; The target text generation model is used to perform text recognition on the target attribute sentiment label to obtain target text information; the target text generation model is obtained by adjusting the text generation model using the text information generation method according to any one of claims 1 to 9.
11. A text information generating device, characterized in that: include: An acquisition module, used for acquiring first original text information; A label recognition module, used to perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information; A text prediction module, configured to use a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and perform label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information; An adjustment module is used to generate a text recognition loss value of the text generation model as a first text recognition loss value based on the first original text information, the first predicted text information, the first predicted attribute emotion label and the second predicted attribute emotion label; generate an attribute emotion recognition loss value of the text generation model as a first attribute emotion recognition loss value based on the first predicted attribute emotion label and the second predicted attribute emotion label; obtain the sum of the first text recognition loss value and the first attribute emotion recognition loss value to obtain the loss value of the unlabeled label of the text generation model; if the loss value of the unlabeled label of the text generation model does not meet the convergence condition, adjust the text generation model according to the loss value of the unlabeled label of the text generation model to obtain a target text generation model for generating target text information.
12. A text information generating device, characterized in that: include: An acquisition module, used for acquiring first original text information; A label recognition module, used to perform label recognition on the first original text information to obtain a first predicted attribute emotion label of the first original text information; A text prediction module, configured to use a text generation model to perform text prediction on the first prediction attribute sentiment label to obtain first prediction text information, and perform label prediction on the first prediction text information to obtain a second prediction attribute sentiment label of the first prediction text information; The acquisition module is further used to acquire second original text information; the second original text information has a first annotation attribute sentiment label; The text prediction module is further used to use the text generation model to perform text prediction on the first annotation attribute sentiment label to obtain second predicted text information, and perform label prediction on the second predicted text information to obtain a third predicted attribute sentiment label of the second predicted text information; An adjustment module is used to generate a loss value of the unlabeled label of the text generation model as a first loss value based on the first original text information, the first predicted text information, the first predicted attribute sentiment label and the second predicted attribute sentiment label; generate a loss value of the labeled label of the text generation model as a second loss value based on the second original text information, the second predicted text information, the first labeled attribute sentiment label and the third predicted attribute sentiment label; and adjust the text generation model according to the first loss value and the second loss value to obtain a target text generation model for generating target text information.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 10.
14. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Object detection model training method and device, object detection method and device, computer equipment and storage medium
CN111291755A
