Plot text processing method and device, computer device and storage medium
By training an initial summary generation model, using plot text and script auxiliary information for prediction loss calculation, and adjusting model parameters, the problem of inaccurate plot summaries was solved, and accurate plot summary generation was achieved.
Patent Information
- Application Number
- CN202410962941.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-07-17
AI Technical Summary
Traditional plot summary generation models are prone to producing plot summaries that do not match the plot text or are worded incorrectly, resulting in inaccurate plot summaries.
By acquiring multiple initial training samples, including sample plot text and script auxiliary information, an initial summary generation model is trained. The prediction loss is calculated using the features of sample plot summaries, predicted plot summaries, script auxiliary information, and prediction auxiliary information. The model parameters are then adjusted to obtain the trained summary generation model, which generates accurate plot summaries.
It achieves the generation of accurate plot summaries, avoids misinterpretation of plot text by plot summary output, and improves the accuracy of plot summaries.
Smart Images

Figure CN118690012B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for processing narrative text. Background Technology
[0002] With the development of artificial intelligence and natural language processing (NLP) technologies, summarization generation models based on NLP have been widely applied. These models aim to extract key information from text and generate concise summaries containing that information. In particular, summarization models can be applied to generate plot summaries for narrative texts; understandably, generating plot summaries helps in quickly understanding the storyline.
[0003] In traditional methods, plot summaries are usually generated based on GPT (Generative Pre-Trained Transformer)2 or GPT4. By inputting the plot text of a certain scene and asking GPT a question, GPT can be obtained in response to the plot summary of the input script.
[0004] However, while traditional summary generation models can quickly generate plot summaries, they are prone to producing plot summaries that do not match the content of the plot text or are worded incorrectly, resulting in inaccurate plot summaries. Summary of the Invention
[0005] Therefore, it is necessary to provide a plot text processing method, apparatus, computer device, computer-readable storage medium, and computer program product that can generate accurate plot summaries to address the aforementioned technical problems.
[0006] Firstly, this application provides a method for processing narrative text. The method includes:
[0007] Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary;
[0008] For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model to predict the plot summary and auxiliary information, so as to obtain the predicted plot summary and predicted auxiliary information features.
[0009] The prediction loss is calculated based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the features of the prediction auxiliary information to obtain the prediction loss value corresponding to the initial training sample.
[0010] Based on the prediction loss values corresponding to the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0011] Secondly, this application also provides a plot text processing apparatus. The apparatus includes:
[0012] The acquisition module is used to acquire multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary;
[0013] The prediction module is used to input the sample plot text in the initial training sample into the initial summary generation model for each initial training sample to predict the plot summary and auxiliary information, thereby obtaining the predicted plot summary and predicted auxiliary information features.
[0014] The loss estimation module is used to calculate the prediction loss based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the features of the prediction auxiliary information, so as to obtain the prediction loss value corresponding to the initial training sample.
[0015] The parameter adjustment module is used to adjust the parameters of the initial summary generation model according to the prediction loss values corresponding to the multiple initial training samples, so as to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0016] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0017] Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary;
[0018] For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model to predict the plot summary and auxiliary information, so as to obtain the predicted plot summary and predicted auxiliary information features.
[0019] The prediction loss is calculated based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the features of the prediction auxiliary information to obtain the prediction loss value corresponding to the initial training sample.
[0020] Based on the prediction loss values corresponding to the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0021] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0022] Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary;
[0023] For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model to predict the plot summary and auxiliary information, so as to obtain the predicted plot summary and predicted auxiliary information features.
[0024] The prediction loss is calculated based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the features of the prediction auxiliary information to obtain the prediction loss value corresponding to the initial training sample.
[0025] Based on the prediction loss values corresponding to the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0026] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:
[0027] Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary;
[0028] For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model to predict the plot summary and auxiliary information, so as to obtain the predicted plot summary and predicted auxiliary information features.
[0029] The prediction loss is calculated based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the features of the prediction auxiliary information to obtain the prediction loss value corresponding to the initial training sample.
[0030] Based on the prediction loss values corresponding to the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0031] The aforementioned plot text processing method, apparatus, computer equipment, storage medium, and computer program product, based on acquiring multiple initial training samples for training the initial summary generation model, inputs the sample plot text from each initial training sample into the initial summary generation model to predict the plot summary and auxiliary information. This yields predicted plot summary and auxiliary information features. The predicted loss can then be calculated using the sample plot summary, predicted plot summary, script auxiliary information, and predicted auxiliary information features to obtain the prediction loss value corresponding to the initial training sample. The parameters of the initial summary generation model can be adjusted based on the prediction loss values corresponding to each of the multiple initial training samples to obtain the trained summary generation model. Throughout this process, during the training of the initial summary generation model, the cascading prediction of script auxiliary information allows the model to understand the correct summary-related information from the script auxiliary information and supports plot summary generation. This avoids situations where the plot summary output misunderstands the plot text, resulting in a summary generation model capable of outputting accurate plot summaries. Accurate plot summaries can be generated by inputting the plot text into the trained summary generation model. Attached Figure Description
[0032] Figure 1 This is a diagram illustrating the application environment of a narrative text processing method in one embodiment.
[0033] Figure 2 This is a flowchart illustrating a plot text processing method in one embodiment;
[0034] Figure 3 This is a schematic diagram of the network structure of a summary prediction network in one embodiment;
[0035] Figure 4 This is a schematic diagram of an initial summary generation model in one embodiment;
[0036] Figure 5 This is a schematic diagram of an initial summary generation model in another embodiment;
[0037] Figure 6 This is a schematic diagram illustrating the prediction of loss values in one embodiment;
[0038] Figure 7 This is a schematic diagram of the network structure of the auxiliary information prediction network in one embodiment;
[0039] Figure 8 This is a schematic diagram of the cascaded hierarchical information learning process in one embodiment;
[0040] Figure 9 Here is a structural diagram of the hierarchical reinforcement learning information joint model process in one embodiment;
[0041] Figure 10 A schematic diagram of a reference model for generating a summary in one embodiment;
[0042] Figure 11 This is a structural block diagram of a plot text processing device in one embodiment;
[0043] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0044] This application relates to Artificial Intelligence (AI) technology. Artificial intelligence is the theory, methods, technology, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, artificial intelligence is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0045] Artificial intelligence (AI) is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, pre-trained model technology, operating / interactive systems, and mechatronics. Pre-trained models, also known as large-scale models or foundational models, can be widely applied to downstream tasks across various AI fields after fine-tuning. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning. This application mainly focuses on natural language processing technology.
[0046] Natural Language Processing (NLP) is an important field within computer science and artificial intelligence. It studies the theories and methods for enabling effective communication between humans and computers using natural language. NLP involves natural language—the language people use in daily life—and is closely related to linguistics; it also involves computer science and mathematics. It is a science that integrates linguistics, computer science, and mathematics. Therefore, research in this field involves natural language, the language people use in daily life, and thus it has a close connection with linguistics. Pre-trained models, an important technique for model training in artificial intelligence, evolved from large language models in NLP. After fine-tuning, large language models can be widely applied to downstream tasks. NLP techniques typically include text processing, semantic understanding, machine translation, question answering, and knowledge graphs.
[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0048] The plot text processing method provided in this application embodiment can be applied to, for example, Figure 1In the application environment shown, terminal 102 communicates with server 104 via a network. A data storage system can store the data that server 104 needs to process. The data storage system can be set up independently, integrated into server 104, or placed in the cloud or on other servers. Server 104 acquires multiple initial training samples for training the initial summary generation model. The initial training samples include sample plot text, sample plot summaries, and script auxiliary information describing the content of the sample plot text. The script auxiliary information is different from the sample plot summaries. For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model for plot summary prediction and auxiliary information prediction, resulting in predicted plot summary and predicted auxiliary information features. A prediction loss is calculated based on the sample plot summary, predicted plot summary, script auxiliary information, and predicted auxiliary information features to obtain the prediction loss value corresponding to the initial training sample. Based on the prediction loss values corresponding to each of the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model. The trained summary generation model is used to output plot summaries based on the input plot text. When a plot summary generation request is received from terminal 102, server 104 processes the plot text carried in the plot summary generation request using a trained summary generation model, generates a plot summary, and sends it back to terminal 102.
[0049] The terminal 102 can be, but is not limited to, various desktop computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. Portable wearable devices can include smartwatches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented using a standalone server or a server cluster composed of multiple servers, or it can be a cloud server or a node on a blockchain.
[0050] In one embodiment, such as Figure 2 As shown, a method for processing narrative text is provided. This method can be executed by a terminal or a server alone, or by both a terminal and a server working together. In this embodiment, the method is described using an application to a server as an example, and includes the following steps:
[0051] Step 202: Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, the script auxiliary information being different from the sample plot summary.
[0052] The initial summary generation model refers to a model whose parameters have been initialized and learning parameters set, but which has not yet been updated. It can be understood that the parameters of the initial summary generation model can be updated by learning from multiple initial training samples, resulting in a trained summary generation model.
[0053] The initial training samples refer to the training samples used to train the initial summary generation model. These initial training samples include sample plot text, sample plot summaries, and script auxiliary information describing the content of the sample plot text. This script auxiliary information differs from the sample plot summaries. The sample plot text refers to the plot text used as a sample. For example, the sample plot text could specifically refer to a film or television script used as a sample. A film or television script is a document prepared by a screenwriter for easy interpretation, mainly composed of time, place, characters, and dialogue between characters, used for subsequent filming guidance. The sample plot summary is the plot summary used as a sample. The plot summary is textual information extracted from the plot text from an event description perspective that summarizes the plot text, generally including time, place, characters, cause, process, and result.
[0054] The script supplementary information refers to information describing the content of the sample plot text and used to aid in understanding it. For example, specific script supplementary information may include the plot type, historical background, location of the plot, and character relationships within the sample plot text. It is understood that the plot type can be one of the preset plot types, the historical background can be one of the preset historical backgrounds, and the character relationships can be one of the preset character relationships.
[0055] Plot is one of the constituent elements of the sample plot text. It refers to the development process of a series of life events that demonstrate the relationships between characters in the sample plot text. It consists of a series of specific events that showcase character personalities and the relationships between characters and between characters and their environment. In this embodiment, the preset plot types can be configured according to the actual application scenario. For example, the preset plot types may specifically include ancient palace intrigue plots, ancient romance plots, ancient martial arts plots, ancient crime-solving plots, ancient daily life plots, modern entrepreneurial plots, office plots, etc.
[0056] The historical context refers to the historical situation or real-world environment that influences the characters and events in the sample plot text. In this embodiment, the preset historical context can be configured according to the actual application scenario. For example, the preset historical context may include the Republican era, the modern era, or the ancient era. The setting of the plot refers to the background location in which the content of the sample plot text takes place, which can be extracted from the sample plot text. For example, the setting of the plot may be a specific administrative region, such as Japan, the United States, or China, or a specific area within a specific administrative region, such as Chinatown in the United States or a rural area in China.
[0057] The character relationships described in the sample plot text refer to the relationships between at least two key characters appearing in the sample plot text. Key characters are those who are the main figures driving the plot development in the sample plot text. Specifically, key characters can be the characters that appear most frequently in the sample plot text. In this embodiment, the preset character relationships can be configured according to the actual application scenario. For example, preset character relationships can specifically include father-son, father-daughter, mother-son, mother-daughter, husband-wife, romantic partners, teacher-student relationships, etc., as well as relationships such as classmates or colleagues in modern scenarios, or master-servant relationships in ancient scenarios.
[0058] Specifically, when a summary generation model needs to be trained, the server will obtain multiple initial training samples for training the initial summary generation model. These initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content of the sample plot text. The script auxiliary information is different from the sample plot summary.
[0059] In specific applications, the sample plot summary can be obtained by extracting the plot from the sample plot text, and the script auxiliary information can be obtained by extracting auxiliary information from the sample plot text. That is, when generating the initial training samples, the server will first obtain the sample plot text, and then use the sample plot text to extract the sample plot summary and script auxiliary information.
[0060] In a specific application, given sample plot text, the server can use a pre-trained natural language model to extract a summary of the sample plot. Specifically, the server can obtain the summary by asking the pre-trained natural language model a question. For example, the question could be: "The following is the plot text of a scene from a play. Please extract a summary of this scene, describing the specific events that occur in the scene. Do not guess or provide abstract descriptions. The plot text is XXX." Here, XXX represents the specific sample plot text.
[0061] Understandably, since the sample plot summary obtained at this stage may contain errors in details or characters, further manual correction is usually required. After correction, the sample plot summary corresponding to the sample plot text can be obtained. The pre-trained natural language model can be configured according to the actual application scenario. For example, the pre-trained natural language model can be a generative pre-trained Transformer model, or other Transformer-based models.
[0062] In a specific application, given sample plot text and the type of script auxiliary information to be extracted, the server can also utilize a pre-trained natural language model to extract script auxiliary information. Specifically, the server can obtain script auxiliary information by asking questions to the pre-trained natural language model. For example, taking plot type as the script auxiliary information, the question could be: "The following is the plot text of a scene from a play. Based on the plot text, answer what the plot type of the plot text is. The plot types include plot type 1, plot type 2, plot type 3, plot type 4, and plot type 'cannot be inferred.' Only answer with a plot type you are confident about. When the plot type is unclear, answer 'cannot be inferred.' The plot text is: XXX." Here, XXX represents the specific sample plot text, and plot type 1, plot type 2, plot type 3, and plot type 4 are preset plot types that can be configured according to the actual application scenario.
[0063] For example, using script background information as a setting, the question could be: "The following is the plot text of a scene from a play. Based on the plot text, answer what the historical background of the plot text is. Historical background includes: Historical Background 1, Historical Background 2, Historical Background 3, Historical Background 4, and if the historical background cannot be inferred, only answer with certainty. If the historical background is unclear, answer 'I cannot infer the historical background.' The plot text is: XXX." Here, XXX represents the specific sample plot text, and Historical Background 1, Historical Background 2, Historical Background 3, and Historical Background 4 are preset historical backgrounds that can be configured according to the actual application scenario.
[0064] In a specific application, if the script's auxiliary information is character relationships, the server first needs to identify at least two key characters whose relationship needs to be determined from the sample plot text, and then use a pre-trained natural language model to extract the character relationships. For example, if the key characters whose relationship needs to be determined are character A and character B, the question could be: "The following is the plot text of a scene from a play. Based on the plot text, answer what the relationship is between character A and character B. Character relationships include Relationship 1, Relationship 2, Relationship 3, Relationship 4, and relationships that cannot be inferred. Only answer relationships that are certain. When the relationship is unclear, answer that the relationship cannot be inferred. The plot text is: XXX." Here, XXX represents the specific sample plot text, and Relationship 1, Relationship 2, Relationship 3, and Relationship 4 are preset character relationships that can be configured according to the actual application scenario.
[0065] Step 204: For each initial training sample, input the sample plot text in the initial training sample into the initial summary generation model to predict the plot summary and auxiliary information, and obtain the predicted plot summary and predicted auxiliary information features.
[0066] In this context, the predicted plot summary refers to the sample summary predicted by the initial summary generation model based on the sample plot text in the initial training samples. Predictive auxiliary information features refer to the features that characterize the predictive auxiliary information. For example, predictive auxiliary information features can specifically refer to vectors that characterize the predictive auxiliary information. It can be understood that the predictive auxiliary information can be uniquely determined through the predictive auxiliary information features output by the initial summary generation model. Predictive auxiliary information refers to the auxiliary information that can be uniquely determined based on the predictive auxiliary information features output by the initial summary generation model.
[0067] Specifically, for each initial training sample, the server inputs the sample plot text from the initial training sample into the initial summary generation model to predict the plot summary and auxiliary information, obtaining the predicted plot summary and predicted auxiliary information features. In practical applications, after inputting the sample plot text into the initial summary generation model, the model encodes the sample plot text to obtain the corresponding encoded vector. Then, it uses this encoded vector to predict the plot summary and auxiliary information, obtaining the predicted plot summary and predicted auxiliary information features.
[0068] In a specific application, the initial summary generation model can encode the sample plot text by encoding each character in the sample plot text to obtain the character code corresponding to each character in the sample plot text. That is, the encoding vector corresponding to the sample plot text includes the character code corresponding to each character in the sample plot text.
[0069] For example, the initial summary generation model can encode each character in the sample plot text using a pre-set dictionary. This pre-set dictionary can be configured according to the actual application scenario. Each Chinese character or letter in the pre-set dictionary has a unique character code. Encoding each character in the sample plot text using the pre-set dictionary essentially maps each character in the sample plot text to a character code in the pre-set dictionary. To further illustrate, the pre-set dictionary can be a dictionary based on one-hot encoding. The length of the character code corresponding to each Chinese character or letter in the pre-set dictionary is 1*Nword, where Nword is the total number of Chinese characters and letters in the pre-set dictionary.
[0070] In a specific application, when predicting a plot summary using the encoding vector corresponding to the sample plot text, the server can generate the plot summary through character-by-character prediction. Specifically, the server predicts the first character directly from the encoding vector of the sample plot text. For each character after the first character, the server combines the encoding vector of the sample plot text with the previously predicted character to obtain the characters in the current predicted plot summary. In this way, each prediction can incorporate the results of the previous prediction, enabling the generation of a predicted plot summary based on the context.
[0071] In a specific application, taking the predicted plot summary to be no more than N characters, and using the same character prediction network for each prediction, the network structure of the summary prediction network in the initial summary generation model in this embodiment can be as follows: Figure 3 As shown, it includes an encoding network, N word prediction networks, and a fully connected layer. The encoding networks encode the sample plot text to obtain the corresponding encoding vector. The first word prediction network, in conjunction with the fully connected layer, performs word prediction based on the encoding vector corresponding to the sample plot text, and outputs the prediction result of the first word in the predicted plot summary (e.g., ...). Figure 3 As shown, the predicted results are all represented by IDs (specifically, the prediction probability of the first character). Starting from the second character prediction network, it combines with fully connected layers to make predictions based on the encoding vector corresponding to the sample plot text and the prediction results obtained from the previous prediction, outputting the prediction result of the character at the corresponding position in the plot summary, specifically the prediction probability of the character at that position. Each character prediction network can output the probability that the character at the corresponding position in the plot summary belongs to each character in a preset dictionary.
[0072] The character prediction network can be configured according to the actual application scenario. For example, the character prediction network can be a Transformer model. In this embodiment, the network structure of the summary prediction network in the initial summary generation model is mainly a multi-layer Transformer model stacked structure. Furthermore, the Transformer model can be the DecoderLayer in the Transformer model, mainly including a normalization layer, an attention layer, and a multi-layer perceptron.
[0073] In a specific application, when using the encoded vector corresponding to the sample plot text to predict auxiliary information, in order to ensure that the prediction of auxiliary information assists the prediction of the plot summary, intermediate features output from the plot summary prediction part of the initial summary generation model can be used to predict the auxiliary information. For example, the features output by the first character prediction network in the summary prediction network of the initial summary generation model can be used to predict the auxiliary information. The initial summary generation model can then be as follows: Figure 4 As shown, the output of the first character prediction network is used as the input of the auxiliary information prediction network. The auxiliary information prediction network processes the output of the first character prediction network to obtain the predicted auxiliary information features.
[0074] In a specific application, the auxiliary information prediction network can obtain predicted auxiliary information features by classifying based on the output of the first character prediction network. The network structure of the auxiliary information prediction network can then be a pooling layer plus a fusion layer. Specifically, the output of the first character prediction network is first pooled using a pooling layer, and then the pooled features are fused using a fusion layer to obtain the predicted auxiliary information features. In this embodiment, the pooling method of the pooling layer is not limited; it can be average pooling, max pooling, etc.
[0075] In a specific application, when the network structure of the auxiliary information prediction network is a pooling layer plus a fusion layer, the initial summary generation model can be as follows: Figure 5 As shown, it includes a summary prediction network and an auxiliary information prediction network. The summary prediction network includes an encoding network, multiple word prediction networks, and a fully connected layer. The auxiliary information prediction network includes a pooling layer and a fusion layer (which can be a fully connected layer). The output of the first word prediction network is the input of the auxiliary information prediction network.
[0076] Step 206: Calculate the prediction loss based on the features of the sample plot summary, the predicted plot summary, the script auxiliary information, and the prediction auxiliary information to obtain the prediction loss value corresponding to the initial training sample.
[0077] The prediction loss value corresponding to the initial training samples refers to the sum of the errors between the predicted plot summary and the sample plot summary, as well as the errors between the script auxiliary information features and the prediction auxiliary information features corresponding to the script auxiliary information.
[0078] Specifically, after the initial summary generation model outputs the predicted plot summary and the predicted auxiliary information features, the server calculates the summary prediction loss value based on the sample plot summary and the predicted plot summary, and calculates the auxiliary information prediction loss value based on the script auxiliary information and the predicted auxiliary information features. Finally, based on the summary prediction loss value and the auxiliary information prediction loss value, the prediction loss value corresponding to the initial training sample is obtained.
[0079] Step 208: Adjust the parameters of the initial summary generation model according to the prediction loss values corresponding to each of the multiple initial training samples to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0080] Specifically, after obtaining the predicted loss values corresponding to multiple initial training samples, the server calculates the average of the predicted loss values corresponding to multiple initial training samples, sends the average value back to the initial summary generation model, calculates the parameter gradients of each parameter of the initial summary generation model, updates each parameter according to the parameter gradients, and obtains the trained initial summary generation model. Then, based on the trained initial summary generation model, the trained summary generation model is obtained. The trained summary generation model is used to output a plot summary based on the input plot text.
[0081] In practical applications, the server can use multiple initial training samples as the full dataset and conduct multiple rounds of iterative training to obtain the trained initial summary generation model. Each iteration processes the full dataset once until a stopping condition is met, at which point the iteration training ends, resulting in the trained summary generation model. The stopping condition can be configured according to the specific application scenario. For example, the stopping condition can be that the predicted loss value obtained in the current iteration converges, meaning the difference between the predicted loss value obtained in the previous iteration and the predicted loss value is less than a threshold. Specifically, the predicted loss value obtained in each iteration can be the average of the predicted loss values corresponding to the multiple initial training samples in that iteration.
[0082] In a specific application, during multi-round iterative training, the server can randomly select bs initial training samples from the full dataset, which includes N initial training samples, to form a batch of data each time, and process a total of M = N / bs batches. Each M batches completed represents the completion of one iteration. Here, bs and N are both positive integers, and bs is a positive integer less than or equal to N.
[0083] In practical applications, if the initial summary generation model is not further trained, the server can directly use the initial training model as the new summary generation model. However, in order to enable the initial training model to output more accurate plot summaries, the server will further enhance the initial training model to obtain the new summary generation model.
[0084] In a specific application, the server can acquire multiple reinforcement training samples and a summary generation reference model to reinforce the initially trained summary generation model, resulting in a trained summary generation model. The network structure of the summary generation reference model is similar to that of the initial summary generation model, except that it includes a classification task head. This classification task head provides the supervision information needed for reinforcement training. In other words, the supervision information used during reinforcement training differs from that used during initial training; it is no longer the sample plot summaries and script auxiliary information.
[0085] The aforementioned plot text processing method, based on obtaining multiple initial training samples for training the initial summary generation model, inputs the sample plot text from each initial training sample into the initial summary generation model to predict plot summaries and auxiliary information. This yields predicted plot summaries and auxiliary information features. The prediction loss is then calculated using these features, resulting in the prediction loss value corresponding to the initial training sample. The parameters of the initial summary generation model are adjusted based on the prediction loss values for each initial training sample, resulting in a trained summary generation model. Throughout this process, the cascading prediction of script auxiliary information during training allows the initial summary generation model to understand the correct information related to the summary from the script auxiliary information, supporting plot summary generation. This avoids misunderstandings of the plot text in the plot summary output, resulting in a summary generation model capable of outputting accurate plot summaries. Accurate plot summaries can be generated simply by inputting the plot text into the trained summary generation model.
[0086] In one embodiment, the prediction loss is calculated based on the features of the sample plot summary, the predicted plot summary, script auxiliary information, and prediction auxiliary information, resulting in the prediction loss value corresponding to the initial training sample, including:
[0087] Based on the sample plot summary and the predicted plot summary, calculate the summary prediction loss value, and based on the script auxiliary information and the features of the predicted auxiliary information, calculate the auxiliary information prediction loss value.
[0088] The summary prediction loss value and the auxiliary information prediction loss value are collected to obtain the prediction loss value corresponding to the initial training sample.
[0089] The summary prediction loss refers to the error between the sample plot summary and the predicted plot summary. The auxiliary information prediction loss refers to the error between the script auxiliary information features corresponding to the script auxiliary information and the predicted auxiliary information features.
[0090] Specifically, such as Figure 6 As shown, when calculating the prediction loss value, the server calculates the summary prediction loss value based on the sample plot summary and the predicted plot summary, encodes the script auxiliary information to obtain the script auxiliary information features, calculates the auxiliary information prediction loss value based on the script auxiliary information features and the predicted auxiliary information features, and finally aggregates the summary prediction loss value and the auxiliary information prediction loss value to obtain the prediction loss value corresponding to the initial training sample.
[0091] In practical applications, the predicted plot summary output by the initial summary generation model can be a predicted plot summary vector. When calculating the summary prediction loss value, the server will first encode the sample plot summary to obtain the encoding vector corresponding to the sample plot summary, and then determine the summary prediction loss value based on the encoding vector corresponding to the sample plot summary and the predicted plot summary vector.
[0092] In practical applications, the predictive auxiliary information features output by the initial summary generation model are actually in vector form, which can be understood as the representation of the predictive auxiliary information. Therefore, when calculating the prediction loss value of the auxiliary information, the server first encodes the script auxiliary information to obtain the script auxiliary information features, and then determines the prediction loss value of the auxiliary information by comparing the script auxiliary information features with the predictive auxiliary information features.
[0093] In practical applications, when collecting summary prediction loss values and auxiliary information prediction loss values, the server can directly sum the summary prediction loss values and auxiliary information prediction loss values to obtain the prediction loss value corresponding to the initial training sample. Alternatively, it can pre-set weighting coefficients for each of the summary prediction loss value and auxiliary information prediction loss value, and then sum the summary prediction loss value and auxiliary information prediction loss value according to the weighting coefficients to obtain the prediction loss value corresponding to the initial training sample. The weighting coefficients can be configured according to the actual application scenario.
[0094] Understandably, since plot summary prediction is the primary task and auxiliary information prediction is the secondary task, the weighting coefficient corresponding to the summary prediction loss value is usually much larger than the weighting coefficient corresponding to the auxiliary information prediction loss value. For example, we can set the weighting coefficient corresponding to the summary prediction loss value to 1 and the weighting coefficient corresponding to the auxiliary information prediction loss value to a (a positive number less than 1). Then, the prediction loss value Loss1 corresponding to the initial training sample is Loss_HH + a*Loss_HL, where Loss_HH represents the summary prediction loss value and Loss_HL represents the auxiliary information prediction loss value.
[0095] In this embodiment, by first calculating the summary prediction loss value based on the sample plot summary and the predicted plot summary, and then calculating the auxiliary information prediction loss value based on the script auxiliary information and the predicted auxiliary information features, the prediction loss value corresponding to the initial training sample can be determined by using the aggregated summary prediction loss value and the auxiliary information prediction loss value.
[0096] In one embodiment, calculating the summary prediction loss value based on the sample plot summary and the predicted plot summary includes:
[0097] Each character in the sample plot summary is encoded to obtain the character code corresponding to each character in the sample plot summary, and the prediction probability corresponding to each character in the predicted plot summary is determined.
[0098] For each character in the sample plot summary, the prediction loss value corresponding to the character is calculated based on the character code corresponding to the character and the prediction probability corresponding to the character in the same position in the plot summary.
[0099] The summary prediction loss value is obtained based on the prediction loss value corresponding to each word in the sample summary plot.
[0100] Specifically, when calculating the summary prediction loss, the server can first encode each character in the sample plot summary using a pre-defined dictionary, obtaining the character code for each character and determining the prediction probability for each character in the predicted plot summary. Then, for each character in the sample plot summary, based on its character code and the prediction probability of characters in the same position in the predicted plot summary, the server calculates the prediction loss value for that character. Finally, the summary prediction loss value is obtained based on the prediction loss values for each character in the sample plot summary. In a specific application, for each character in the sample plot summary, the server can determine whether characters in the same position in the predicted plot summary are the same as the target character based on its character code and the prediction probability of characters in the same position. This allows the server to determine the classification loss for the target character based on its prediction probability, and then combine this with the classification loss value for each character in the sample plot summary to obtain the summary prediction loss value. In a specific application, the server can use the average of the classification loss values for each character in the sample plot summary as the summary prediction loss value.
[0101] In a specific application, the summary prediction loss value in this embodiment can be the cross-entropy loss value, which is the classification loss value of each character in the predicted sample summary. It should be noted that the class probability here comes from each character in a preset dictionary, and each character can be considered as one class. Therefore, the formula for calculating the summary prediction loss value can be:
[0102] ;
[0103] in, This represents the character encoding for each character in the sample plot summary. The character encoding for each character in the sample plot summary is determined based on its position in a preset dictionary. Specifically, it can be a one-hot encoding label. When the character is a character in the preset dictionary, the label at the position corresponding to that character in the character encoding is 1, and the label at other positions is 0. This represents the prediction probability corresponding to each word in the plot summary, i.e., in the context of... Given the actual probability distribution of the plot summary, the predicted probability distribution of the predicted summary is obtained by comparison. To determine the summary prediction loss value.
[0104] In this embodiment, by first encoding each character in the sample plot summary to obtain the character code corresponding to each character in the sample plot summary, and determining the prediction probability corresponding to each character in the predicted plot summary, the prediction loss value corresponding to each character in the sample plot summary can be calculated using the character code. Then, the prediction loss value corresponding to each character in the sample plot summary can be used to determine the prediction loss value of the summary.
[0105] In one embodiment, calculating the prediction loss value of the auxiliary information based on the features of the script auxiliary information and the prediction auxiliary information includes:
[0106] The script auxiliary information is encoded to obtain the script auxiliary information features corresponding to the script auxiliary information;
[0107] Calculate the similarity loss value between script auxiliary information features and prediction auxiliary information features, and use the similarity loss value as the prediction loss value for auxiliary information.
[0108] The similarity loss value is used to measure the similarity between script auxiliary information features and prediction auxiliary information features. It can be understood that the more similar the script auxiliary information features and prediction auxiliary information features are, the smaller the similarity loss value is, while the greater the difference between the script auxiliary information features and prediction auxiliary information features, the greater the similarity loss value is.
[0109] Specifically, when calculating the prediction loss value for auxiliary information, the server first encodes the script auxiliary information to obtain the corresponding script auxiliary information features. Then, it calculates the similarity loss value between the script auxiliary information features and the predicted auxiliary information features, and uses this similarity loss value as the prediction loss value for auxiliary information. It can be understood that since the script auxiliary information features represent script auxiliary information, and the predicted auxiliary information features represent predicted auxiliary information, the similarity between the script auxiliary information features and the predicted auxiliary information features can be compared to determine their similarity. Improving the similarity between the predicted auxiliary information and the script auxiliary information through loss calculation allows the initial summary generation model output to contain more such script auxiliary information, which is beneficial for achieving accurate plot summary prediction.
[0110] In practical applications, the loss calculation formula used in this embodiment when calculating the similarity loss value can be configured according to the actual application scenario, as long as the similarity loss calculation can be achieved. For example, the similarity loss in this embodiment can specifically be the contrastive loss, which measures the similarity between script auxiliary information features and prediction auxiliary information features. In this embodiment, the input of the contrastive loss is a sample pair composed of script auxiliary information features and prediction auxiliary information features, and the label is whether the sample pair belongs to the same class, that is, whether the prediction auxiliary information represented by the script auxiliary information and prediction auxiliary information features is the same.
[0111] In a specific application, the formula for calculating the similarity loss value can be:
[0112] ;
[0113] in, It is a function The abbreviation indicates input The mapped vector, in this embodiment, is the script auxiliary information feature. This refers to input The mapped vector, i.e., the predicted auxiliary information features, in this embodiment, and All represent sample plot text, 1{·} is an indicator function that returns 1 when the input is true, otherwise returns 0. That is, it returns 1 when the prediction auxiliary information represented by the script auxiliary information and the prediction auxiliary information features are the same, otherwise returns 0. m is a pre-set hyperparameter that can be configured according to the actual application scenario, indicating that the distance between samples of different classes should exceed this value.
[0114] In this embodiment, by encoding the script auxiliary information, the script auxiliary information features corresponding to the script auxiliary information are obtained. The script auxiliary information features and the prediction auxiliary information features can be used to calculate the similarity loss value between the two features. Then, the similarity loss value can be used to determine the prediction loss value of the auxiliary information.
[0115] In one embodiment, script auxiliary information is the relationship between characters; the relationship between characters is obtained through the following methods:
[0116] The frequency of appearance of plot characters in the sample plot text was statistically analyzed to determine multiple plot characters and their individual frequency of appearance.
[0117] Based on the frequency of appearance of each of the multiple plot characters, select at least two key characters from the multiple plot characters;
[0118] Based on the sample plot text, determine the key character relationships between any two of the at least two key characters;
[0119] Determine the plot character relationships in the sample plot text based on the key character relationships between any two of the at least two key characters.
[0120] In this context, "plot characters" refers to characters appearing in the sample plot text, and "appearance frequency" refers to the number of times a plot character appears repeatedly in the sample plot text. "Key characters" refers to characters who play a crucial role in driving the plot forward among multiple plot characters. For example, key characters could specifically refer to the N characters with the highest appearance frequency in the sample plot text. The value of N can be configured according to the actual application scenario, specifically a positive integer greater than or equal to 2. "Key character relationships" refers to the relationship between two key characters. Specifically, it can be one of the preset character relationships.
[0121] Specifically, the server counts the frequency of appearances of characters in the sample plot text to identify multiple characters and their individual frequency. Based on this, the server selects the N characters with the highest frequency from the multiple characters, designating them as at least two key characters. Here, N is a positive integer greater than or equal to 2. Having identified at least two key characters, the server can then determine the key relationship between any two of these key characters based on the sample plot text. Furthermore, based on this key relationship, the server can determine the relationships between characters describing the content of the sample plot text.
[0122] In this embodiment, by statistically analyzing the frequency of appearances of characters in the sample plot text, multiple characters and their respective appearance frequencies are determined. By utilizing the appearance frequencies of these multiple characters, at least two key characters can be selected from among them. Furthermore, by determining the key character relationships between any two of these at least two key characters, the relationships between the characters in the plot text describing the content can be accurately determined.
[0123] In one embodiment, determining the key character relationship between any two of the at least two key characters based on sample plot text includes:
[0124] By grouping each pair of at least two key figures together, multiple key figure pairs are obtained.
[0125] For each key character pair, the relationship between the two key characters in the key character pair is predicted based on the sample plot text, thus obtaining the key character relationship between the two key characters in the key character pair.
[0126] Specifically, when determining the relationships between key characters, the server will group at least two key characters into two pairs, resulting in multiple key character pairs. For each key character pair, the server will predict the relationship between the two key characters in the pair based on the sample plot text, in order to obtain the key character relationship between the two key characters in the pair.
[0127] In practical applications, the server can utilize a pre-trained natural language model to extract key character relationships. This involves asking the pre-trained natural language model questions based on sample plot text to determine the key character relationship between two key characters in a pair. For example, taking key characters A and B as the two characters whose relationship needs to be determined, the question could be: "The following is the plot text of a scene from a play. Based on the plot text, answer what the relationship is between character A and character B. The relationships include Relationship 1, Relationship 2, Relationship 3, Relationship 4, and Relationship 'Cannot be deduced,' only answering relationships that are certain. When the relationship is unclear, answer 'Cannot be deduced.' The plot text is: XXX." Here, XXX represents the specific sample plot text, and Relationship 1, Relationship 2, Relationship 3, and Relationship 4 are preset relationships that can be configured according to the actual application scenario.
[0128] In a specific application, if a pre-trained natural language model outputs multiple relations for a key person pair, indicating that there may be multiple relations between the two key persons in the pair, the server needs to determine the final key person relation based on these multiple relations. Specifically, the server can select the most frequent relation from the multiple relations as the final key person relation. For example, if the two key persons could simultaneously be "pursuer," "admirer," "lover," or "lover," then the most frequent relation "lover" can be selected as the final key person relation.
[0129] In this embodiment, by grouping each pair of key characters into multiple key character pairs, the relationship between the two key characters in each key character pair is predicted using sample plot text for each key character pair, thereby enabling accurate determination of the key character relationship between the two key characters in the key character pair.
[0130] In one embodiment, determining the plot character relationships in the sample plot text based on the key character relationships between any two of the at least two key characters includes:
[0131] When there are at least two key characters, the key character relationship between the two key characters is used as the plot character relationship in the description sample plot text.
[0132] Specifically, when there are at least two key characters, the server can directly use the key character relationship between the two key characters as the plot character relationship in the sample plot text. In this way, the plot character relationship can be quickly determined.
[0133] In one embodiment, determining the plot character relationships in the sample plot text based on the key character relationships between any two of the at least two key characters includes:
[0134] When the number of at least two key figures is greater than two, determine the two key figures with the highest appearance frequency according to the appearance frequency of each of the at least two key figures.
[0135] The key relationship between the two most frequently appearing key characters is used as the plot character relationship in the sample plot text.
[0136] Specifically, when the number of at least two key characters is greater than two, the server needs to determine the two key characters with the highest appearance frequency according to the appearance frequency of each of the at least two key characters, so that the key character relationship of the two key characters with the highest appearance frequency can be used as the plot character relationship in the description sample plot text.
[0137] It is understandable that when there are more than two key characters, there will be key character relationships between each pair of key characters. By using the frequency of appearance of at least two key characters to filter key character relationships, it is possible to accurately represent the relationships between characters in the plot by identifying the key character who is most capable of driving the plot forward.
[0138] In one embodiment, the parameters of the initial summarization generation model are adjusted based on the predicted loss values corresponding to each of the multiple initial training samples to obtain the trained summarization generation model, including:
[0139] Based on the predicted loss values corresponding to each of the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained initial summary generation model.
[0140] Obtain a summary generation reference model; the summary generation reference model includes the network structure of the classification task head and the initial summary generation model, and is trained using multiple initial training samples;
[0141] Multiple reinforcement training samples are obtained. For each reinforcement training sample, the initial summary generation model and the summary generation reference model are trained using the sample plot text, the selected plot summary and the unselected plot summary corresponding to the sample plot text, and the script auxiliary information describing the content of the sample plot text. The reinforcement training loss value corresponding to the reinforcement training sample is obtained.
[0142] Based on the reinforcement training loss values corresponding to each of the multiple reinforcement training samples, the parameters of the initial summary generation model after training are adjusted to obtain the trained summary generation model.
[0143] The classification task head refers to the processing layer used to perform the classification task. It can be understood that the classification task head analyzes the input features and outputs a classification result. In this embodiment, the classification result refers to the predictive auxiliary information output by the summary generation reference model. The selected plot summary is a summary that accurately summarizes the sample plot text, while the unselected plot summary is a summary that cannot summarize the sample plot text. It can be understood that the selected plot summary provides a better summary of the sample plot text than the unselected plot summary.
[0144] Specifically, the server adjusts the parameters of the initial summarization generation model based on the predicted loss values corresponding to multiple initial training samples, resulting in a trained initial summarization generation model. Building upon this, the server can obtain a summary generation reference model and multiple reinforcement training samples to further enhance the trained initial summarization generation model, resulting in a trained summary generation model. The summary generation reference model includes the classification task head and the network structure of the initial summary generation model, and is trained using multiple initial training samples. The reinforcement training samples include sample plot text, selected and unselected plot summaries corresponding to the sample plot text, and script auxiliary information describing the content of the sample plot text.
[0145] Specifically, based on the obtained summary generation reference model and multiple reinforcement training samples, for each reinforcement training sample, the server uses the sample plot text, the selected and unselected plot summaries corresponding to the sample plot text, and script auxiliary information describing the content of the sample plot text to train the initial summary generation model and the summary generation reference model respectively. Based on the prediction results output by the initial summary generation model and the prediction results output by the summary generation reference model, the reinforcement training loss value corresponding to the reinforcement training sample is calculated. Then, based on the reinforcement training loss values corresponding to each of the multiple reinforcement training samples, the parameters of the initial summary generation model are adjusted to obtain the trained summary generation model.
[0146] By comparing the prediction results output by the two models, the summarization performance of the initial summarization model after training can be evaluated, and a reinforcement training loss value can be obtained to assess the summarization performance. The reinforcement training loss value can then be used to adjust the parameters of the initial summarization model after training to optimize its summarization performance, thus obtaining the trained summarization model.
[0147] In practical applications, the main difference between the summary generation reference model and the initial summary generation model is that the reference model has an additional classification task head. In the reference model, this classification task head is used in the auxiliary information prediction network. That is, the output of the auxiliary information prediction network of the reference model is no longer predicting auxiliary information features, but predicting auxiliary information. Therefore, when training the reference model, for each initial training sample, the server first outputs the sample plot text from the initial training sample to the initial summary generation reference model for plot summary prediction and auxiliary information prediction, obtaining the predicted plot summary and predicted auxiliary information. Then, based on the sample plot summary, the predicted plot summary, the script auxiliary information, and the predicted auxiliary information, the prediction loss is calculated to obtain the prediction loss value corresponding to the initial training sample. Based on the prediction loss values corresponding to multiple initial training samples, the parameters of the initial summary generation reference model are adjusted to obtain the summary generation reference model.
[0148] In a specific application, the network structure of the auxiliary information prediction network in the initial summary generation reference model can be as follows: Figure 7 As shown, this includes a pooling layer, a fusion layer, and a classification task head. The input to the classification task head is the output of the fusion layer, namely the prediction auxiliary information features. The classification task head performs classification based on the prediction auxiliary information features to obtain prediction auxiliary information. Then, by comparing the script auxiliary information and the prediction auxiliary information, the auxiliary information prediction loss value in the prediction loss value can be calculated. The calculation of the summary prediction loss value is the same as when training the initial summary generation model, and will not be described again in this embodiment.
[0149] Specifically, after obtaining the reinforcement training loss values corresponding to each of the multiple reinforcement training samples, the server will send the reinforcement training loss values corresponding to each of the multiple reinforcement training samples back to the trained initial summary generation model, calculate the parameter gradients of each parameter of the trained initial summary generation model, and then update each parameter according to the parameter gradients to obtain the trained summary generation model. The trained summary generation model is used to output a plot summary based on the input plot text.
[0150] It is understood that in this embodiment, the initial summary generation model after training is evaluated by simultaneously using the selected plot summary, the unselected plot summary, and the summary generation reference model to perform reinforcement learning. This allows for the evaluation of the summary generation effect, rather than relying solely on a single sample plot summary as a label for model training. This approach effectively reduces the problem of poor language generalization ability of the trained model caused by a single label.
[0151] In one embodiment, for each reinforcement training sample, the initial summary generation model and the summary generation reference model are trained using the sample plot text, the selected and unselected plot summaries corresponding to the sample plot text, and script auxiliary information describing the content of the sample plot text. The reinforcement training loss value corresponding to the reinforcement training sample includes:
[0152] For each enhanced training sample, the sample plot text in the enhanced training sample is input into the trained initial summary generation model, and the first probability of the trained initial summary generation model outputting a selected plot summary, the second probability of outputting a non-selected plot summary, and the third probability of outputting script auxiliary information are determined.
[0153] Input the sample plot text from the enhanced training samples into the summary generation reference model, and determine the fourth probability of the summary generation reference model outputting the selected plot summary, the fifth probability of outputting the unselected plot summary, and the sixth probability of outputting script auxiliary information.
[0154] Based on the first probability, the second probability, the fourth probability, and the fifth probability, the output summary comparison loss value is determined, and based on the third probability and the sixth probability, the output auxiliary information comparison loss value is determined.
[0155] By comparing the loss value with the output summary and the loss value with the output auxiliary information, the reinforcement training loss value corresponding to the reinforcement training sample is obtained.
[0156] Specifically, for each reinforcement training sample, the server inputs the sample plot text from the reinforcement training sample into the trained initial summary generation model. This model then uses the trained initial summary generation model to predict plot summaries and auxiliary information. Based on the prediction results, the server calculates the first probability that the trained initial summary generation model will output a selected plot summary, the second probability that it will output an unselected plot summary, and the third probability that it will output script auxiliary information. Simultaneously, the server inputs the sample plot text from the reinforcement training sample into the summary generation reference model. This model then uses the summary generation reference model to predict plot summaries and auxiliary information. Based on the prediction results, the server calculates the fourth probability that the summary generation reference model will output a selected plot summary, the fifth probability that it will output an unselected plot summary, and the sixth probability that it will output script auxiliary information.
[0157] Specifically, based on the above probabilities, the server can calculate the output summary comparison loss value based on the first, second, fourth, and fifth probabilities related to the predicted plot summary, and determine the output auxiliary information comparison loss value using the third and sixth probabilities related to the predicted auxiliary information. Then, by aggregating the output summary comparison loss value and the output auxiliary information comparison loss value, the reinforcement training loss value corresponding to the reinforcement training sample is obtained.
[0158] In practical applications, the first probability of outputting the selected plot summary can be obtained from the selected plot summary and the predicted plot summary in the prediction results, and the second probability of outputting the unselected plot summary can be obtained from the unselected plot summary and the predicted plot summary in the prediction results.
[0159] In practical applications, when collecting the output summary comparison loss value and the output auxiliary information comparison loss value, the server can directly sum the output summary comparison loss value and the output auxiliary information comparison loss value to obtain the reinforcement training loss value corresponding to the reinforcement training sample. Alternatively, it can pre-set the weighting coefficients for each of the output summary comparison loss value and the output auxiliary information comparison loss value, and then sum them according to the weighting coefficients to obtain the reinforcement training loss value corresponding to the reinforcement training sample. The weighting coefficients can be configured according to the actual application scenario.
[0160] For example, the weighting coefficients for the output summary comparison loss (Loss_RL_HH) and the output auxiliary information comparison loss (Loss_RL_HL) can be set as b1 and b2, respectively. Then, the reinforcement training loss value Loss2 for the reinforcement training sample is = b1*Loss_RL_HH + b2*Loss_RL_HL, where b1 and b2 can be configured according to the actual application scenario and are positive numbers less than 1. For example, b1 can be 0.1 and b2 can be 0.2.
[0161] In this embodiment, by inputting the sample plot text from the reinforcement training samples into the trained initial summary generation model and the summary generation reference model, the reinforcement training loss value corresponding to the reinforcement training sample can be accurately calculated based on multiple probabilities determined by the prediction results. Then, the reinforcement training loss value can be used to adjust the trained initial summary generation model to obtain the trained summary generation model.
[0162] In one embodiment, determining the output summary comparison loss value based on a first probability, a second probability, a fourth probability, and a fifth probability includes:
[0163] Based on the first probability and the fourth probability, determine the ratio of the first output probability of the initial summary generation model and the summary generation reference model after training to the first output probability of the selected plot summary.
[0164] Based on the second and fifth probabilities, determine the ratio of the second output probability of the initial summary generation model and the summary generation reference model outputting a plot summary that was not selected;
[0165] The output summary comparison loss value is calculated based on the first output probability ratio and the second output probability ratio.
[0166] Specifically, when determining the output summary comparison loss value, the server determines the first output probability ratio between the initial summary generation model and the summary generation reference model that outputs selected plot summaries based on the first and fourth probabilities. It then determines the second output probability ratio between the initial summary generation model and the summary generation reference model that outputs unselected plot summaries based on the second and fifth probabilities. Finally, based on the first and second output probability ratios and a preset first objective function, the output summary comparison loss value is calculated. The preset first objective function can be configured to maximize the first output probability ratio and minimize the second output probability ratio, depending on the specific application scenario.
[0167] In practical applications, the first objective function can be preset to be DPO (Direct Preference Optimization) loss, and the formula for calculating the output summary comparison loss value can be:
[0168] ;
[0169] in, This indicates the reference model for abstract generation. This represents the initial summary generation model after training, where x represents the sample plot text. This indicates that a plot summary has been selected. This indicates that the plot summary was not selected. Indicates the first probability. Indicates the second probability. Indicates the fourth probability. The fifth probability, and These are the preset hyperparameters.
[0170] In this embodiment, by first comparing the probability of the selected plot summary output by the initial summary generation model and the summary generation reference model after training, and then comparing the probability of the unselected plot summary output by the initial summary generation model and the summary generation reference model after training, the comparison loss value of the output summary can be calculated by combining the first output probability ratio and the second output probability ratio obtained from the two comparisons.
[0171] In one embodiment, determining the output auxiliary information comparison loss value based on the third probability and the sixth probability includes:
[0172] Based on the third and sixth probabilities, the initial summary generation model and the summary generation reference model after training are determined. The third output probability ratio is the ratio of outputting script auxiliary information while outputting the selected plot summary, and the fourth output probability ratio is the ratio of outputting script auxiliary information while outputting the unselected plot summary.
[0173] The output auxiliary information comparison loss value is calculated based on the third output probability ratio and the fourth output probability ratio.
[0174] Specifically, the third probability includes the probability that the trained initial summary generation model outputs script auxiliary information while simultaneously outputting a selected plot summary, and the probability that it outputs script auxiliary information while simultaneously outputting a plot summary that was not selected. The sixth probability includes the probability that the summary generation reference model outputs script auxiliary information while simultaneously outputting a selected plot summary, and the probability that it outputs script auxiliary information while simultaneously outputting a plot summary that was not selected. Therefore, when determining the output auxiliary information comparison loss value, based on the third and sixth probabilities, the server can determine the third output probability ratio of the trained initial summary generation model and the summary generation reference model when outputting script auxiliary information while simultaneously outputting a selected plot summary, and the fourth output probability ratio when outputting script auxiliary information while simultaneously outputting a plot summary that was not selected. Then, based on the third output probability ratio, the fourth output probability ratio, and a preset second objective function, the output auxiliary information comparison loss value is calculated. The preset second objective function can be configured according to the actual application scenario, aiming to maximize the third output probability ratio and minimize the fourth output probability ratio.
[0175] In practical applications, the probability of outputting script support information along with the selected plot summary can be obtained from the probability of outputting the selected plot summary, the script support information, and the prediction support information in the prediction result. Similarly, the probability of outputting script support information along with the unselected plot summary can be obtained from the probability of outputting the unselected plot summary, the script support information, and the prediction support information in the prediction result.
[0176] In practical applications, the first objective function can be preset to be DPO loss, and the formula for calculating the comparison loss value of output auxiliary information can be:
[0177] ;
[0178] in, This indicates the reference model for abstract generation. This represents the initial summary generation model after training, where x represents the sample plot text. This means that while outputting the selected plot summary, script support information will also be output. This means that while outputting the plot summary that was not selected, script support information will also be output. This represents the probability that the output of the initial summary generation model after training will be selected to output script auxiliary information along with the plot summary. This represents the probability that the initial summary generation model, after training, outputs script auxiliary information while not selecting a plot summary. This indicates the probability that the summary generation reference model outputs a selected plot summary along with script auxiliary information. This indicates the probability that the summary generation reference model outputs script auxiliary information while simultaneously outputting a plot summary that was not selected. and These are the preset hyperparameters.
[0179] In this embodiment, by first comparing the probability of the initial summary generation model and the summary generation reference model outputting script auxiliary information while selecting the plot summary, and then comparing the probability of the initial summary generation model and the summary generation reference model outputting script auxiliary information while not selecting the plot summary, the comparison loss value of the output auxiliary information can be calculated by combining the third output probability ratio and the fourth output probability ratio obtained from the two comparisons.
[0180] In one embodiment, the plot text processing method further includes:
[0181] Get the plot text to be processed;
[0182] The plot text to be processed is input into the trained summary generation model to obtain the corresponding plot summary of the plot text to be processed.
[0183] Specifically, once the trained summary generation model is available, when the plot text needs to be processed, the server obtains the plot text to be processed, inputs the plot text to be processed into the trained summary generation model, and then obtains the corresponding plot summary of the plot text to be processed.
[0184] In this embodiment, since a summary generation model capable of outputting accurate plot summaries has been trained, an accurate plot summary can be generated by inputting the plot text into the trained summary generation model.
[0185] In one embodiment, the plot text processing method of this application is applied to the plot understanding of film and television scripts as an example to illustrate the plot text processing method of this application.
[0186] The inventors believe that plot understanding of film and television scripts is a crucial step in intelligent script understanding. Since each script can contain thousands to tens of thousands of scenes, with each scene ranging from tens to thousands of words, manual reading is inefficient and poses difficulties for script review. However, using artificial intelligence to automatically and quickly understand the plot of each scene helps film and television reviewers quickly comprehend the story and evaluate the script's value for filming. It also allows production teams to understand the plot in advance, grasp the scene progression, and better perform each scene. Traditional methods for automated script plot understanding using artificial intelligence employ text summarization models to automatically extract plot summaries from each scene of the script. However, because the actual plot summaries and model-predicted summaries for a given text vary greatly, conventional data annotation, which only labels one summary per text, cannot cover all possible output summaries (in fact, it's impossible to label all possible summaries of a text). The model cannot evaluate whether a slightly modified summary output is a positive result. Furthermore, learning from a single labeled summary makes it difficult to evaluate the dynamic changes in summary generation (such as whether the current summary is better than the previous one), thus affecting the summary generation model's generalization ability to language variations.
[0187] To address the aforementioned problems in summary generation, this application proposes a narrative text processing method. By learning script auxiliary information in conjunction with the summary narrative prediction task, it ensures that the final output can have a wide variety of wording. At the same time, it evaluates and optimizes the model output by comparing the performance of the summary generation reference model with the current model performance.
[0188] Understandably, the highlights of the narrative text processing method in this application are: First, by cascading low-level basic information (i.e., script auxiliary information) into the summary generation model, the model can understand the correct information related to the summary from the text and support the generation of high-level summary text (i.e., narrative summary), avoiding misunderstandings of the narrative text due to language changes in the summary output; Second, by using reinforcement learning to evaluate the summary generation effect through comparison between the newly generated summary and the reference summary, the quality of the summary is evaluated, rather than relying on a single summary annotation text. This reduces the problem of poor language generalization ability of the model caused by a single summary annotation. That is, by simultaneously using the selected narrative summary, the unselected narrative summary, and the summary generation reference model to perform reinforcement learning on the trained initial summary generation model, the summary generation effect of the trained initial summary generation model is evaluated, thereby evaluating the quality of the summary, rather than relying solely on a single sample narrative summary as an annotation for model training. This effectively reduces the problem of poor language generalization ability of the trained model caused by a single annotation.
[0189] It is understood that the trained summary generation model generated in the narrative text processing method of this application can be applied to at least the following scenarios:
[0190] First, the script overview: The trained summary generation model can generate a concise overview of the script, helping readers quickly understand the main content and plot. For example, given the input script text, it is first segmented into multiple scene texts. Then, the scene text of each scene is input into the trained summary generation model to produce the scene's plot comprehension results. Input the script, return the plot of each scene, and submit it to relevant personnel for review.
[0191] 2. Content Planning: In the planning stage of film, television series or other media projects, the trained summary generation model can help planners quickly understand the main content of a large number of scripts, thereby making effective screening and decisions.
[0192] 3. Script editing: For script editors or screenwriters, the trained summary generation model can help them quickly understand the main content of the script, thereby making effective modifications and improvements.
[0193] In one embodiment, the cascaded hierarchical information learning process of the narrative text processing method of this application during model training is first described, such as... Figure 8 As shown, the two levels of information are output hierarchically through the model, namely HL (lower-level information) (e.g.) Figure 8 The image shows the predictive auxiliary information features output by the initial summary generation model and HH (high-level information) (such as...). Figure 8 The image shows the predicted plot summary output by the initial summary generation model. Learning is performed at each level separately. For the low-level HL (predictive auxiliary information features used to predict the output from the initial training samples) and the high-level HH (predicted plot summary used to predict the output from the initial training samples), HL task loss (calculating the auxiliary information prediction loss value), HH task loss (calculating the summary prediction loss value), and reinforcement learning RL loss (e.g., ...) are applied respectively. Figure 8 As shown, learning is performed using both RL_HH task loss and RL_HL task loss (reinforcement training loss values). Among them, as... Figure 8 As shown, the summary generation reference model is based on the predicted plot summary and prediction auxiliary information features output by the reinforcement training samples. These features are used as supervision information input during the reinforcement training phase. Correspondingly, the sample plot summary and script auxiliary information are used as supervision information input during the initial training phase.
[0194] In one embodiment, the hierarchical reinforcement learning information joint model process structure of the narrative text processing method of this application during model training is further described. For example... Figure 9As shown, the left side represents the initial summary generation model, which includes a summary prediction network and an auxiliary information prediction network. The summary prediction network comprises an encoding layer, multiple word prediction networks, and a fully connected layer. Specifically, the word prediction network can be a Decoder Layer (e.g., ...). Figure 9 As shown, using a 32-word prediction network as an example (for illustration), as... Figure 9 As shown, the output of the fully connected layer is a prediction of token ids (unique identifiers corresponding to each word in the predefined dictionary) (e.g., Figure 9 The example shown is the token ID (i.e., word prediction). For a pre-defined dictionary with 64,000 words, the token IDs predicted by the fully connected layer are vectors of size 1x64,000, where each vector element represents the probability that the encoding of each word in the token IDs is 1. The DecoderLayer mainly includes a normalization layer, an attention layer, and a multilayer perceptron. For example, its main structure can be illustrated in Table 1.
[0195] Table 1
[0196]
[0197] It should be noted that, as Figure 9 As shown, to generate low-level auxiliary information before the fully connected layer predicts the predicted plot summary, an auxiliary information prediction network is introduced at the output of the first word prediction network. This auxiliary information prediction network includes a pooling layer and a fusion layer (which can be a fully connected layer). The fusion layer outputs predicted auxiliary information features. The pooling layer can use average pooling for pooling.
[0198] The following is combined with Figure 9 The calculation of loss values involved in several places in this application is explained.
[0199] like Figure 9As shown, encoder1 (encoding vector 1) is the supervision information for calculating the loss of HH. Here, encoder1 is obtained by encoding the sample plot summary, which serves as supervision information in the initial training samples. That is, encoder1 is the encoding vector corresponding to the sample plot summary. It can be understood that the encoding involved in this application is all done on a character-by-character basis, that is, the resulting text words are mapped to pre-defined dictionary token ids. The encoding vector corresponding to the sample plot summary is actually the character encoding corresponding to each character in the sample plot summary. This character encoding can be a one-hot encoding value, where the vector length is 1xNword, and Nword is the length of the vocabulary in the pre-defined dictionary, such as 64000 in the example above. When calculating the loss, the token id predicted for each character position (a numerical identifier used in character encoding to represent a specific position (positional information)) is used as the one-hot encoding value of the corresponding position in the supervision information to calculate the loss.
[0200] That is, for each character in the sample plot summary, we first need to calculate the prediction loss value corresponding to the character based on its character encoding and the prediction probability of characters in the same position in the plot summary. Then, based on the prediction loss value corresponding to each character in the sample plot summary, we obtain the summary prediction loss value. Figure 9 Loss HH in the middle.
[0201] like Figure 9 As shown, encoder2 (encoding vector 2) is the supervision information for calculating the loss of HH. Here, encoder2 is obtained by encoding the script auxiliary information, which serves as supervision information, in the initial training samples. That is, encoder2 is actually the script auxiliary information feature. The specific encoding method can be as follows: first, each character in the script auxiliary information is encoded to obtain the fourth character encoding vector corresponding to each character in the script auxiliary information; then, pooling is performed on the fourth character encoding vector corresponding to each character to obtain the script auxiliary information feature. In this embodiment, the pooling calculation here can be max pooling.
[0202] It is understandable that this application actually involves two training phases: first, an initial training phase to train the initial summarization model, resulting in a trained initial summarization model; and second, a reinforcement training phase to train the trained initial summarization model, resulting in a trained summarization model. In the reinforcement training phase, a summarization reference model is needed to train the trained initial summarization model. For example... Figure 9 As shown, the network structure of the summary generation reference model is similar to that of the initial summary generation model, except that it has one more classification task head (it should be noted that...). Figure 9 The exact same network structure parts are not fully shown, such as Figure 10As shown, this classification task head is placed after the fusion layer in the auxiliary information prediction network of the summary generation reference model. It is used to supervise the pooling layer and the fusion layer, enabling them to generate the necessary predictive auxiliary information features as reinforcement learning supervision information during the reinforcement training phase. It is understandable that, as... Figure 10 As shown, since fully connected layers can be used for classification tasks, the classification task header can specifically be a fully connected layer. Furthermore, as... Figure 10 As shown, during the initial training phase, the classification task loss is calculated based on script auxiliary information and the prediction auxiliary information obtained from classification, and the auxiliary information prediction loss value is obtained to update the parameters of the summary generation reference model.
[0203] It should be noted that the summary generation reference model is also trained using multiple initial training samples. During the reinforcement training phase, the parameters of the summary generation reference model are not adjusted. Instead, the reinforcement training loss value corresponding to the reinforcement training sample is calculated based on the output of the summary generation reference model to update the parameters of the initial summary generation model after training, so as to obtain the trained summary generation model.
[0204] In one embodiment, combined Figure 8 , Figure 9 and Figure 10 The principles involved in the model training process of the narrative text processing method of this application are explained.
[0205] in, Figure 8 In reality, it is a hierarchical model for summarizing, with layers including HL (Hierarchy Low) and HH (Hierarchy High). The model outputs hierarchically—first, it outputs low-level information, and then it outputs high-level information. Both types of information are related to the final summarizing task, with the summarizing information being the high-level information HH. The low-level information HL contains script-related auxiliary information related to text understanding (such as event type, character relationships, and relevant scenes of the event). By capturing text content at the bottom layer of the model, it ensures that the model obtains the correct information, thereby indirectly improving the accuracy of the implicit information in the summary.
[0206] This application takes the extraction of plot summaries from narrative text as an example. Low-level information, such as character relationships, is used as the input. The input is typically in dialogue form, and the task of summarizing is to outline the main idea of the dialogue. Considering that the emphasis of the summary output will differ depending on the low-level understanding—for example, the model's understanding of the text and the way it generates summaries will differ depending on the character relationships—a flirtatious dialogue between lovers versus an educational dialogue between a mother and child—dialogues with different character identities will produce plot summaries with different emphases. For instance, a dialogue between lovers emphasizes the emotional relationship rather than flirtatious banter, while a dialogue between a mother and child emphasizes the educational theme. Therefore, this application improves the summarization effect by using a low-level capability (character relationship prediction) to guide the output of the summary.
[0207] in, Figure 9 For the hierarchical information joint model learning process in this application, before the model outputs a summary, the output word representations are aggregated to predict low-level tasks (HL). HL should contain the low-level information required for the target summary (i.e., plot and character relationships), so that the final high-level summary contains sufficient and consistent low-level information. For each hierarchical task, reinforcement learning is performed. Here, the DPO (Direct Preference Optimization) reinforcement learning method is used to compare the pre- and post-task performance of HL and HH tasks.
[0208] in, Figure 10 The reference model for summarization is trained to generate low-level supervised information through an additional module for low-level task learning.
[0209] In one embodiment, the character relationships in this application can be extracted using a pre-trained natural language model. It is understood that each scene in a film or television drama contains interactions (including dialogues) between specific characters, and different character relationships result in different dialogue tones. Understanding these character relationships is helpful for plot comprehension; therefore, it is necessary to extract the main character relationship information from the plot text of each scene. The following uses the GPT model as an example of a pre-trained natural language model to illustrate the specific extraction method, which can be as follows:
[0210] 1. For each scene in the script (i.e., the plot text), count the frequency of appearance of the characters appearing in that scene (the "person" label in the scene lists the characters included in that scene), and retain the top k characters with the highest appearance frequency (e.g., 2);
[0211] 2. For the retained list of characters, select a pair of characters and ask GPT questions about their relationships to generate model character relationships. The question format is: "Based on the following scenario, answer what relationship a is to b, where relationships include boyfriend, girlfriend, son, daughter, father, mother, colleague, classmate, and relationships that cannot be deduced. Only answer relationships that are certain, and answer relationships that cannot be deduced when the relationship is unclear. The scenario is: xxx." In this way, 0 to n character relationships are generated for each scenario (0 relationships if there are no top-k characters or no characters in the scenario; multiple relationships occur if there are multiple top-k characters).
[0212] For example, for the first three people A, B, and C, the characters are taken as follows: (B, A) (C, A), (C, B). That is, we ask who the person with less screen time is compared to the person with more screen time. If A is the main character, it is equivalent to asking who B is compared to the main character A, thus finding the relationship between the key characters.
[0213] 3. Collect the above results as character relationship data.
[0214] 4. Based on the GPT results above, multiple relationships are generated, among which two individuals may have multiple relationships. A final relationship is then determined based on these multiple relationships between the two individuals. The most frequent relationship is selected as the final relationship from the multiple relationships. For example, if two individuals could simultaneously be "pursuers," "admirers," "lovers," or "lovers," then they are ultimately confirmed as lovers.
[0215] 5. Select the two most important characters in the scene—the two who appear most frequently—and retain their relationship as the final character relationship for the scene. (This step can be omitted; in this case, topk=2 is required).
[0216] In one embodiment, the sample plot summary can also be extracted using a pre-trained natural language model. Specifically, a pre-trained natural language model (such as GPT4) can be used to ask a question to obtain the scene plot. The question could be something like, "The following is the script for a scene in a play. Please extract a summary of the scene's plot, describing the specific events that occur in the scene. Do not guess or provide abstract descriptions. The script is xxx." It should be noted that the obtained plot may contain errors in detail or misplaced characters, so manual correction is required. After correction, the data becomes: Scene Script (Sample Plot Text) - Scene Summary (Sample Plot Summary).
[0217] In one embodiment, the reinforcement training samples for reinforcement learning are generated as follows: for a sample plot text, two summaries are generated (e.g., a pre-trained natural language model is asked multiple times, and the generated results are different each time). The better summary is manually labeled as the selected plot summary, and the worse summary is designated as the unselected plot summary. At the same time, script auxiliary information is extracted to obtain reinforcement training samples.
[0218] In one embodiment, taking character relationships as an example of script auxiliary information, the initial training data can be in the form of scene script (sample plot text) - scene plot (sample plot summary) - character relationships (script auxiliary information). The specific data format can be:
[0219] {"id": "999", "conversations":[
[0220] {"from":"human","value":"The following is a scene from a play. Please extract a summary of the scene's plot, describing the specific events that occur. Do not speculate or provide abstract descriptions. The script is xxx."}
[0221] {"from":"gpt","value":"xxxx"}
[0222] ]}
[0223] Wherein, "xxx" in the script refers to a specific scene from a film or television script, i.e., the sample plot text, and the returned "xxxx" represents the scene plot from the data preparation above. "Id" is the sequence number of this data entry. The input is text from "human" to the model's input, and the model is expected to output text from "gpt," where the text from "gpt" serves as the training supervision information.
[0224] In one embodiment, the model training process for the two stages involved in the narrative text processing of this application is described below.
[0225] First, the initial training phase, also known as the hierarchical model training phase, uses initial training samples for training. The training task involves learning the three main components of the summary prediction network: the word prediction network, the fully connected layer, and the auxiliary information prediction network. The specific training process is as follows:
[0226] 1. Parameter initialization: The initial summary generation model is initialized using an untrained summary generation reference model, and the newly added modules (HL-extracted merge, fusion, etc., i.e. auxiliary information prediction network) are initialized using a Gaussian distribution with (0,1) parameters.
[0227] 2. Set learning parameters: The word prediction network, fully connected layer, and auxiliary information prediction network in the summary prediction network are the learning parameters.
[0228] 3. Learning Process: For the full dataset of N data points (i.e., multiple initial training samples), bs data points are randomly selected each time to form a batch of data, for a total of M = N / bs batches. Each M batches complete represents one epoch iteration; each iteration processes the full dataset once, until the average epoch loss no longer decreases at a certain epoch (i.e., the predicted loss value corresponding to each of the multiple initial training samples no longer decreases). During the learning process for each batch:
[0229] (1) Model forward pass: Input the plot text in each training sample into the model for forward pass calculation, generate predictions for HL and HH, and then calculate the task loss for HH and HL, and the total loss.
[0230] (2) Model backwards: The total loss is backpropagated to the network to calculate the gradient of each parameter of the network.
[0231] (3) Model parameter update: Update each parameter according to the gradient of each parameter of the above network.
[0232] Secondly, the second stage is the reinforcement learning stage. This stage uses reinforcement training samples for training. The training process is similar to the training method mentioned above. The difference is that only the HL and HH reinforcement learning losses are calculated each time the loss is calculated, namely the output summary comparison loss value and the output auxiliary information comparison loss value.
[0233] The total loss for the first stage is Loss1 = Loss_HH + a*Loss_HL, and the total loss for the second stage is Loss2 = b1*Loss_RL_HH + b2*Loss_RL_HL.
[0234] Where Loss_HH is the HH task loss, Loss_HL is the HL task loss, which are the summarization prediction loss and auxiliary information prediction loss during the initial training phase. RL indicates the reinforcement learning loss, which is the output summary comparison loss and output auxiliary information comparison loss during the reinforcement training phase. a, b1, and b2 are weights, which can be 0.1, 0.2, and 0.1, respectively.
[0235] The following sections explain the losses for each task and the calculation of the relevant loss values.
[0236] Wherein, the HH task loss is the summary prediction loss. In this application, since the HH task is summary extraction, the summary extraction loss—cross-entropy loss—is used, which is the classification loss value of each character in the predicted sample plot summary. It should be noted that the class probability here comes from each character in the preset dictionary, and each character can be considered as one class. The formula for calculating the summary prediction loss value can be:
[0237] ;
[0238] in, This represents the summary prediction loss value for a single initial training sample, where N represents the number of initial training samples in the batch, which in this embodiment can specifically be bs. This represents the character encoding for each character in the sample plot summary. The character encoding for each character in the sample plot summary is determined based on its position in a preset dictionary. Specifically, it can be a one-hot encoding label. When the character is a character in the preset dictionary, the label at the position corresponding to that character in the character encoding is 1, and the label at other positions is 0. This represents the prediction probability corresponding to each word in the plot summary, i.e., in the context of... Given the actual probability distribution of the plot summary, the predicted probability distribution of the predicted summary is obtained by comparison. To determine the summary prediction loss value.
[0239] Among them, the HL task loss is the auxiliary information prediction loss. Since HL is a newly added low-level task used to support the final high-level task HH in hierarchical learning, the HL task prediction is output before the output of HH. This scheme uses a similarity loss for HL to measure the similarity between low-level prediction and low-level supervision information. By improving the similarity between low-level task prediction and real low-level information through loss, the model output contains more such low-level information.
[0240] Specifically, the similarity loss can be the contrastive loss, which measures the similarity between script auxiliary information features and prediction auxiliary information features. In this embodiment, the input of the contrastive loss is a sample pair composed of script auxiliary information features and prediction auxiliary information features, and the label is whether the sample pair belongs to the same class, that is, whether the prediction auxiliary information represented by the script auxiliary information and prediction auxiliary information features is the same.
[0241] In a specific application, the formula for calculating the similarity loss value can be:
[0242] ;
[0243] in, It is a function The abbreviation indicates input The mapped vector, in this embodiment, is the script auxiliary information feature. This refers to input The mapped vector, i.e., the predicted auxiliary information features, in this embodiment, and All represent sample plot text, 1{·} is an indicator function that returns 1 when the input is true, otherwise returns 0. That is, it returns 1 when the prediction auxiliary information represented by the script auxiliary information and the prediction auxiliary information features are the same, otherwise returns 0. m is a pre-set hyperparameter that can be configured according to the actual application scenario, indicating that the distance between samples of different classes should exceed this value.
[0244] Wherein, the RL_HH task loss is the output summary comparison loss. Using DPO (Direct Preference Optimization) loss for reinforcement learning, the formula for calculating the output summary comparison loss value can be:
[0245] ;
[0246] in, This indicates the reference model for abstract generation. This represents the initial summary generation model after training, where x represents the sample plot text. This indicates that a plot summary has been selected. This indicates that the plot summary was not selected. Indicates the first probability. Indicates the second probability. Indicates the fourth probability. The fifth probability, and These are the preset hyperparameters.
[0247] Here, the RL_HL task loss is the output auxiliary information comparison loss, meaning that a better summary answer corresponds to better HL information. Similarly, reinforcement learning can use DPO (Direct Preference Optimization) loss, and the formula for calculating the output auxiliary information comparison loss value can be:
[0248] ;
[0249] in, This indicates the reference model for abstract generation. This represents the initial summary generation model after training, where x represents the sample plot text. This means that while outputting the selected plot summary, script support information will also be output. This means that while outputting the plot summary that was not selected, script support information will also be output. This represents the probability that the output of the initial summary generation model after training will be selected to output script auxiliary information along with the plot summary. This represents the probability that the initial summary generation model, after training, outputs script auxiliary information while not selecting a plot summary. This indicates the probability that the summary generation reference model outputs a selected plot summary along with script auxiliary information. This indicates the probability that the summary generation reference model outputs script auxiliary information while simultaneously outputting a plot summary that was not selected. and These are the preset hyperparameters.
[0250] In one embodiment, an example is given illustrating the application of the narrative text processing method of this application.
[0251] First, it can be applied to script overviews. That is, input all the scenes of a play, obtain basic capabilities according to the above process, and then use this model to obtain a scene summary output for each scene, helping readers quickly understand the main content and plot of the script.
[0252] Secondly, it can be applied to content planning. In the planning stage of movies, TV series, or other media projects, all scenes of a series can be input, and the main plot of each scene can be generated based on the above capabilities. This can help planners quickly understand the main content of a large number of scripts, thereby making effective selection and decisions—such as choosing which scenes to focus on shooting based on the content of the plot description, or choosing which scenes to shoot together, etc.
[0253] Finally, it can be applied to script recommendations. In movie or TV series recommendation systems, the model can generate scene plots of a script, helping users quickly understand the content of countless scenes in the script and thus make viewing decisions.
[0254] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0255] Based on the same inventive concept, this application also provides a plot text processing apparatus for implementing the plot text processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more plot text processing apparatus embodiments provided below can be found in the limitations of the plot text processing method described above, and will not be repeated here.
[0256] In one embodiment, such as Figure 11 As shown, a plot text processing device is provided, including: an acquisition module 1102, a prediction module 1104, a loss estimation module 1106, and a parameter adjustment module 1108, wherein:
[0257] The acquisition module 1102 is used to acquire multiple initial training samples for training the initial summary generation model. The initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text. The script auxiliary information is different from the sample plot summary.
[0258] The prediction module 1104 is used to input the sample plot text in the initial training sample into the initial summary generation model for each initial training sample to predict the plot summary and auxiliary information, and obtain the predicted plot summary and predicted auxiliary information features.
[0259] The loss estimation module 1106 is used to calculate the prediction loss based on the features of the sample plot summary, the predicted plot summary, the script auxiliary information and the prediction auxiliary information, and to obtain the prediction loss value corresponding to the initial training sample.
[0260] The parameter adjustment module 1108 is used to adjust the parameters of the initial summary generation model according to the prediction loss values corresponding to multiple initial training samples, so as to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
[0261] The aforementioned plot text processing device, based on acquiring multiple initial training samples for training the initial summary generation model, inputs the sample plot text from each initial training sample into the initial summary generation model to predict plot summaries and auxiliary information. This yields predicted plot summaries and auxiliary information features. The prediction loss is then calculated using the sample plot summaries, predicted plot summaries, script auxiliary information, and prediction auxiliary information features to obtain the prediction loss value corresponding to the initial training sample. The parameters of the initial summary generation model are adjusted based on the prediction loss values corresponding to each of the multiple initial training samples to obtain a trained summary generation model. Throughout this process, during the training of the initial summary generation model, the cascading prediction of script auxiliary information allows the model to understand the correct information related to the summary from the script auxiliary information, supporting plot summary generation. This avoids situations where the plot summary output leads to misunderstandings of the plot text, resulting in a summary generation model capable of outputting accurate plot summaries. Accurate plot summaries can be generated simply by inputting the plot text into the trained summary generation model.
[0262] In one embodiment, the loss estimation module is further configured to calculate the summary prediction loss value based on the sample plot summary and the predicted plot summary, and calculate the auxiliary information prediction loss value based on the script auxiliary information and the predicted auxiliary information features, and aggregate the summary prediction loss value and the auxiliary information prediction loss value to obtain the prediction loss value corresponding to the initial training sample.
[0263] In one embodiment, the loss estimation module is further configured to encode each character in the sample plot summary to obtain the character code corresponding to each character in the sample plot summary, determine the prediction probability corresponding to each character in the predicted plot summary, calculate the prediction loss value corresponding to each character in the sample plot summary based on the character code corresponding to the targeted character and the prediction probability corresponding to the character in the same position in the predicted plot summary, and obtain the summary prediction loss value based on the prediction loss value corresponding to each character in the sample plot summary.
[0264] In one embodiment, the loss estimation module is further configured to encode the script auxiliary information to obtain the script auxiliary information features corresponding to the script auxiliary information, calculate the similarity loss value between the script auxiliary information features and the predicted auxiliary information features, and use the similarity loss value as the auxiliary information prediction loss value.
[0265] In one embodiment, the script auxiliary information is the plot character relationship; the acquisition module is also used to count the appearance frequency of plot characters appearing in the sample plot text, determine multiple plot characters and their respective appearance frequencies, select at least two key characters from the multiple plot characters according to their respective appearance frequencies, determine the key character relationship between any two of the at least two key characters according to the sample plot text, and determine the plot character relationship describing the content of the sample plot text based on the key character relationship between any two of the at least two key characters.
[0266] In one embodiment, the acquisition module is further configured to group each pair of key characters into multiple key character pairs, and for each key character pair, predict the relationship between the two key characters in the key character pair based on the sample plot text to obtain the key character relationship between the two key characters in the key character pair.
[0267] In one embodiment, the acquisition module is further configured to, when the number of at least two key characters is two, use the key character relationship between the two key characters as the plot character relationship describing the content of the sample plot text.
[0268] In one embodiment, the acquisition module is further configured to, when the number of at least two key characters is greater than two, determine the two key characters with the highest appearance frequency according to the appearance frequency of each of the at least two key characters, and use the key character relationship of the two key characters with the highest appearance frequency as the plot character relationship describing the content of the sample plot text.
[0269] In one embodiment, the parameter adjustment module is further configured to adjust the parameters of the initial summarization generation model based on the predicted loss values corresponding to each of the multiple initial training samples, thereby obtaining the trained initial summarization generation model; obtain a summary generation reference model, which includes a classification task head and the network structure of the initial summarization generation model, and is trained using multiple initial training samples; obtain multiple reinforcement training samples; for each reinforcement training sample, train the trained initial summarization generation model and the summary generation reference model using the sample plot text, the selected plot summary and the unselected plot summary corresponding to the sample plot text, and the script auxiliary information describing the content of the sample plot text, thereby obtaining the reinforcement training loss value corresponding to the reinforcement training sample; and adjust the parameters of the trained initial summarization generation model based on the reinforcement training loss values corresponding to each of the multiple reinforcement training samples, thereby obtaining the trained summary generation model.
[0270] In one embodiment, the parameter adjustment module is further configured to, for each reinforcement training sample, input the sample plot text from the reinforcement training sample into the trained initial summary generation model, determine the first probability that the trained initial summary generation model outputs a selected plot summary, the second probability that it outputs a non-selected plot summary, and the third probability that it outputs script auxiliary information, input the sample plot text from the reinforcement training sample into the summary generation reference model, determine the fourth probability that the summary generation reference model outputs a selected plot summary, the fifth probability that it outputs a non-selected plot summary, and the sixth probability that it outputs script auxiliary information, determine the output summary comparison loss value based on the first, second, fourth, and fifth probabilities, determine the output auxiliary information comparison loss value based on the third and sixth probabilities, and obtain the reinforcement training loss value corresponding to the reinforcement training sample based on the output summary comparison loss value and the output auxiliary information comparison loss value.
[0271] In one embodiment, the parameter adjustment module is further configured to determine, based on the first probability and the fourth probability, a first output probability ratio of the selected plot summary output by the initial summary generation model and the summary generation reference model, and based on the second probability and the fifth probability, a second output probability ratio of the unselected plot summary output by the initial summary generation model and the summary generation reference model, and calculate an output summary comparison loss value based on the first output probability ratio and the second output probability ratio.
[0272] In one embodiment, the parameter adjustment module is further configured to determine the initial summary generation model and the summary generation reference model after training based on the third probability and the sixth probability, output a third output probability ratio of script auxiliary information while outputting the selected plot summary, and output a fourth output probability ratio of script auxiliary information while outputting the unselected plot summary, and calculate the output auxiliary information comparison loss value based on the third output probability ratio and the fourth output probability ratio.
[0273] In one embodiment, the plot text processing device further includes a plot summary generation module, which is used to acquire the plot text to be processed, input the plot text to be processed into the trained summary generation model, and obtain the plot summary corresponding to the plot text to be processed.
[0274] Each module in the aforementioned plot text processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0275] In one embodiment, a computer device is provided, which can be a server or a terminal. Taking the computer device as a server as an example, its internal structure diagram can be as follows. Figure 12 As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores data such as initial training samples and reinforcement training samples. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a narrative text processing method.
[0276] Those skilled in the art will understand that Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0277] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0278] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0279] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0280] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0281] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0282] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for processing narrative text, characterized in that, The method includes: Obtain multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary; For each initial training sample, the sample plot text in the initial training sample is input into the initial summary generation model to predict the plot summary and auxiliary information, so as to obtain the predicted plot summary and predicted auxiliary information features. Based on the sample plot summary and the predicted plot summary, calculate the summary prediction loss value, and based on the script auxiliary information and the prediction auxiliary information features, calculate the auxiliary information prediction loss value; The summarization prediction loss value and the auxiliary information prediction loss value are aggregated to obtain the prediction loss value corresponding to the initial training sample; Based on the predicted loss values corresponding to each of the multiple initial training samples, the parameters of the initial summary generation model are adjusted to obtain the trained initial summary generation model. Obtain a summary generation reference model; the summary generation reference model includes a classification task head and the network structure of the initial summary generation model, and is trained using the multiple initial training samples; Multiple reinforcement training samples are obtained. For each reinforcement training sample, the initial summary generation model and the summary generation reference model are trained using the sample plot text, the selected plot summary and the unselected plot summary corresponding to the sample plot text, and the script auxiliary information describing the content of the sample plot text, to obtain the reinforcement training loss value corresponding to the reinforcement training sample. Based on the reinforcement training loss values corresponding to each of the multiple reinforcement training samples, the parameters of the initial summary generation model after training are adjusted to obtain the trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
2. The method according to claim 1, characterized in that, The step of calculating the summary prediction loss value based on the sample plot summary and the predicted plot summary includes: Each character in the sample plot summary is encoded to obtain the character code corresponding to each character in the sample plot summary, and the prediction probability corresponding to each character in the predicted plot summary is determined. For each character in the sample plot summary, the prediction loss value corresponding to the character is calculated based on the character code corresponding to the character and the prediction probability corresponding to the character in the same position in the predicted plot summary. The summary prediction loss value is obtained based on the prediction loss value corresponding to each word in the sample plot summary.
3. The method according to claim 1, characterized in that, The step of calculating the prediction loss value of the auxiliary information based on the script auxiliary information and the prediction auxiliary information features includes: The script support information is encoded to obtain the script support information features corresponding to the script support information; Calculate the similarity loss value between the script auxiliary information features and the prediction auxiliary information features, and use the similarity loss value as the auxiliary information prediction loss value.
4. The method according to any one of claims 1 to 3, characterized in that, The script auxiliary information refers to the relationships between characters in the storyline; these relationships are obtained through the following methods: The frequency of appearance of plot characters in the sample plot text is statistically analyzed to identify multiple plot characters and their respective frequency of appearance. Based on the frequency of appearance of each of the multiple plot characters, select at least two key characters from the multiple plot characters; Based on the sample plot text, determine the key character relationship between any two of the at least two key characters; Based on the key character relationships between any two of the at least two key characters, determine the plot character relationships that describe the content of the sample plot text.
5. The method according to claim 4, characterized in that, Determining the key character relationship between any two of the at least two key characters based on the sample plot text includes: By grouping each pair of the at least two key figures into a group, multiple pairs of key figures are obtained. For each key character pair, the relationship between the two key characters in the key character pair is predicted based on the sample plot text, thus obtaining the key character relationship between the two key characters in the key character pair.
6. The method according to claim 4, characterized in that, The determination of plot character relationships describing the content of the sample plot text based on the key character relationships between any two of the at least two key characters includes: When the number of the at least two key characters is two, the key character relationship between the two key characters is used as the plot character relationship describing the content of the sample plot text.
7. The method according to claim 4, characterized in that, The determination of plot character relationships describing the content of the sample plot text based on the key character relationships between any two of the at least two key characters includes: When the number of the at least two key figures is greater than two, the two key figures with the highest appearance frequency shall be determined according to the appearance frequency of each of the at least two key figures. The key character relationship between the two most frequently appearing key characters is used as the plot character relationship to describe the content of the sample plot text.
8. The method according to claim 1, characterized in that, For each reinforcement training sample, the initial summary generation model and the summary generation reference model are trained using the sample plot text, the selected and unselected plot summaries corresponding to the sample plot text, and script auxiliary information describing the content of the sample plot text. The reinforcement training loss value corresponding to the reinforcement training sample is obtained as follows: For each enhanced training sample, the sample plot text in the enhanced training sample is input into the trained initial summary generation model, and the first probability of the trained initial summary generation model outputting the selected plot summary, the second probability of outputting the unselected plot summary, and the third probability of outputting script auxiliary information are determined. The sample plot text in the enhanced training samples is input into the summary generation reference model, and the fourth probability of the summary generation reference model outputting the selected plot summary, the fifth probability of outputting the unselected plot summary, and the sixth probability of outputting script auxiliary information are determined. Based on the first probability, the second probability, the fourth probability, and the fifth probability, the output summary comparison loss value is determined, and based on the third probability and the sixth probability, the output auxiliary information comparison loss value is determined. The reinforcement training loss value corresponding to the reinforcement training sample is obtained by comparing the loss value of the output summary and the loss value of the output auxiliary information.
9. The method according to claim 8, characterized in that, The step of determining the output summary comparison loss value based on the first probability, the second probability, the fourth probability, and the fifth probability includes: Based on the first probability and the fourth probability, determine the first output probability ratio between the trained initial summary generation model and the summary generation reference model for outputting the selected plot summary; Based on the second probability and the fifth probability, determine the second output probability ratio between the trained initial summary generation model and the summary generation reference model for outputting the unselected plot summary; The output summary comparison loss value is calculated based on the first output probability ratio and the second output probability ratio.
10. The method according to claim 8, characterized in that, The step of determining the output auxiliary information comparison loss value based on the third probability and the sixth probability includes: Based on the third probability and the sixth probability, the trained initial summary generation model and the summary generation reference model are determined, and a third output probability ratio is set for outputting script auxiliary information while outputting the selected plot summary, and a fourth output probability ratio is set for outputting script auxiliary information while outputting the unselected plot summary. Based on the third output probability ratio and the fourth output probability ratio, the output auxiliary information comparison loss value is calculated.
11. The method according to claim 1, characterized in that, The method further includes: Get the plot text to be processed; The plot text to be processed is input into the trained summary generation model to obtain the corresponding plot summary of the plot text to be processed.
12. A plot text processing device, characterized in that, The device includes: The acquisition module is used to acquire multiple initial training samples for training the initial summary generation model; the initial training samples include sample plot text, sample plot summary, and script auxiliary information describing the content in the sample plot text, wherein the script auxiliary information is different from the sample plot summary; The prediction module is used to input the sample plot text in the initial training sample into the initial summary generation model for each initial training sample to predict the plot summary and auxiliary information, thereby obtaining the predicted plot summary and predicted auxiliary information features. The loss estimation module is used to calculate the summary prediction loss value based on the sample plot summary and the predicted plot summary, and to calculate the auxiliary information prediction loss value based on the script auxiliary information and the prediction auxiliary information features; and to aggregate the summary prediction loss value and the auxiliary information prediction loss value to obtain the prediction loss value corresponding to the initial training sample. The parameter adjustment module is used to adjust the parameters of the initial summary generation model according to the prediction loss values corresponding to the multiple initial training samples, thereby obtaining a trained initial summary generation model; obtain a summary generation reference model; the summary generation reference model includes a classification task head and the network structure of the initial summary generation model, and is trained using the multiple initial training samples; obtain multiple reinforcement training samples, and for each reinforcement training sample, use the sample plot text, the selected plot summary and the unselected plot summary corresponding to the sample plot text, and script auxiliary information describing the content of the sample plot text to train the trained initial summary generation model and the summary generation reference model, thereby obtaining the reinforcement training loss value corresponding to the reinforcement training sample; adjust the parameters of the trained initial summary generation model according to the reinforcement training loss values corresponding to the multiple reinforcement training samples, thereby obtaining a trained summary generation model; the trained summary generation model is used to output a plot summary based on the input plot text.
13. The plot text processing apparatus according to claim 12, characterized in that, The loss estimation module is also used to encode each character in the sample plot summary to obtain the character code corresponding to each character in the sample plot summary, and to determine the prediction probability corresponding to each character in the predicted plot summary; for each character in the sample plot summary, the prediction loss value corresponding to the targeted character is calculated based on the character code corresponding to the targeted character and the prediction probability corresponding to the characters in the same position in the predicted plot summary. The summary prediction loss value is obtained based on the prediction loss value corresponding to each word in the sample plot summary.
14. The plot text processing apparatus according to claim 12, characterized in that, The loss estimation module is also used to encode the script assistance information to obtain script assistance information features corresponding to the script assistance information; Calculate the similarity loss value between the script auxiliary information features and the prediction auxiliary information features, and use the similarity loss value as the auxiliary information prediction loss value.
15. The plot text processing apparatus according to claim 12, characterized in that, The script auxiliary information refers to the relationships between characters in the plot; the acquisition module is also used to statistically analyze the frequency of appearance of characters in the sample plot text, identify multiple characters, and the frequency of appearance of each of the multiple characters; select at least two key characters from the multiple characters according to their respective frequency of appearance; determine the key character relationship between any two of the at least two key characters based on the sample plot text; and determine the plot character relationships describing the content of the sample plot text based on the key character relationship between any two of the at least two key characters.
16. The plot text processing apparatus according to claim 15, characterized in that, The acquisition module is further configured to group each pair of key characters into multiple key character pairs; for each key character pair, the relationship between the two key characters in the key character pair is predicted based on the sample plot text to obtain the key character relationship between the two key characters in the key character pair.
17. The plot text processing apparatus according to claim 15, characterized in that, The acquisition module is also used to, when the number of the at least two key characters is two, use the key character relationship between the two key characters as the plot character relationship describing the content of the sample plot text.
18. The plot text processing apparatus according to claim 15, characterized in that, The acquisition module is further configured to, when the number of the at least two key characters is greater than two, determine the two key characters with the highest appearance frequency according to the appearance frequency of each of the at least two key characters; and use the key character relationship of the two key characters with the highest appearance frequency as the plot character relationship describing the content of the sample plot text.
19. The plot text processing apparatus according to claim 12, characterized in that, The parameter adjustment module is further configured to, for each reinforcement training sample, input the sample plot text from the reinforcement training sample into the trained initial summary generation model, determine a first probability that the trained initial summary generation model will output the selected plot summary, a second probability that it will output the unselected plot summary, and a third probability that it will output script auxiliary information; input the sample plot text from the reinforcement training sample into the summary generation reference model, determine a fourth probability that the summary generation reference model will output the selected plot summary, a fifth probability that it will output the unselected plot summary, and a sixth probability that it will output script auxiliary information; determine an output summary comparison loss value based on the first probability, the second probability, the fourth probability, and the fifth probability; determine an output auxiliary information comparison loss value based on the third probability and the sixth probability; and obtain the reinforcement training loss value corresponding to the reinforcement training sample based on the output summary comparison loss value and the output auxiliary information comparison loss value.
20. The plot text processing apparatus according to claim 19, characterized in that, The parameter adjustment module is further configured to determine, based on the first probability and the fourth probability, a first output probability ratio between the trained initial summary generation model and the summary generation reference model for outputting the selected plot summary; Based on the second probability and the fifth probability, determine the second output probability ratio of the unselected plot summary output by the trained initial summary generation model and the summary generation reference model; calculate the output summary comparison loss value based on the first output probability ratio and the second output probability ratio.
21. The plot text processing apparatus according to claim 19, characterized in that, The parameter adjustment module is also used to determine the trained initial summary generation model and the summary generation reference model based on the third probability and the sixth probability, and output a third output probability ratio of script auxiliary information while outputting the selected plot summary, and output a fourth output probability ratio of script auxiliary information while outputting the unselected plot summary. Based on the third output probability ratio and the fourth output probability ratio, the output auxiliary information comparison loss value is calculated.
22. The plot text processing apparatus according to claim 12, characterized in that, The device further includes a plot summary generation module, which is used to acquire plot text to be processed; input the plot text to be processed into the trained summary generation model to obtain a plot summary corresponding to the plot text to be processed.
23. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the method of any one of claims 1 to 11.
24. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 11.
25. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 11.
Citation Information
Patent Citations
Training method and device of plot extraction model, equipment and storage medium
CN117875392A
Performance evaluation method and device for abstract generation model, and computer equipment
CN118070775A