Script processing method, device, computer equipment, storage medium and program product

By reconstructing the text of event elements of the script and applying the scene event representation model, the problem of too many and too trivial events in the plot understanding in the prior art is solved, and a more effective and complete understanding of the script is achieved.

CN118153564BActive Publication Date: 2025-04-01TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410313484.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-18
Publication Date
2025-04-01
Estimated Expiration
2044-03-18

AI Technical Summary

Technical Problem

The existing technology has problems of too many and too trivial events in the automated plot understanding, and it is difficult to ensure the effectiveness and integrity of plot events.

Method used

By obtaining the scene text of the target script, reconstructing the text according to the event elements, the event description text is obtained. Then, event representations are extracted using the scene event representation model, which is obtained through ternary sample group training. The scenes are aggregated based on event representation, and the scene set belonging to the same event is determined, and the scene sets are associated with the scene sets to obtain the plot content.

Benefits of technology

It improves the effectiveness and completeness of the script understanding, ensures the accuracy and coherence of plot events, and avoids the problems of excessive or too trivial events.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118153564B_ABST
    Figure CN118153564B_ABST
Patent Text Reader

Abstract

The present application relates to a script processing method, device, computer equipment, storage medium and computer program product. Applied to the field of artificial intelligence, the method includes: obtaining the scene text contained in the target script, reconstructing the scene text according to the event elements, and obtaining the event description text corresponding to each scene text; extracting the event representation of each event description text respectively through the scene event representation model, the scene event representation model is obtained by training the ternary sample group, and the ternary sample group is used to form positive sample pairs with the same event identifier and negative sample pairs with different event identifiers; based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine the scene set belonging to the same event; and the events represented by each scene set are associated to obtain the plot content of the target script. The use of this method can effectively improve the effectiveness and completeness of the plot understanding of the target script.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a script processing method, apparatus, computer equipment, storage medium and computer program product. Background Art

[0002] With the development of society, production companies have an increasing demand for filming films and TV series based on excellent film and TV scripts. Since production companies receive many film and TV scripts every day, for dozens of episodes and hundreds of thousands of words, quickly understanding the content of each episode will help production companies quickly evaluate the value of the script. At the script understanding level, the focus is on understanding the events that occur in the script.

[0003] In the existing implementation methods of automated plot understanding, there are problems such as too many and too trivial events in the plot understanding output, which makes it difficult to ensure the effectiveness and integrity of the plot events. Summary of the invention

[0004] Based on this, it is necessary to provide a script processing method, device, computer equipment, computer-readable storage medium and computer program product that can improve the effectiveness and completeness of script understanding from the event dimension in response to the above-mentioned technical problems.

[0005] In a first aspect, the present application provides a script processing method. The method comprises:

[0006] Obtaining the scene texts contained in the target script, reconstructing the scene texts according to event elements, and obtaining event description texts corresponding to each of the scene texts;

[0007] The event representation of each event description text is extracted respectively by a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers;

[0008] Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event;

[0009] The events represented by each of the scene sets are associated to obtain the plot content of the target script.

[0010] In a second aspect, the present application also provides a script processing device. The device comprises:

[0011] A text reconstruction module is used to obtain the scene texts contained in the target script, reconstruct the scene texts according to event elements, and obtain event description texts corresponding to each of the scene texts;

[0012] An event representation extraction module, used to extract event representations of each event description text respectively through a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form positive sample pairs with the same event identifier and negative sample pairs with different event identifiers;

[0013] A session aggregation module, for aggregating the sessions corresponding to the event description texts based on the event representations of the event description texts, and determining a set of sessions belonging to the same event;

[0014] The plot analysis module is used to associate the events represented by each of the scene sets to obtain the plot content of the target script.

[0015] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

[0016] Obtaining the scene texts contained in the target script, reconstructing the scene texts according to event elements, and obtaining event description texts corresponding to each of the scene texts;

[0017] The event representation of each event description text is extracted respectively by a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers;

[0018] Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event;

[0019] The events represented by each of the scene sets are associated to obtain the plot content of the target script.

[0020] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0021] Obtaining the scene texts contained in the target script, reconstructing the scene texts according to event elements, and obtaining event description texts corresponding to each of the scene texts;

[0022] The event representation of each event description text is extracted respectively by a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers;

[0023] Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event;

[0024] The events represented by each of the scene sets are associated to obtain the plot content of the target script.

[0025] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:

[0026] Obtaining the scene texts contained in the target script, reconstructing the scene texts according to event elements, and obtaining event description texts corresponding to each of the scene texts;

[0027] The event representation of each event description text is extracted respectively by a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers;

[0028] Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event;

[0029] The events represented by each of the scene sets are associated to obtain the plot content of the target script.

[0030] The above-mentioned script processing method, device, computer equipment, storage medium and computer program product reconstruct the scene text of the target script according to the event elements to obtain the event description text, thereby realizing the expression of the scene text in the script in the form of event description, laying a foundation for the subsequent aggregation of scenes in the same event, and extracting the event representation of each event description text through the scene event representation model obtained by training the ternary sample group. The model training is carried out by utilizing the characteristics that the ternary sample group can form positive sample pairs with the same event identifier and negative samples with different event identifiers, effectively improving the recognition of the event representation of the same event and the event representation of different events by the scene event representation model, so that the scene event representation model can output an event representation that more accurately identifies the event to which it belongs, and then based on the event representation, the scenes corresponding to the event description text are aggregated to obtain a set of scenes belonging to the same event, thereby sorting out the plot content of the target script according to the event dimension according to the events represented by the scene set, which can effectively improve the effectiveness and completeness of the plot understanding of the target script. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1A diagram of an application environment of a script processing method in an embodiment;

[0032] Figure 2 A schematic diagram of a process flow of a script processing method in one embodiment;

[0033] Figure 3 A schematic diagram of plot event highlights output in one embodiment;

[0034] Figure 4 A schematic diagram of an overview of plot events output in one embodiment;

[0035] Figure 5 A schematic diagram of a session text in an embodiment;

[0036] Figure 6 A schematic diagram of content text of event element dimension extracted from scene text in another embodiment;

[0037] Figure 7 A schematic diagram of a process flow of a script processing method in one embodiment;

[0038] Figure 8 is a schematic diagram of an example of fine-tuning a BERT module in one embodiment;

[0039] Fig. 9 A schematic diagram of the structure of a BERT module of a scene event characterization model in one embodiment;

[0040] Fig.10 Schematic diagram of the structure of TRM in a BERT module in one embodiment;

[0041] Fig.11 A schematic diagram of a training process of a scene event characterization model in one embodiment;

[0042] Fig.12 is a schematic diagram of a training process for identifying meaningless scenes through a model in one embodiment;

[0043] Fig.13 A schematic diagram of an event description text in an embodiment;

[0044] Fig.14 A schematic diagram of aggregating event representations based on event description text in one embodiment;

[0045] Fig.15 is a schematic diagram of the principle of dictionary mapping in one embodiment;

[0046] Fig.16 is a structural block diagram of a script processing device in one embodiment;

[0047] Fig.17is an internal structure diagram of a computer device in one embodiment;

[0048] Fig.18 FIG. 4 is a diagram showing the internal structure of a computer device in another embodiment. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0050] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.

[0051] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics, etc. Among them, pre-trained models are also called large models and basic models. After fine-tuning, they can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0052] The solution provided in the embodiments of the present application involves technologies such as artificial intelligence natural language processing, which is specifically described by the following embodiments:

[0053] The script processing method provided in the embodiment of the present application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through a network. The communication network can be a wired network or a wireless network. Therefore, the terminal 102 and the server 104 can be directly or indirectly connected through wired or wireless communication. For example, the terminal 102 can be indirectly connected to the server 104 through a wireless access point, or the terminal 102 is directly connected to the server 104 through the Internet, and this application does not limit this.

[0054] The terminal 102 may be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, IoT devices, and portable wearable devices. The IoT devices may be smart speakers, smart TVs, smart air conditioners, smart car-mounted devices, etc. The portable wearable devices may be smart watches, smart bracelets, head-mounted devices, etc. The embodiments of the present application may be applied to scenarios such as script plot summary or script character analysis.

[0055] The terminal 102 may be installed with a client related to script processing, which may include an application that needs to be installed separately, or may include a small program or web page that can be used without downloading. The server 104 is a background server corresponding to the client, or a server specifically used for script processing. Furthermore, the server 104 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The data storage system can store the data that the server 104 needs to process. The data storage system can be set up separately, integrated on the server 104, or placed on the cloud or other servers.

[0056] It should be noted that the script processing method in the embodiment of the present application can be executed by the terminal 102 or the server 104 alone, or can be executed by the terminal 102 and the server 104 together. The server 104 can receive the target script uploaded from the client 102, obtain the scene text contained in the target script from the target script, and then reconstruct the scene text according to the event elements to obtain the event description text corresponding to each scene text, and then extract the event representation of each event description text respectively through the scene event representation model, and based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine the scene set belonging to the same event, and finally the events represented by each scene set are associated to analyze the plot of the target script to obtain the plot content of the target script. Among them, the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers.

[0057] In one embodiment, Figure 2 As shown, a script processing method is provided, which can be executed by a computer device, and the computer device can be Figure 1 The terminal or server shown in this embodiment is applied to Figure 1The server in the example is used to illustrate the following steps:

[0058] Step 202, obtain the scene texts contained in the target script, reconstruct the scene texts according to event elements, and obtain the event description texts corresponding to each scene text.

[0059] Among them, the script is a document with a specific format that is organized by the screenwriter for the convenience of actors to perform. Generally speaking, the script is mainly composed of time, place, characters, and dialogues between characters, which are used for subsequent shooting guidance. The target script is a specific script to be analyzed. It can be understood that the target script can be specified in various ways. For example, the target script can be a script manually selected by the user from multiple candidate scripts, or the computer device can automatically use the script indicated by the trigger event as the target script by responding to a specific trigger event. For example, the server responds to the script upload event of the terminal and automatically uses the script received from the terminal as the target script for subsequent analysis and processing.

[0060] For a script, the screenwriter generally divides the plot according to scenes to write the script. Specifically, the script can be directly composed of several scene texts. For example, script A includes 300 scenes. The script can also be composed of several episodes, each episode includes several scenes. For example, script B includes 40 episodes, and each episode includes a certain number of scenes. The number of scenes contained in different episodes can be the same or different. The number of scenes in each episode can be determined based on the complexity of the plot content to be presented in the episode. For example, the number of scenes contained in an episode with more scene switches may be less than the number of scenes contained in an episode with fewer scene switches.

[0061] For each scene, there is a corresponding scene text in the script, which is used to guide the plot content of the scene. The content of the scene text needs to include time, place, characters, and dialogues between characters, but the above content may be reflected in different ways in the scene text. For example, some scripts will state the time, place, and characters at the beginning of the scene text of each scene, while some scripts include part of the above content in the main text. For example, the content of the character dialogue part is needed to determine the characters included in the scene.

[0062] Each scene text describes an event or a part of a complete event. The time, place, characters, and dialogues between characters in the scene text represent specific events, which are the event elements of the scene text. In order to improve the format consistency of the specific events represented by the scene text, each scene text can be reconstructed according to the event elements to obtain the event description text of the scene text.

[0063] Text reconstruction can be the process of generating new text by reorganizing the session text according to event elements. By reconstructing the event description text, different session texts can have the same format and content description dimensions, further improving the readability of the session text and the comparability between different session texts, and facilitating the subsequent extraction of event representations from the event description text and the analysis of whether they belong to the same event.

[0064] Specifically, in some embodiments, text reconstruction can first extract the text content of each event element dimension from the scene text according to the event elements, and then splice the text content corresponding to each event element dimension in a set order to obtain the event description text.

[0065] In one embodiment, the text content of each event element dimension can be directly extracted from the scene text, or can be obtained by semantically analyzing the scene text according to the event element dimension through a large language model. For example, for scene text A, the time, place, and characters can be directly extracted from scene text A, and the event description content can be obtained by analyzing the conversation content between characters in scene text A through a large language model, so that the event description content can be more in line with the common event description habits.

[0066] In this embodiment, the scene text of the script, which has a specific expression, is reconstructed according to event elements such as time, place, characters, and events, so that the reconstructed event description text has stronger readability than the scene text.

[0067] Step 204 , extracting event representations of each event description text respectively through a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form positive sample pairs with the same event identifier and negative sample pairs with different event identifiers.

[0068] Among them, the scene event representation model is a model used to extract event representations from event description texts to determine the events to which the scene description texts correspond. The scene event representation model can be specifically implemented through a pre-trained large language model and an event representation extraction module added on the basis of the large language model. Specifically, by fine-tuning the pre-trained large language model, the script semantics can be accurately understood, and the event representation extraction module can achieve effective extraction of event representations based on training.

[0069] Specifically, the scene event representation model is obtained by training a ternary sample group used to form a positive and negative sample pair. The ternary sample group includes three samples with event identifiers, of which two samples with the same event identifier constitute a positive sample pair. Based on any sample in the positive sample pair, a negative sample with a different event identifier from the sample is determined to form a negative sample pair including the sample and the corresponding negative sample. The ternary sample group can be formed by the above three samples.

[0070] Each sample in the ternary sample group has a corresponding event identifier, which is used to characterize the event to which the sample belongs. Samples belonging to the same event have the same event identifier, and samples belonging to different events have different event identifiers. The event identifier can be obtained by annotating each scene in the sample script.

[0071] For example, in the event annotation process, for each scene in the sample script, information can be organized and event annotated according to the following dimensions: script name, episode id, scene id, event id, event description text. Among them, the event id is 1, 2, 3, etc., which represent the codes of different events, the episode id refers to episodes 1, 2, 3, etc., and the scene id refers to the scene codes of different occurrence orders in a certain episode of the script, such as 1, 2, 3, 4, etc. When there is no event in a scene, such as an empty shot of the city used for transition, and no characters appear, the event id can be marked with a specific character, such as -1, which means there is no event.

[0072] Among them, the positive sample pairs in the triple sample group can be selected from a part of the scenes with event ids in the sample script as target samples. Then, for each target sample, another sample with the same event id as the target sample is determined to form a positive sample pair, and then another sample with a different event id from the target sample is determined to form a negative sample pair.

[0073] In this embodiment, the scene event representation model is trained by using ternary sample groups. The ternary sample groups can be used to fully explore the similarities between positive sample pairs belonging to the same event and the differences between negative sample pairs belonging to different events, so that the scene event representation model obtained by sufficient training can achieve accurate expression of event representation for event description text, which is conducive to improving the accuracy of scene clustering based on event expression and effectively determining the scenes belonging to the same event in the script.

[0074] Step 206 , based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event.

[0075] Through the event representation extraction module, after extracting the event representation of each event description text, the event representation of each event description text can be obtained. The event representation can express the event to which the corresponding scene belongs. Therefore, based on the event representation, the scenes corresponding to the event description text can be aggregated to obtain a scene set consisting of scenes belonging to the same event.

[0076] The aggregation process of the sessions includes grouping the sessions that represent the same event together to obtain a session set, where each session in the session set represents the same event.

[0077] In the case where the script is directly divided into multiple scenes, all the scenes can be directly aggregated together, or the first N scenes can be selected for aggregation in the order in which the scenes occur, and then starting from the N+1th scene, the scenes whose scene sets have not yet been determined are aggregated with the existing scene sets from the front to the back, until the scene set to which the last scene belongs is determined, and the complete scene set of the script is obtained.

[0078] In the case where the script is first divided into multiple episodes and each episode is then divided into multiple scenes, the first episode can be aggregated to obtain a scene set corresponding to each event contained in the first episode. Then, starting from the second episode, each scene can be determined in turn to determine whether it belongs to a scene set contained in the previous episode or a new event, that is, a new scene set, until the end of the last episode is determined to obtain the complete scene set of the script.

[0079] In this embodiment, the scenes corresponding to the event description text are aggregated through event representation, which can make full use of the event representation output by the scene event representation model that can accurately determine the event to which the scene belongs, and construct a scene set belonging to the same event, thereby improving the effective identification of different scenes of the same event, especially for the scenario where non-continuous scenes represent the same event. Compared with traditional technologies, it can effectively improve the accuracy of the division of scene sets.

[0080] Step 208, associate the events represented by each set of scenes to obtain the plot content of the target script.

[0081] The plot content refers to the output text that can clearly express the plot of the script and make the script more readable. The output of the plot content can be varied, for example Figure 3 As shown, the plot can be described briefly by events, and the core content of a specific event can be described in one sentence in the form of "highlights" text output. Figure 4As shown, you can describe the plot in detail by event. Use the "one paragraph" text output method to describe the plot summary of a specific event in one paragraph. Using paragraphs as divisions can make the script have a clearer plot description. Figure 4 Two events in the script are described through two paragraphs.

[0082] In a specific application, different plot analysis requirements can be used to sort out the events represented by each set of scenes and output plot content description texts in different styles.

[0083] For example, in some specific application scenarios, plot analysis requirements can be pre-configured. During the application process, the plot analysis can be performed directly based on the events represented by each set of scenes and the event correlation relationship, and the plot content that meets the plot analysis requirements can be output.

[0084] In other specific application scenarios, the plot analysis requirements can be configured in real time for the selected target script. During the application process, the target script is analyzed to obtain the events represented by each set of scenes in the target script. Then, the plot analysis is performed according to the event correlation relationship, and the plot content that meets the plot analysis requirements is output.

[0085] In one of the embodiments, a computer device obtains a plot analysis requirement for a target script. When the plot analysis requirement is a brief description of events, event highlights corresponding to each event in the target script are extracted in sequence according to the correlation between the events represented by each set of scenes. When the plot analysis requirement is a detailed description of events, a plot summary corresponding to each event in the target script is generated in sequence according to the correlation between the events represented by each set of scenes.

[0086] In one of the embodiments, the computer device can also identify the protagonist of each event represented by each scene set to obtain the protagonist identification result. The computer device responds to the protagonist emotion analysis request for the target script, and analyzes the emotion changes of the protagonist in the target script according to the protagonist identification result of each event to obtain the protagonist emotion change trend analysis result. In addition, the computer device can also respond to the protagonist character setting analysis request for the target script, and based on the understanding of the script events of each event, analyze the protagonist character setting changes in the target script according to the correlation between the events to obtain the character setting development analysis result.

[0087] The above-mentioned script processing method reconstructs the scene text of the target script according to event elements to obtain event description text, thereby realizing the expression of the scene text in the script in the form of event description, laying a foundation for the subsequent aggregation of scenes in the same event, and extracts the event representation of each event description text through the scene event representation model obtained by training the ternary sample group. The model training is carried out by utilizing the characteristics that the ternary sample group can form positive sample pairs with the same event identifier and negative samples with different event identifiers, thereby effectively improving the recognition of the event representation of the same event and the event representation of different events by the scene event representation model, so that the scene event representation model can output event representations that more accurately identify the events to which it belongs, and then aggregate the scenes corresponding to the event description text based on the event representation to obtain a set of scenes belonging to the same event, thereby sorting out the plot content of the target script according to the events represented by the scene set and the event dimension, which can effectively improve the effectiveness and completeness of the plot understanding of the target script.

[0088] In specific applications, there are many ways to reconstruct the event text, such as content reorganization, format optimization, etc. In order to further improve the readability of the reconstructed event description text and the effectiveness of event representation extraction, the following embodiment provides a method for reconstructing the event text. The specific reconstruction process is as follows:

[0089] In some embodiments, the scene text is reconstructed according to the event elements to obtain the event description text corresponding to each scene text, including:

[0090] For the session text, content extraction is performed according to the preset event element dimensions to obtain the text content matching each event element dimension; the content of each text extracted from the same session text is spliced ​​to obtain the event description text corresponding to the session text.

[0091] The preset event element dimensions are determined according to the event content characteristics of the script, for example, the preset event element dimensions may include four dimensions: time, location, person, and specific event content. For different event element dimensions, corresponding content extraction methods may be used to extract text content.

[0092] For example, the time, place, and characters can be directly extracted from the scene text through keyword recognition. For another example, the specific event content can be extracted by converting the dialogue text into a statement text. For scripts of different formats or styles, corresponding content extraction methods can be configured to extract content from each event element dimension.

[0093] Specifically, the computer device can automatically match the corresponding method from the pre-configured content extraction method based on the content style of the script to extract the content of the preset event element dimension, and the result obtained is as follows: Figure 5 The following is an example of a part of the scene text of a script. The scene text contains the content of the four event elements: scene, time, people and events. Figure 6 As shown, by analyzing the contents of the four event element dimensions, it can be determined that scenes 1-4 of the first episode represent the same event. As training samples of the scene event representation model, scenes 1-4 can be marked with the same event identifier.

[0094] In this embodiment, according to the preset event element dimensions, the text content corresponding to each event element dimension can be extracted from the scene text. By performing content extraction on the scene text, the content required for each event element dimension can be obtained in a targeted manner, thereby ensuring the validity of the content of each part of the event description text. By performing content splicing on the text contents extracted according to the event element dimensions, on the one hand, the content components of the event description text can be kept the same from the event element dimension, and on the other hand, the format of the event description texts of different scenes can be unified through splicing processing, thereby improving the accuracy and validity of the event description text.

[0095] Furthermore, in order to improve the efficiency of extracting text content of each event element dimension, the present application provides a method for extracting content from session text through the following embodiments, so as to extract content by sampling session texts of different styles in different ways.

[0096] In some embodiments, for the session text, content extraction is performed according to preset event element dimensions to obtain text content of each event element dimension, including:

[0097] According to the preset event element dimensions, the element feature characters of the session text are recognized; when there are element feature characters in each event element dimension, the text content of each event element dimension is extracted from the session text based on the element feature words; when there are no element feature characters in at least one event element dimension, the session text is analyzed according to the event element dimensions based on the large language model to obtain the text content of each event element dimension.

[0098] Among them, element characteristic characters refer to the identifying characters used to identify the corresponding content of each event element dimension in the text content. Since time, place, characters and events in the script are specific elements that need to be provided to facilitate the interpretation of the plot, some scripts will directly record the time, place and characters at the beginning, and highlight them through keywords such as scene, time, and person, and character dialogue start marks.

[0099] For the scene text of this type of script, the feature character recognition can be performed on the scene text to determine the feature character corresponding to each event feature dimension, and then for each event feature dimension, the content range corresponding to the event feature dimension can be determined by locating the position of the corresponding feature character in the scene text, and then the text content of the event feature dimension can be extracted from the text content of the content range. In this embodiment, the text content is extracted by the feature character, which has the advantages of high extraction efficiency and accurate results.

[0100] Since the industry's format specifications do not require scripts to be written based on exactly the same template, in actual business, there are still some scripts that do not use element feature characters to highlight event elements, or scripts that only mark some of the event elements, such as scripts that do not mark the time, place and characters at the beginning of the scene text, or scripts that only indicate the time and place without marking the characters.

[0101] For this type of script, we can use a large language model to analyze the scene text according to the event element dimension, and directly extract the text content of each event element dimension from the scene text. Among them, the large language model can be a pre-trained model that can directly perform text analysis based on instructions, such as GPT (Generative Pre-Trained Transformer, generative pre-trained Transformer model).

[0102] In this embodiment, in the case where the element feature characters are incomplete, the text content is extracted through a large language model. On the one hand, the use of the large language model can effectively avoid additional application costs. On the other hand, the language processing advantages of the large language model can be used to extract the text content of each event element dimension, make up for the defect of incomplete element identification characters in the scene text, and obtain a comprehensive event element content text.

[0103] In this embodiment, for different styles of scripts, such as each event element dimension has element characteristic characters, or at least one event element dimension does not have element characteristic characters, different text content extraction methods are used to perform text extraction processing. Considering both the efficiency and comprehensiveness of text content extraction, it can ensure that complete event element content texts can be extracted for scripts of different styles.

[0104] Furthermore, the following takes a scenario in which each event element dimension has element characteristic characters as an example to further illustrate the method of extracting text content of the event element dimension.

[0105] In some embodiments, the element feature characters include feature words respectively matching the time, location, and character dimensions, as well as the plot start character matching the event dimension. Identifying the element feature characters for the scene text according to the preset event element dimensions includes:

[0106] Identifying the feature words respectively matching the time, location, and character dimensions from the header content of the scene text; identifying the plot start character matching the event dimension from the plot content of the scene text.

[0107] Among them, as Figure 5 shown, the feature word refers to the text that can accurately represent the specific event element dimension, or the combination of text and symbols. For example, "Time:", "Scene:", and "Character:" can respectively represent the event element dimensions of time, location, and character. The plot start character refers to the identifier used to represent the specific plot content in the script. For example, the "△" identifier at the start position of each paragraph of character dialogue content in the script can be used to accurately identify the character dialogue content in the scene text based on this "△" identifier.

[0108] In a specific application, in order to obtain a more effective event representation, it is necessary to extract the four elements related to the event from the scene text: time, location, character, and event.

[0109] For the three event element dimensions of time, location, and character, if the layout of the script has the corresponding header content of "Scene Time Character", the content of these three event element dimensions can be directly obtained from the header content. For a script without the header content of "Scene Time Character", it is necessary to extract the content of these three event element dimensions from the description content of the scene text.

[0110] The specific extraction method is: use a pre-trained large language model for extraction. For example, ask the question: "Please tell me the time, location, and character when the following script event occurs, and return it in json format. The return format is as follows: {'Time': 'Night', 'Location': 'Hotel', 'Character': 'Xiaowen'}, and the script is: xxxx (the specific content is the scene text of the 5th scene in the 1st episode of Script A)". Based on the return result of the large language model, the content of these three event element dimensions in the scene text of the 5th scene in the 1st episode of Script A can be obtained.

[0111] As for the specific event description of the scene text, since the script is not provided in advance, and the scene text is described in the form of character dialogue, etc. However, in the overall script plot understanding application system, the plot of each scene will be generated in advance, so the scene plot can be used as an event description, so as to not increase the application cost in the overall application system. Specifically, the scene plot generated in the overall script plot understanding application system can be extracted using a pre-trained large language model, such as asking a question: "The following is the scene text of the second scene of the second episode of a TV series script. Please summarize the plot of the scene. The script is: xxxx (the specific content is the scene text of the second scene of the second episode of a TV series script)" Based on the return result of the large language model, the content of the event element dimension of the event description in the scene text of the second scene of the second episode of a TV series script can be obtained.

[0112] In this embodiment, by identifying specific element feature characters, the original text content corresponding to each event element dimension in the appearance text can be accurately identified, which can facilitate the rapid and accurate extraction of the text content of each event element dimension.

[0113] The extraction of event representation depends on the scene event representation model. The following introduces the training process of the scene event representation model, which specifically includes:

[0114] For event description samples of at least a part of the scenes in the sample script, a ternary sample group is determined; based on the ternary sample group, an initial scene event representation model is trained to obtain a scene event representation model.

[0115] The sample script refers to the script used for model training, and the event description sample is the event description text obtained by text reconstruction of each scene text of the sample script according to the event elements. The event description sample carries the event identifier of the event to which the corresponding scene belongs. The ternary sample group includes the event description sample, a positive sample with the same event identifier as the event description sample, and a negative sample with a different event identifier from the event description sample. The positive sample in the ternary sample group and the event description sample constitute a positive sample pair, and the negative sample in the ternary sample group and the event description sample constitute a negative sample pair.

[0116] The event description samples used to construct the ternary sample group may be event description samples corresponding to the full scene text in the sample script, or may be event description samples corresponding to partial scene text in the sample script. For example, partial scene text may be the remaining scene text obtained after eliminating scene text corresponding to meaningless events in the sample script.

[0117] In this embodiment, through the selected event description sample, taking the event description sample as a benchmark, positive samples with the same event identifier as the event description sample and negative samples with different event identifiers from the event description sample are determined respectively, to construct a ternary sample group including positive sample pairs and negative sample pairs, and the ternary sample group is used to train the initial scene event representation model, so that the trained scene event representation model can fully explore the similarities between positive sample pairs belonging to the same event and the differences between negative sample pairs belonging to different events, so that the scene event representation model obtained by full training can improve the expression accuracy of the event representation used to characterize the event to which the scene belongs.

[0118] Each selected event description sample, as one of the components of the three-tuple sample group, also needs to determine a positive sample corresponding to the selected event description sample, as one of the components of the three-tuple sample group, to construct a positive sample pair. In some embodiments, the positive sample is obtained by:

[0119] When an event description sample has an associated sample, the associated sample is determined as a positive sample of the event description sample.

[0120] The associated sample is the same as the event to which the event description sample belongs. Generally, when the event to which the event description sample belongs contains two or more scenes, the event description sample will have an associated sample that is the same as the event to which it belongs. The computer device can select one of the candidate event description samples that is the same as the event to which the event description sample belongs as an associated sample. The candidate event description sample is an event description sample reconstructed based on the scene text of the sample script.

[0121] Specifically, in a specific application, a computer device may use an event description sample that needs to be determined as a positive sample as a target sample, and select another event description sample with the same event identifier as the target sample from a set of event description samples reconstructed from each scene text in the sample script as an associated sample of the target sample.

[0122] In another specific application, a computer device may use an event description sample that needs to be determined as a positive sample as a target sample, determine the target event to which the target sample belongs, then select a target scene from other scenes included in the target event, and then use the event description sample reconstructed based on the scene text of the target scene as an associated sample of the target sample.

[0123] In other embodiments, when the event to which the event description sample belongs contains only one event, the computer device cannot directly obtain a positive sample with the same event identifier as the event description sample. Therefore, the computer device can construct a positive sample that is not completely the same but has a relatively high similarity based on the event description sample. The specific construction method includes:

[0124] When there is no associated sample for the event description sample, part of the content of the event description sample is randomly replaced according to the set probability to obtain a positive sample of the event description sample.

[0125] Part of the content of the event description sample can be a set proportion of content. For example, 10% to 30% of the text content of the event description is randomly extracted and randomly replaced with any other text with a probability of 50% (or other probability values). For example, 30 words are randomly selected from 100 words. For the selected 30 words, there is a 50% probability that they will be replaced with other words, and the remaining 50% probability that they will not be replaced. By randomly replacing part of the content according to the set probability, positive samples with different contents but relatively high similarity can be obtained.

[0126] Through the above method, for the cases where there is only one or more than one event, the corresponding positive samples can be obtained to construct positive sample pairs, and then the corresponding ternary sample groups are constructed, which can improve the event coverage of the ternary sample groups and improve the effectiveness of the model training results.

[0127] In some embodiments, for each selected event description sample, it is also necessary to determine the corresponding negative sample as a component of the ternary sample group to construct a negative sample pair. The better the negative sample selection, the better the event representation effect of the model. Different from the conventional random extraction of negative samples, this application uses static negative samples + dynamic negative samples + default negative samples to generate negative sample pairs for each positive sample to ensure that the negative samples contain both difficult samples and easy samples, thereby improving the training effect of the model.

[0128] In some embodiments, the static negative samples are obtained by:

[0129] When the sample script is a multi-episode script, based on the target episode to which the event description sample belongs in the sample script, the upper and lower episodes whose episode number difference with the target episode is less than the episode number difference threshold are used as the screening intervals to screen out event description samples with different event identifiers from the event description samples as static negative samples.

[0130] Among them, a multi-episode script refers to a script that divides the script into multiple episodes, and then divides each episode into multiple scenes. Each event description sample corresponds to a scene. In a multi-episode script, each scene belongs to one of the episodes. The computer device can determine the target episode to which the event description sample belongs in the sample script based on the scene corresponding to the event description sample. The episode number difference threshold of the difference with the target episode is used to characterize the range of the screening interval.

[0131] Assuming that the target episode is episode 5, taking the episode difference threshold of 2 as an example, the upper and lower episodes are episodes 4 and 6, and taking the episode difference threshold of 3 as an example, the upper and lower episodes are episodes 3-4 and episodes 6-7. In some embodiments, considering that the probability of similar characters appearing in the previous and next episodes is higher, and the previous and next events may have a connection relationship, such as war preparation, war in progress, and celebration banquet are 3 events, at this time, some words in the description of characters, scenes, and events are more likely to be similar, and easily confused negative samples may appear. Therefore, the episode difference threshold can be set to 2, and negative samples can be extracted from the adjacent episodes of the target episode to obtain difficult samples with strong correlation.

[0132] In some embodiments, the default negative sample acquisition method includes:

[0133] During each round of training of the event representation model, training samples with event identifiers different from those of the event description samples are randomly extracted from the training samples of each round as default negative samples.

[0134] The training of the event representation model is implemented in multiple rounds. All training samples can be divided into multiple batches, and each round corresponds to a batch of training samples. In each round of model training, the computer device can randomly extract samples with different event IDs from the target samples from this batch of training samples as default negative samples. The default negative samples are easy samples that are quite different from the target samples.

[0135] In some embodiments, the dynamic negative samples are obtained by:

[0136] After each round of training of the scene event representation model, event representations are extracted from the global event description samples based on the trained scene event representation model, and dynamic negative samples whose event representations are different from the target event representations are randomly selected from the global event description samples.

[0137] The target event representation is the event representation of the event to which the event description sample belongs. Taking the event to which the event description sample belongs as the target event as an example, the event representation of the target event can be obtained by first determining each scene belonging to the target event, and then calculating the average of the event representations of the event description texts corresponding to each scene.

[0138] The global event description sample includes the event description text of each scene in the sample script. Through a new round of training, the scene event representation model has completed the corresponding parameter update and has different event representation extraction capabilities. Based on the trained scene event representation model, the global event description sample is subjected to event representation extraction, which is a test of the event representation extraction capability of the scene event representation model after this round of training. By extracting the event representation of the global event description sample, and then randomly selecting some event description samples whose event representations are different from the target event representation from the global event description sample as dynamic negative samples, the dynamic negative samples are difficult samples that are relatively small in difference from the target samples, and can effectively optimize the parameters of the model training process in a targeted manner.

[0139] In one of the embodiments, the number of various types of negative samples can be controlled to achieve a balanced distribution of difficult and easy samples. Specifically, both static negative samples and dynamic negative samples are difficult samples, and the default sample is an easy sample. For example, the sum of the number of static negative samples and dynamic negative samples is the first number, and the number of default negative samples is the second number. During the sample extraction process of the computer device, the difference between the first number and the second number can be limited to be less than a set threshold, that is, the first number and the second number remain substantially the same, thereby achieving a balanced distribution of difficult and easy samples.

[0140] In a specific application, the method for extracting static negative samples can be to determine other events different from the event to which the positive sample belongs from the three episodes before and after the episode where the positive sample is located in the offline stage, and then randomly select k1 (such as k1=3) scenes from the scenes included in other events as negative samples, so as to extract static negative samples from samples of adjacent episodes.

[0141] The default method of extracting negative samples is: during training, k2 (eg, k2=6) samples with different event IDs are randomly selected from the training samples of each round as negative samples.

[0142] The method for extracting dynamic negative samples is as follows: after a round of model training is completed, the trained model is used to extract event representations of samples from all global sessions, the average representation of all samples under each event is calculated, and other 10 event IDs with different event IDs are extracted from the event representation of the global samples, and k3 (e.g. k3=3) samples are randomly selected from the sessions of these 10 event IDs as negative samples.

[0143] In the process of extracting three types of negative samples, the relationship between k1, k2, and k3 can be controlled to roughly satisfy: k1+k3=k2, that is, to ensure the balance between difficult samples and easy samples. The above-mentioned static negative samples can be generated before training, and the default negative samples and dynamic negative samples can be generated while the model is being trained.

[0144] In some embodiments, Figure 7 As shown, the scene event representation model can be applied to the plot analysis scenario of script events. Specifically, the computer device obtains the script of a certain episode, extracts the event information from the scene text in the script according to the event elements, and forms an event description text. Then, the scene event representation model is used to extract the event representation of each scene, and then the scene events are aggregated based on the extracted event representation, so as to obtain episode events and full-play dimension events, and finally the event script is analyzed in more required dimensions. Among them, the scene event representation model is the main processing tool for event representation extraction. The following introduces the process of using ternary sample groups to train the scene event representation model in combination with the structure of the scene event representation model:

[0145] The scene event representation model includes a pre-trained text-based understanding module and an event representation embedding module; the initialization parameters of the event representation embedding module are the same as the pre-trained parameters of the last layer in the text-based understanding module.

[0146] The structure of the event representation model mainly includes two modules: the text understanding basic module and the event representation embedding module. Among them, the text understanding basic module is based on the Chinese-BERT-wwm model. BERT is an open source language model that uses large-scale language data for pre-training. It can support language understanding tasks with different objectives and produce text learning task results by fine-tuning on this basis. Figure 8 This is an example of fine-tuning BERT using the BERT network structure for language tasks, where CLS is the category of the sentence. In some embodiments, since only specific information needs to be input and event representation needs to be output, and the task is single, TOK1~N can be set to empty. Sep is used to distinguish between task questions and specific question content. Paragraph is the answer paragraph that needs to be answered.

[0147] Specifically, the specific structure of BERT is as follows Fig. 9 As shown in the figure, it includes the embedding process from input text to the generated vector E. The core of BERT model consists of multiple encoder layers (transformer encoder layer). Each encoder layer consists of multiple encoder groups (transformer block, also known as Trm), with T layer as the target classification task output. For ease of description, Fig. 9 Only two encoder layers are shown. In some practical applications, the number of BERT encoder layers is L=12, the hidden layer dimension is H=768, and the number of multi-head self-attention heads is A=12. Fig.10 Fig. 9The specific structure of Trm in BERT is the encoder, Multi-head attention is the selfattention module, FeedForward is the intermediate layer module, and Add&Norm represents the addition operation and layer normalization.

[0148] In the specific structure of Multi-head attention, the operation of the add&Norm layer is to first sum the input of the previous layer (such as the FeedForward layer or the Multi-head attention layer) with the input of this layer and then calculate the layer normalization. It can be specifically expressed as: hidden_states = self.LayerNorm(hidden_states + input_tensor).

[0149] The feedforward module consists of a fully connected layer + an activation layer.

[0150] Among them, the multi-head-attention module has been integrated into BERT as a general tool and can be called directly. Taking the call of the paddle library as an example, the calling method is:

[0151] MultiHeadAttention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=config.attention_probs_dropout_prob)

[0152] Furthermore, based on the ternary sample group, the initial scene event representation model is trained to obtain the scene event representation model, including:

[0153] Based on the Chinese dictionary, dictionary mapping is performed on each sample in the triple sample group to obtain the embedding vector corresponding to each sample; based on the embedding vector carrying the event identifier, the text basic understanding module and the event representation embedding module in the initial scene event representation model are trained to obtain the output event representation; based on the model loss corresponding to the event representation, the initial scene event representation model is iteratively trained until the training stop condition is met to obtain the scene event representation model.

[0154] Among them, the initialization parameters of the event representation embedding module are the same as the pre-training parameters of the last layer in the text basic understanding module.

[0155] Specifically, the input of the event representation model is the four elements of the event text. For the event text, the text content is spliced ​​from beginning to end in the order of the extracted time, place, person, and event. The spliced ​​event description text is used as a sentence, and the sentence is input into the Chinese dictionary for dictionary mapping. Dictionary mapping can be understood as that for each word, there are one or more embedding vectors (called dictionary embeddings) corresponding to it in the dictionary space. Among them, the Chinese dictionary is generated based on statistical learning of Chinese expressions. In model training, the dictionary embedding of the sentence is directly generated through the dictionary mapping of the Chinese dictionary, and there is no need to train the relevant parameters of the dictionary embedding process.

[0156] Specifically, if Fig.11 As shown in the figure, the sentence corresponding to the description text is used as input, and the process of mapping to dictionary embedding includes: first using the dictionary vocab.txt, mapping each word in the sentence to the corresponding dictionary id (called tokenid). In order to have a standardized model input so that it can respond to sentence inputs of different lengths, token=0 is used as the completion to a specified number of tokens (such as 77), and then the embedding of the dictionary id is used as the word embedding to obtain the embedding vector embedding of the entire sentence.

[0157] In a specific application, such as Fig.12 The figure shows a schematic diagram of the training process of the scene event representation model. First, the scene text of the sample script is obtained, and the scene text is reconstructed according to the event elements to obtain the event description sample corresponding to the scene text. Then, the event description sample is labeled with the event identifier according to the event to which the scene belongs, so as to determine the positive and negative sample pairs according to the event identifier to construct the triple sample, and the model is trained based on the triple sample. During the training process, dictionary mapping is first performed based on the Chinese dictionary to obtain the embedding vector of the input text, and then the text understanding is performed based on the text basic understanding module. Finally, the event representation embedding module outputs the event representation corresponding to the event description sample. Based on the distance between the event representations between the triples, the model loss is calculated to iteratively train the model.

[0158] Specifically, the event representation embedding module is a new module added to the conventional BERT model, which consists of N layers of Trm. For the text understanding basic module and event representation embedding module in this model, considering that the basic module has pre-trained parameters, while the parameters of the newly added Trm are not trained, in order to improve the model convergence performance, the last layer of Trm pre-training parameters of the text basic understanding module are used as the initialization parameters of the Trm parameters of the event representation embedding module. Among them, the Trm structure of the event representation embedding module is the same as the last layer of Trm structure in the text basic understanding module. The output result of the event representation embedding module can be understood as the event representation of the input sentence.

[0159] In this embodiment, dictionary mapping is performed on the input triple sample through the Chinese dictionary to obtain the embedding vector for model training. On the one hand, it can realize the rapid generation of the embedding vector of the input text, improve the vectorization processing speed of the input text, and accelerate the model training process. On the other hand, through the unification of the pre-trained parameters in the event representation embedding module and the text basic understanding module, the pre-trained text basic understanding module and the untrained event representation embedding module can be effectively spliced, thereby improving the convergence performance of the model.

[0160] In a specific application, the training of the event representation model includes several stages: parameter initialization, setting learning parameters, learning process and iterative update. Specifically:

[0161] Parameter initialization process: The Chinese-BERT-wwm pre-trained model is used for the basic text understanding module, and the pre-trained parameters of the basic text understanding module are used to initialize the parameters of the event representation embedding module and the classification head.

[0162] The process of setting learning parameters: The learning rate of the basic text understanding module is 0.0005, and the training is carried out using the SGD gradient update method. The learning rate of the event representation embedding module is 0.001, and the training is carried out using the SGD gradient update method. The learning rate is reduced to 0.1 times the original value every 10 epochs.

[0163] Learning process: For all positive sample pairs (a total of N data), every X data is regarded as a batch, with a total of N / X batches. Each completion of N / X batches represents the completion of one epoch of iterations. For the X positive sample pairs, static triplet data is generated, and default negative samples are generated based on the X positive sample pairs in this round to form default triples. Then, dynamic triples are generated based on the representation effect of the model on the full data. Three sets of triplet sample data are combined to obtain the final training samples of this batch.

[0164] Iteration process: Each round of iteration processes all samples until the average epoch loss no longer decreases in a certain epoch. In the forward pass of the model, each batch of training data is input into the model to obtain the final output, and then the corresponding triple loss is calculated. In the backward pass of the model, the total loss is passed back to the network to calculate the gradients of each network parameter. Then, according to the gradients of each parameter, the parameters of the model network are updated.

[0165] In one embodiment, the model loss is a triplet loss; the calculation method of the triplet loss includes:

[0166] A first distance between respective event representations of a pair of positive samples and a second distance between respective event representations of a pair of negative samples in the triplet sample are respectively obtained; and a triplet loss is determined based on a distance difference between the first distance and the second distance.

[0167] The triplet samples can constitute positive sample pairs and negative sample pairs. The distance between the event representations corresponding to the two samples in the positive sample pair should be as small as possible, and the distance between the event representations corresponding to the two samples in the negative sample pair should be as large as possible. In one embodiment, the triplet loss is calculated using the triplet loss, and the calculation formula of the triplet loss is as follows:

[0168] L triplet =max(||Q a -Q p ||-||Q a -Q n ||+α, 0)

[0169] Where α is the minimum distance between the distances of positive samples and the distances of negative samples. ‖Q a -Q p ‖ represents the distance between the two event representations of the positive sample pair in the triplet, ‖Q a -Q n ‖ represents the distance between the two event representations of the negative sample pair in the triplet. The purpose of Triplet-loss is to make the distance between the positive sample pairs and the distance between the negative sample pairs greater than α.

[0170] In this embodiment, by calculating the triplet loss and using the triplet loss as a basis for model iteration, the trained scene event representation model can effectively distinguish scenes belonging to different events through accurate event representation, thereby improving the application accuracy of the scene event representation model.

[0171] In one embodiment, based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event, including:

[0172] Based on the test set for the scene event representation model, the accuracy and recall of the scene event representation model are determined; based on the accuracy and recall, the decision threshold of the scene event representation model for event representation is determined; based on the decision threshold, based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine the set of scenes belonging to the same event.

[0173] Specifically, after the scene event representation model obtains the event representation of each scene, it aggregates the event representation to obtain the relationship between the event and the scene, such as the scene span of the same event in the same episode, and the span of the same event in different episodes. When the scenes corresponding to the event description text are aggregated, for the event representation, by setting the decision threshold, the aggregation processing of the scenes can be achieved more efficiently.

[0174] The method for obtaining the decision threshold can be determined by the test set of the scene event characterization model. Among them, the test set can be an additionally prepared test set or a test set obtained by using the training set. For the positive sample pairs in the test set and the negative sample pairs composed of static negative samples, the Euclidean distance is divided into 20 values ​​from 0 to 1 with a step size of 0.05, and one of the values ​​is used as the threshold to determine whether the sample pairs in the test set are the same event: when the Euclidean distance of the two samples is greater than the Euclidean distance threshold, it means that the two scene event samples are different events. Based on the judgment result, the accuracy p and recall r of the judgment result are calculated when the value is used as the threshold, and F1=1 / (1 / r+1 / p). By calculating the corresponding F1 for each of the 20 values, the value with the largest F1 is selected as the decision threshold. Based on the decision threshold, the scenes corresponding to the event description text are aggregated to determine the scene set belonging to the same event.

[0175] In this embodiment, the accuracy and recall rates under different candidate decision thresholds are calculated by using the positive and negative sample pairs in the test set to screen the decision threshold. By setting the decision threshold to distinguish the events to which the event representation belongs, the scenes in the script can be aggregated in the event dimension more efficiently. Fig.13 The results of event aggregation based on the decision threshold for each session can be found in Fig.14 For example, for the first episode of a drama, scenes 1 to 4 belong to event 1, scenes 5 and 8 belong to event 2, scene 9 belongs to event 3, scenes 10 and 12 belong to event 4, scene 11 belongs to event 5, scenes 14 to 16 belong to event 6, scenes 17 and 23 belong to event 7, scenes 24 to 26 belong to event 8, and scenes 27 to 29 belong to event 9. Among them, scenes 6, 7, and 18 to 22 are flashback events.

[0176] In one embodiment, the target script is a multi-episode script including multiple episodes. Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event, including:

[0177] Based on the event representation corresponding to each scene in the scene set, a target representation of the event represented by the scene set is determined; according to the episode arrangement order of the target script, the events contained in the latter episode and the events contained in the previous episode are forward merged according to the Euclidean distance between the target representations, until the forward merging of the events of the last episode of the target script is completed, so as to obtain a scene set belonging to the same event in the target script.

[0178] Specifically, the aggregation of scenes includes the aggregation of scenes in the same episode and the aggregation of scenes across episodes. To further improve the aggregation efficiency, scene aggregation can be performed on each episode separately to obtain the events contained in each episode. Then, by aggregating the events contained in different episodes, all events contained in the entire target script can be obtained, and the set of all scenes belonging to the same event in the target script can be obtained.

[0179] In a specific embodiment, for an event consisting of multiple scenes in each episode, the average of the event representations of all scenes belonging to the event is taken as the target representation. Starting from the second episode, events are merged by tracing back to the previous episode, that is, for the target representation of a certain event in the second episode, the Euclidean distance between it and all target representations in the first episode is calculated. When the threshold requirement is met, if there are multiple events that meet the conditions, the event in the first episode with the closest Euclidean distance is merged with the event in the second episode, until the last episode and the penultimate episode complete the event merging, and all events of the target script can be obtained.

[0180] In this embodiment, for scripts with a large number of episodes and scenes, the amount of data to be aggregated can be effectively reduced by aggregating them in order of episodes, thereby improving resource utilization and the accuracy of aggregation results.

[0181] In some of these embodiments, events in the script include recall events and non-recall events.

[0182] The aggregation process of events contained in each episode includes:

[0183] For each episode, the recalled scenes, non-recalled scenes and meaningless scenes in the episode are identified; the meaningless scenes are eliminated; the recalled scenes are aggregated according to the event representation to obtain recalled events; the non-recalled scenes are aggregated according to the event representation to obtain non-recalled events.

[0184] For an episode in the target script, determine whether the scene is meaningful or meaningless based on the length of the scene content. For example, when the text content is less than 15 words, it can be determined that the scene is a meaningless scene such as an empty shot, and the meaningless scene is eliminated. For meaningful scenes, the recollection scenes and non-recollection scenes in the episode are identified by identifying similar prompt words such as flashbacks in the scene header information. Specifically, for the non-recollection scenes of the episode, after obtaining the event representation of each scene, scene event aggregation is performed to obtain non-recollection events. Among them, the scene event aggregation can determine the event to which the scene belongs through the judgment threshold in the above embodiment. For the recollection scenes or flashback scenes of the episode, the scene events are also merged to obtain recollection events.

[0185] In this embodiment, by identifying recalled scenes, non-recalled scenes and meaningless scenes and eliminating meaningless scenes, it is possible to avoid interference of meaningless events on event aggregation results. By identifying recalled scenes and non-recalled scenes, it is possible to distinguish recalled events from non-recalled events, thereby improving the accuracy and efficiency of scene aggregation.

[0186] In other embodiments, the identification of meaningless sessions may also be achieved by other methods, for example, Fig.15 As shown in the figure, in the above event representation embedding model, the [CLS] in the last layer output of the event representation embedding module is used as the classification head to learn whether the four elements of the event description text have event classification. For samples with event id -1 in the training set annotation, CLS is 0, indicating no event. For samples with event id not -1, CLS is 1, indicating a valid event. When training event representation, the valid event classification head is also trained.

[0187] The training method can be the same as the above training method, but the classification loss needs to be added as loss2 when calculating the loss. The classification loss can be the cross entropy loss L of the two classifications. class , the loss function expression is as follows:

[0188] Where y is the sample label. If it is a valid event, the label is 1, and if it is an invalid event, the label is 0. p is the predicted probability, and m is the number of samples. For samples predicted to be 1, the item y[i]*log(p[i]) takes effect. For samples predicted to be 0, the item (1-y[i])*log(1-p[i]) takes effect.

[0189] In this embodiment, by adding a classification head to the model to identify meaningless scenes, the recognition function of meaningless scenes can be integrated into the same model, simplifying the process complexity of the entire processing process.

[0190] In one embodiment, the events represented by each scene set are associated to obtain the plot content of the target script, including:

[0191] Obtain the plot analysis requirements for the target script; when the plot analysis requirements are brief event descriptions, extract the event highlights corresponding to each event in the target script in turn according to the correlation between the events represented by each scene set; when the plot analysis requirements are detailed event descriptions, generate the plot summary corresponding to each event in the target script in turn according to the correlation between the events represented by each scene set.

[0192] Among them, for multiple episodes of the script, after obtaining the events of the target script, the script plot is output, such as Figure 4 and Figure 5 For each event, the event description can be output through the pre-trained large language model. In this embodiment, the event highlights corresponding to each event in the target script and the plot summary corresponding to each event in the target script can be output on demand through the plot analysis requirements, so as to improve the automatic script understanding effect from the event dimension and perform event dimension script understanding based on the user's needs for watching the drama.

[0193] In one of the embodiments, the method also includes: identifying the protagonist for each event represented by each scene set to obtain a protagonist identification result; responding to a protagonist emotion analysis request for the target script, analyzing the emotion changes of the protagonist in the target script according to the protagonist identification result of each event to obtain a protagonist emotion change trend analysis result; responding to a protagonist character setting analysis request for the target script, analyzing the protagonist character setting changes in the target script according to the correlation between the events based on the understanding of the script events for each event to obtain a character setting development analysis result.

[0194] For example, using a pre-trained large language model, input "The following is a text description of several scenes in a certain event in a certain script. Please use 50 words to briefly summarize what happened between the hero and the heroine." Fig.14 In a certain episode, the output style is as follows:

[0195] Recall the plot: The hero was hospitalized due to illness and the heroine took good care of him. The two fell in love. When the hero found out that the heroine had cheated on him, he broke up with her.

[0196] Event 1 plot: Description of the scene where the hero and the heroine meet for the first time.

[0197] Event 2 plot: Description of the scene where the hero and the heroine meet for the second time.

[0198] In this embodiment, the identification of the protagonist can be obtained from the basic ability of script understanding. Introducing the protagonist can make the content of script understanding focus on the protagonist rather than any arbitrary characters and events. To avoid the situation where the output results of automated script understanding are stacked and the main and secondary are not distinguished, the event extraction method is adopted to aggregate events from the smallest granularity of the script, and the emotional changes and personality development changes of the characters are sorted out according to the event extraction plot description, so as to improve the overall comprehensibility of the final plot description.

[0199] The present application also provides an application scenario, and the application scenario applies the above-mentioned script processing method. Specifically, the application of the script processing method in the application scenario is as follows:

[0200] Production companies receive a lot of film and television scripts every day. For scripts with dozens of episodes and hundreds of thousands of words, how to quickly understand the content of each episode of each script will help production companies quickly evaluate the value of the script. With the support of today's generative artificial intelligence large language model, creation is easier and more universal. It is very important to quickly automate the plot understanding of each episode of the script. The basic goal of the script is to explain the theme of the script based on the events in the script, the behavioral choices of the main characters and their development trajectory. At the script understanding level, it is necessary to first understand the events that occurred in the script. Under the goal of automated plot event understanding, the actual problems are: the text content of each episode of the script is too long and it is difficult to effectively understand the plot of the episode events. If the script event is understood based on the smallest description unit of the script-scene, too many events will be generated. At the same time, because one event may span multiple events, it is different from the event unit understood by humans, resulting in the script understanding being too fragmented and unable to reach the level of human understanding of events. If the script event is extracted from the main scenes instead of the entire episode, it is easy to cause the plot to be incoherent, which is not conducive to understanding.

[0201] In order to solve the problem of script comprehension caused by the poor extraction of episode events in existing scripts, this solution designs a script event aggregation capability based on event representation. First, the event-related information of all scenes in each episode of the script is obtained, and the event representation model is learned through extensive data enhancement for the event representation of the open episode script; finally, the event representation is applied to aggregate the events of each episode and across episodes, so as to obtain the event granularity scene aggregation that humans can understand, so as to ensure the validity and completeness of the events in the subsequent plot understanding, and avoid too many and trivial events in the plot understanding output. Among them, event splitting from multiple scene texts is a major difficulty. Since the scene order may be inconsistent with the event order, and the event definition is quite subjective, conventional plot events are manually marked. In order to solve the problem of difficult script event representation, this solution designs an event representation method based on time, place, person, and event information to achieve high-accuracy event representation; and through effective event representation, event aggregation is performed to generate event organization of episode scripts, thereby realizing subsequent applications such as episode plot output.

[0202] Specifically, to address the problem of piling up all the scenes and causing the content to be stacked without distinguishing the main from the secondary, we use event extraction to aggregate events from the smallest granularity of the script, and extract plot descriptions based on events, thereby improving the overall comprehensibility of the final plot description. We design a more effective event representation method for scene aggregation, improve the event representation effect through joint representation learning of important factors such as time, characters, and events in the script events, and finally use joint event representation to divide the script scenes by event aggregation.

[0203] Taking the actual application scenario as an example, the role of aggregating script scenes by event is mainly to better organize and understand the content of the script, improve the readability of the script and the efficiency of production, such as quickly understanding the script events, producing a short and concise description of the highlights of each episode, or outputting a plot summary for each event. In addition, aggregating multiple episodes of script scenes and associating events can more effectively manage and schedule resources. For example, determine which scenes can be shot simultaneously using the same scene, such as when merging multiple scenes into the same event, or when the event types are all workplace, they can be arranged to be shot simultaneously at the same location, or which scenes require specific actors or objects, such as shooting on a street with different characters, such as the protagonist and the antagonist. At this time, after shooting the protagonist, you can directly use the same scene to shoot the antagonist, and shoot different characters in the same scene at the same time for two scenes to improve shooting efficiency.

[0204] The first part is about the implementation principle of the embodiment of the present application:

[0205] For multiple scripts with one script file for each episode, determine the text content of each scene and obtain the relevant information of each scene event; then extract event representation based on the provided scene event representation model, aggregate scenes based on event representation, obtain scene events for each episode and events in the entire drama dimension, so as to realize subsequent application of events.

[0206] Among them, regarding the representation of session time, since it is necessary to solve the problem of open set event representation, that is, it is impossible to pre-standardize and agree on which events will occur, and it is impossible to use closed set event classification methods to evaluate session events, a more general event representation method is needed. This solution uses the session event representation model solution to learn event representation metrics. The following introduces the involved session event representation model.

[0207] In this application, for events in the script, considering that the key elements of an event are: time, place, characters, and events, in order to improve the accuracy of event representation, the four elements need to be included in the scene text information. In addition, the scene events need to be marked, that is, which scenes belong to the same event, etc.

[0208] The second part is the extraction of four elements of the model's input data and event annotation.

[0209] For the scene text of the script, it is necessary to determine the text content of the four elements of time, place, characters and events.

[0210] Scene event information 1 extraction: First, in order to obtain more effective event representation, the four elements related to the event need to be extracted from the scene: time, place, characters, and events. For the script text, "time, place, and characters" can be directly obtained from the relevant content of the scene header. Considering that some scripts do not have the "scene, time, and people" scene header information, it is necessary to extract it from the scene description. The extraction method is: use the pre-trained large language model for extraction, such as asking a question: "What are the time, place, and characters of the following script events? Return in json format, and the return style is as follows: {'time':'night', 'place':'hotel', 'character':'Xiaowen'}, the script is: xxxx".

[0211] Scene event information 2 extraction: Regarding the “events” of the four elements, since the script is not provided in advance, and the overall script plot understanding application system will pre-generate the plot of each scene, the scene plot can be used as an event description in the scene event generation module, so that no additional application cost is added to the overall application system. The scene plot is extracted using a pre-trained large language model, such as asking a question: "The following is a scene in a TV drama script. Please summarize the plot of the scene. The script is: xxxx".

[0212] When training the model, the training samples need to be labeled with events first to clearly identify the events belonging to the same event.

[0213] Considering that this scheme requires metric learning of open-set event representation, and since open-set events cannot be exhaustive, the model adopts metric learning. It is necessary to collect whether the events are of the same event as training positive and negative sample pairs. The positive samples are samples of the same event, and the negative samples are samples of different events. The metric relationship between positive and negative samples is used as the training basis.

[0214] In order to ensure the consistency of training and application effects, data annotation requires preparation of single-episode event annotation and cross-episode event annotation. Among them, single-episode event annotation is based on the episode as a unit, and for all the scenes of each episode, the four elements of time, place, characters and events are marked to indicate whether they are the same event. Cross-episode event annotation: Considering that sometimes an event in the script spans two episodes, for all events in the three episodes, if there is the same event across episodes, the events are merged, that is, the corresponding annotation records in the two events use the same event id. For example, in a certain war, a scene in the first episode talks about the commander's tense arrangements, and a scene in the second episode talks about a soldier's small actions of storing food and preparing to escape. The two scenes belong to the same event, but span the two episodes and need to be merged.

[0215] In specific applications, by giving the four elements of an event for the scene text, it is also helpful for the annotator to quickly determine whether two scenes are the same event. For example, when two scenes are the same event, the scenes are generally the same or similar, and the characters and time are also similar. In one embodiment, the following annotation information is obtained for each scene: scene text information, event id, TV series name, episode id, scene id, where the event id is 1, 2, 3, etc., representing the codes of different events, the episode id refers to episodes 1, 2, 3, etc., and the scene id refers to the scene codes of 1, 2, 3, 4, etc., representing the different occurrence orders of events in a certain episode of the script. When there is no event in a scene, such as an empty city shot used for transition, no characters appear, and the event id is -1, indicating no event.

[0216] The second part is the description of the model training samples, model structure and training process.

[0217] First, we introduce metric learning sampling of model training samples.

[0218] Since open-set events cannot be classified, when using metric learning to represent events, a relatively general event representation is needed to cover various types of events, such as tomb robbery, swimming in the sea, encounters in hospitals, roadside fights for children, etc. The event representation of metric learning is very dependent on the selection of positive and negative samples. Appropriate positive and negative samples can make the later event aggregation more effective. Consider the following reasons: In the application, all scenes in each episode are aggregated, and the event may span two episodes; the positive samples of the scene events are manually labeled, and one event may contain multiple scenes; the closer the negative samples are to the actual situation and the more difficult samples are, the more accurate the event representation is, which is more helpful for later event aggregation.

[0219] In one embodiment, when generating positive sample pairs in metric learning triples: for events with more than 1 session (such as an event with 3 sessions): every two sessions form a positive sample pair, and all positive sample pairs are obtained. For events with only 1 session, 10% to 30% of the text content of the session text description is randomly extracted, and randomly replaced with any other text with a probability of 50%, and a total of N positive sample pairs are obtained. For example, 30 words are randomly selected from 100 words, and for the aforementioned 30 words, there is a 50% probability that they will be replaced with other words, and the remaining 50% probability that they will not be replaced.

[0220] The better the negative sample selection, the better the event representation effect of the model. Different from the conventional random extraction of negative samples, this embodiment uses a static + dynamic + default method to generate negative sample pairs for each positive sample.

[0221] Generate negative samples: The static negative sample extraction method is an offline stage. After the positive sample pair is determined, random k1 (such as 3) scenes under other event IDs of the same TV series to which the positive sample belongs, including the previous and next 3 episodes, are selected. Considering that the probability of similar characters appearing in the previous and next episodes is higher, and the previous and next events may have a connection relationship (such as war preparation, war in progress, and celebration banquet belong to 3 events), some words in the descriptions of characters, scenes, and events are more likely to be similar, so it is easy to have confusing negative samples, so negative samples are extracted from adjacent episodes.

[0222] The default method of extracting negative samples is: during training, k2 (eg, k2=6) samples with different event IDs are randomly selected from the training samples of each round as negative samples.

[0223] The method for extracting dynamic negative samples is as follows: after a round of model training is completed, the trained model is used to extract event representations of samples from all global sessions, the average representation of all samples under each event is calculated, and other 10 event IDs with different event IDs are extracted from the event representation of the global samples, and k3 (e.g. k3=3) samples are randomly selected from the sessions of these 10 event IDs as negative samples.

[0224] In the process of extracting three types of negative samples, the relationship between k1, k2, and k3 can be controlled to roughly satisfy: k1+k3=k2, that is, to ensure the balance between difficult samples and easy samples. The above-mentioned static negative samples can be generated before training, and the default negative samples and dynamic negative samples can be generated while the model is being trained.

[0225] Secondly, the structure of the model is introduced.

[0226] The structure of the event representation model mainly includes two modules: the text understanding basic module and the event representation embedding module. Among them, the text understanding basic module is based on the Chinese-BERT-wwm model. BERT is an open source language model that uses large-scale language data for pre-training. It can support language understanding tasks with different objectives and produce text learning task results by fine-tuning on this basis. Figure 8 Examples of BERT fine-tuning using the BERT network structure in three different language tasks, where CLS is the category of the sentence. In some embodiments, since only specific information needs to be input and event representation needs to be output, and the task is single, TOK1~N can be set to empty. Sep is used to distinguish between task questions and specific question content. Paragraph is the sentence that needs to answer the question.

[0227] Specifically, the specific structure of BERT is as follows Fig. 9 As shown in Figure 1, it includes the embedding process from input text to the generated vector E. BERT is a model core composed of multiple encoder layers. Each encoder layer consists of multiple encoder groups (transformer blocks, also known as Trm), with T layer as the target classification task output. For ease of description, Fig.10 Only two encoder layers are shown. In some practical applications, the number of BERT encoder layers is L=12, the hidden layer dimension is H=768, and the number of multi-head self-attention heads is A=12. Fig.10 Fig. 9 The specific structure of Trm, where BERT's Trm can be an encoder, where Multi-head attention is the selfattention module, FeedForward is the intermediate layer module, and Add&Norm represents the addition operation and layer normalization.

[0228] In the specific structure of Multi-head attention, the operation of the add&Norm layer is to first sum the input of the previous layer (such as the FeedForward layer or the Multi-head attention layer) with the input of this layer and then calculate the layer normalization. It can be specifically expressed as: hidden_states = self.LayerNorm(hidden_states + input_tensor).

[0229] The feedforward module consists of a fully connected layer + an activation layer.

[0230] Among them, the multi-head-attention module has been integrated into BERT as a general tool and can be called directly. Taking the call of the paddle library as an example, the calling method is:

[0231] MultiHeadAttention(embed_dim=config.hidden_size, num_heads=config.num_attention_heads, dropout=config.attention_probs_dropout_prob)

[0232] Next, let’s talk about the input and output data of the model.

[0233] The input of the event representation model is the four elements of the event text. For the event text, the text content is spliced ​​from beginning to end in the order of the extracted time, place, person, and event. The spliced ​​event description text is used as a sentence, and the sentence is input into the Chinese dictionary for dictionary mapping. Dictionary mapping can be understood as that for each word, there are one or more embedding vectors (called dictionary embeddings) corresponding to it in the dictionary space. Among them, the Chinese dictionary is generated based on the statistical learning of Chinese expressions. In the model training, the dictionary embedding of the sentence is directly generated through the dictionary mapping of the Chinese dictionary, and there is no need to train the relevant parameters of the dictionary embedding process.

[0234] Specifically, if Fig.11As shown in the figure, the sentence corresponding to the description text is used as input, and the process of mapping to dictionary embedding includes: first using the dictionary vocab.txt, mapping each word in the sentence to the corresponding dictionary id (called tokenid). In order to have a standardized model input so that it can respond to sentence inputs of different lengths, token=0 is used as the completion to a specified number of tokens (such as 77), and then the embedding of the dictionary id is used as the word embedding to obtain the embedding vector embedding of the entire sentence.

[0235] In a specific application, such as Fig.12 The figure shows a schematic diagram of the training process of the scene event representation model. First, the scene text of the sample script is obtained, and the scene text is reconstructed according to the event elements to obtain the event description sample corresponding to the scene text. Then, the event description sample is labeled with the event identifier according to the event to which the scene belongs, so as to determine the positive and negative sample pairs according to the event identifier to construct the triple sample, and the model is trained based on the triple sample. During the training process, dictionary mapping is first performed based on the Chinese dictionary to obtain the embedding vector of the input text, and then the text understanding is performed based on the text basic understanding module. Finally, the event representation embedding module outputs the event representation corresponding to the event description sample. Based on the distance between the event representations between the triples, the model loss is calculated to iteratively train the model.

[0236] Specifically, the event representation embedding module is a new module added to the conventional BERT model, which consists of N layers of Trm. For the text understanding basic module and event representation embedding module in this model, considering that the basic module has pre-trained parameters, while the parameters of the newly added Trm are not trained, in order to improve the model convergence performance, the last layer of Trm pre-training parameters of the text basic understanding module are used as the initialization parameters of the Trm parameters of the event representation embedding module. Among them, the Trm structure of the event representation embedding module is the same as the last layer of Trm structure in the text basic understanding module. The output result of the event representation embedding module can be understood as the event representation of the input sentence.

[0237] The training of the event representation model includes several stages: parameter initialization, setting learning parameters, learning process and iterative update. Specifically:

[0238] Parameter initialization process: The Chiinese-BERT-wwm pre-trained model is used for the basic text understanding module, and the pre-trained parameters of the basic text understanding module are used to initialize the parameters of the event representation embedding module and the classification head.

[0239] The process of setting learning parameters: The learning rate of the basic text understanding module is 0.0005, and the training is carried out using the SGD gradient update method. The learning rate of the event representation embedding module is 0.001, and the training is carried out using the SGD gradient update method. The learning rate is reduced to 0.1 times the original value every 10 epochs.

[0240] Learning process: For all positive sample pairs (a total of N data), every X data is regarded as a batch, with a total of N / X batches. Each completion of N / X batches represents the completion of one epoch of iterations. For the X positive sample pairs, static triplet data is generated, and default negative samples are generated based on the X positive sample pairs in this round to form default triples. Then, dynamic triples are generated based on the representation effect of the model on the full data. Three sets of triplet sample data are combined to obtain the final training samples of this batch.

[0241] Iteration process: Each round of iteration processes all samples until the average epoch loss no longer decreases in a certain epoch. In the forward pass of the model, each batch of training data is input into the model to obtain the final output, and then the corresponding triple loss is calculated. In the backward pass of the model, the total loss is passed back to the network to calculate the gradients of each network parameter. Then, according to the gradients of each parameter, the parameters of the model network are updated.

[0242] For the triplet sample group, the triplet loss is used to calculate the triplet loss. The calculation formula of the triplet loss is as follows:

[0243] L triplet =max(||Q a -Q p ||-||Q a -Q n ||+α, 0)

[0244] Where a is the minimum margin between the distance between positive samples and the distance between negative samples. ‖Q_a-Q_p‖ represents the distance between the two event representations of the positive sample pair in the triplet, and ‖Q_a-Q_n‖ represents the distance between the two event representations of the negative sample pair in the triplet. The purpose of Triplet-loss is to make the distance between the positive sample pair and the distance between the negative sample pair greater than the margin.

[0245] Finally, the scene event representation model is applied.

[0246] After obtaining the event representation of each scene through the scene event representation model, the relationship between each episode of events and scenes, such as the scene span of the event, is obtained based on the event representation aggregation.

[0247] Specifically, first obtain the decision threshold: an additional sample set or a test set using the training set as the model, for the positive sample pairs in the test set, and the negative sample pairs composed of static negative samples, the Euclidean distance is divided into 20 values ​​from 0 to 1 with a step size of 0.05, and one of the values ​​is used as the threshold to determine whether the sample pairs in the test set are the same event: when the Euclidean distance of the two samples is greater than the Euclidean distance threshold, it means that the two event samples are different events. Based on the judgment result, the accuracy p and recall r of the judgment result are calculated when the value is used as the threshold, and F1=1 / (1 / r+1 / p). The corresponding F1 is calculated for each of the 20 values, and the value with the largest F1 is selected as the decision threshold. Based on the decision threshold, the events corresponding to the event description text are aggregated to determine the set of events belonging to the same event.

[0248] Then, the scene events are obtained, and the scene event merge is generated according to the above judgment threshold. For a certain episode, the non-recall scenes of the episode are determined by the presence of similar prompts such as flashbacks in the scene header information. After the event representations of each scene are obtained, the scene event merge is generated according to the above judgment threshold. Similarly, the scene events of a certain episode of recall are merged. Eliminate independent meaningless events: According to the length of the scene content, when the text content is less than 15 words, remove the scene.

[0249] It should be noted that, when distinguishing valid events, in addition to direct judgment based on conditional logic based on experience, model classification methods can also be used to classify valid and invalid samples. And when a classification model is used to judge the validity of an event, a binary classification model for event validity can be trained independently, or the event validity classification can be directly used as a multi-task output in the output of the event representation module on the model of this solution to reduce the application cost. For example, in the above-mentioned event representation model, [CLS] in the last layer output of the event representation module is used as the classification head to learn whether the four elements of the event have an event. For samples with an event id of -1 in the training set annotation, CLS is 0, indicating no event. For samples with an event id other than -1, CLS is 1, indicating a valid event. When training event representation, the valid event classification head is trained at the same time. The training method can be consistent with the training method of the above-mentioned event representation model, but the classification loss needs to be added as loss2 when calculating the loss. The classification loss can specifically be the cross entropy loss Lclass of the binary classification. The loss function expression is as follows:

[0250]

[0251] Where y is the sample label, the label is 1 for a valid event, and 0 for an invalid event, p is the predicted probability, m is the number of samples, and for samples predicted to be 1, the term y[i]*log(p[i]) takes effect, and for samples predicted to be 0, the term (1-y[i])*log(1-p[i]) takes effect. By adding a classification head to the model to identify meaningless events, the recognition function of meaningless events can be integrated into the same model, simplifying the process complexity of the entire processing process.

[0252] For each episode consisting of multiple scenes, the mean of the event representations of all scenes belonging to the event is taken as the target representation. Starting from the second episode, trace back to the previous episode to merge events, that is, for the target representation of a certain event in the second episode, calculate its Euclidean distance with all target representations in the first episode. When the threshold requirement is met, if there are multiple events that meet the conditions, take the first episode event with the closest Euclidean distance and merge it with the second episode event, until the last episode and the second to last episode complete the event merger, and then all the events of the target script can be obtained.

[0253] For the entire script, after obtaining the event, the script plot is output, such as event highlights or event plot summaries. For each event, the large language model can be used to output the event description, such as "The following is a text description of several scenes of a certain event in a certain script. Please use 50 words to briefly summarize what happened to protagonists a and b." Among them, protagonists a and b can be obtained from the basic ability of script comprehension. Introducing the protagonist can make the content of script comprehension focus on the protagonist, rather than any arbitrary characters and events.

[0254] By processing the script in the above way, we can improve the effect of automatic script understanding from the event dimension, understand the script in the event dimension based on the needs of users watching the drama, and make the best use of the overall script understanding system and existing capabilities to provide event-related information under limited resources, making the script event representation more accurate. In addition, we can generate data collection and model training methods that are more conducive to model learning based on the unique characteristics of script events and the requirements of open set event representation learning.

[0255] In general, the scheme including the above-mentioned embodiments can solve the problem of fragmented or insufficiently focused episodes, and avoid the problem of stacked content and unclear priorities in the output results of script automation understanding: using event extraction, event aggregation is performed from the smallest granularity of the script, and plot descriptions are extracted based on events, thereby improving the overall comprehensibility of the final plot description. By designing a more effective event representation model and learning method for scene aggregation, the event representation effect is improved through joint representation learning of important factors such as time, characters, and events of script events, and finally using joint event representation to merge and remove scene events according to event aggregation and unique features of the script.

[0256] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0257] Based on the same inventive concept, the embodiment of the present application also provides a script processing device for implementing the script processing method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more script processing device embodiments provided below can refer to the limitations on the script processing method above, and will not be repeated here.

[0258] In one embodiment, Fig.16 As shown, a script processing device is provided, including: a text reconstruction module 1602, an event representation extraction module 1604, a scene aggregation module 1606 and a plot analysis module 1608, wherein:

[0259] The text reconstruction module 1602 is used to obtain the scene texts contained in the target script, and to reconstruct the scene texts according to the event elements to obtain the event description texts corresponding to each of the scene texts;

[0260] An event representation extraction module 1604 is used to extract event representations of each event description text respectively through a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form positive sample pairs with the same event identifier and negative sample pairs with different event identifiers;

[0261] A scene aggregation module 1606 is used to aggregate the scenes corresponding to the event description texts based on the event representation of each event description text, and determine a set of scenes belonging to the same event;

[0262] The plot analysis module 1608 is used to associate the events represented by each of the scene sets to obtain the plot content of the target script.

[0263] In one of the embodiments, the text reconstruction module is used to extract content from the scene text according to preset event element dimensions to obtain text content matching each event element dimension; and to splice the text contents extracted from the same scene text to obtain an event description text corresponding to the scene text.

[0264] In one of the embodiments, the text reconstruction module is used to perform element feature character recognition on the scene text according to preset event element dimensions; when element feature characters exist in each of the event element dimensions, the text content of each event element dimension is extracted from the scene text based on the element feature words; when element feature characters do not exist in at least one of the event element dimensions, text analysis is performed on the scene text according to the event element dimensions based on a large language model to obtain the text content of each event element dimension.

[0265] In one embodiment, the element characteristic characters include characteristic words that match the time, place, and character dimensions respectively, and plot start characters that match the event dimension;

[0266] The text reconstruction module is used to identify the feature words that match the time dimension, the location dimension, and the character dimension respectively from the scene header content of the scene text; and to identify the plot start characters that match the event dimension from the plot content of the scene text.

[0267] In one embodiment, the training process of the scene event representation model includes: determining a ternary sample group for event description samples of at least a part of the scenes in the sample script; training the initial scene event representation model based on the ternary sample group to obtain the scene event representation model. The ternary sample group includes the event description sample, a positive sample with the same event identifier as the event description sample, and a negative sample with a different event identifier from the event description sample; the positive sample and the event description sample constitute a positive sample pair, and the negative sample and the event description sample constitute a negative sample pair.

[0268] In one of the embodiments, the method for obtaining the positive sample includes: when there is an associated sample for the event description sample, determining the associated sample as the positive sample of the event description sample; when there is no associated sample for the event description sample, randomly replacing part of the content of the event description sample according to a set probability to obtain the positive sample of the event description sample; the associated sample is the same as the event to which the event description sample belongs.

[0269] In one of the embodiments, the negative samples include static negative samples, default negative samples and dynamic negative samples; the method for obtaining negative samples corresponding to the event description samples includes: based on the target set to which the event description samples belong in the sample script, taking the upper and lower sets whose set number difference with the target set is less than the set number difference threshold as the screening interval, screening out static negative samples with different event identifiers from the event description samples; in each round of training of the scene event representation model, randomly extracting default negative samples with different event identifiers from the event description samples from the training samples of each round; after each round of training of the scene event representation model, extracting event representations from the global event description samples based on the scene event representation model obtained through training, and randomly selecting dynamic negative samples whose event representations are different from the target event representations from the global event description samples, wherein the target event representation is the event representation of the event to which the event description samples belong.

[0270] In one embodiment, the sum of the number of the static negative samples and the number of the dynamic negative samples is a first number, the number of the default negative samples is a second number, and the difference between the first number and the second number is less than a set threshold.

[0271] In one of the embodiments, the training method of the scene event representation model includes: performing dictionary mapping on each sample in the ternary sample group based on a Chinese dictionary to obtain an embedding vector corresponding to each sample; based on the embedding vector carrying the event identifier, training the text basic understanding module and the event representation embedding module in the initial scene event representation model to obtain an output event representation; the initialization parameters of the event representation embedding module are the same as the pre-training parameters of the last layer in the text basic understanding module; based on the model loss corresponding to the event representation, iteratively training the initial scene event representation model until the training stop condition is met to obtain the scene event representation model.

[0272] In one embodiment, the model loss is a triplet loss; the calculation method of the triplet loss includes: respectively obtaining a first distance between respective event representations of positive samples in the triplet sample, and a second distance between respective event representations of negative samples; and determining the triplet loss based on the distance difference between the first distance and the second distance.

[0273] In one of the embodiments, the scene aggregation module is used to determine the accuracy and recall of the scene event representation model based on a test set for the scene event representation model; based on the accuracy and the recall, determine the decision threshold of the scene event representation model for event representation; based on the decision threshold, based on the event representation of each of the event description texts, aggregate the scenes corresponding to the event description texts to determine a set of scenes belonging to the same event.

[0274] In one embodiment, the target script is a multi-episode script including multiple episodes; the scene aggregation module is used to calculate the mean of the event representation corresponding to each scene included in the event for each episode included in the target script as the target representation of the event;

[0275] According to the episode arrangement order of the target script, the events contained in the latter episode are forward merged with the events contained in the previous episode according to the Euclidean distance between the target representations, until the forward merging of events of the last episode of the target script is completed.

[0276] In one of the embodiments, the events include recollection events and non-recollection events; the aggregation process of the events contained in each episode includes: for each episode, identifying the recollection scenes, non-recollection scenes and meaningless scenes in the episode; performing scene elimination processing on the meaningless scenes; aggregating the recollection scenes according to the event representation to obtain recollection events; aggregating the non-recollection scenes according to the event representation to obtain non-recollection events.

[0277] In one embodiment, the plot analysis module is used to obtain the plot analysis requirements for the target script; when the plot analysis requirements are event brief descriptions, the event highlights corresponding to each event in the target script are sequentially extracted according to the correlation relationship between the events represented by each of the scene sets;

[0278] In the case where the plot analysis requirement is a detailed description of events, a plot summary corresponding to each event in the target script is generated in sequence according to the association relationship between the events represented by each of the scene sets.

[0279] In one of the embodiments, the plot analysis module is used to identify the protagonist of each event represented by each of the scene sets to obtain a protagonist identification result; in response to a protagonist emotion analysis request for the target script, according to the protagonist identification result of each of the events, an emotion change analysis is performed on the protagonist in the target script to obtain a protagonist emotion change trend analysis result; in response to a protagonist character setting analysis request for the target script, based on an understanding of the script events for each of the events, the protagonist character setting changes in the target script are analyzed according to the correlation between the events to obtain a character setting development analysis result.

[0280] Each module in the above-mentioned script processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0281] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.17 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a script processing method is implemented.

[0282] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.18As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected via a system bus, and the communication interface, the display unit and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a script processing method is implemented. The display unit of the computer device is used to form a visually visible image, and can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse, etc.

[0283] Those skilled in the art will understand that Fig.17 or Fig.18 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0284] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps of the above-mentioned method embodiments when executing the computer program.

[0285] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0286] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0287] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.

[0288] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present 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), magnetoresistive 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. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited thereto. The processors involved in each embodiment provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., but are not limited thereto.

[0289] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, 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.

[0290] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A script processing method, characterized in that: The method comprises: Obtaining the scene texts contained in the target script, reconstructing the scene texts according to event elements, and obtaining event description texts corresponding to each of the scene texts; The event representation of each event description text is extracted respectively by a scene event representation model; the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form a positive sample pair with the same event identifier and a negative sample pair with different event identifiers; Based on the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event; Associating the events represented by each of the scene sets to obtain the plot content of the target script; Among them, the negative sample pair is composed of an event description sample and a negative sample; the negative samples include static negative samples, default negative samples and dynamic negative samples; the method for obtaining negative samples corresponding to the event description samples includes: based on the target set to which the event description sample belongs in the sample script, taking the upper and lower sets whose set number difference with the target set is less than the set number difference threshold as the screening interval, screening out static negative samples with different event identifiers from the event description sample; in each round of training of the scene event representation model, randomly extracting default negative samples with different event identifiers from the event description sample from the training samples of each round; after each round of training of the scene event representation model, extracting event representations from the global event description samples based on the scene event representation model obtained through training, and randomly selecting dynamic negative samples whose event representations are different from the target event representations from the global event description samples, wherein the target event representation is the event representation of the event to which the event description sample belongs.

2. The method according to claim 1, characterized in that The text reconstruction of the scene text according to the event elements to obtain the event description text corresponding to each of the scene texts includes: For the session text, content extraction is performed according to preset event element dimensions to obtain text content matching each event element dimension; The text contents extracted from the same session text are concatenated to obtain an event description text corresponding to the session text.

3. The method according to claim 2, characterized in that The content extraction is performed on the session text according to the preset event element dimension to obtain the text content matched by each event element dimension, including: According to the preset event element dimensions, element feature character recognition is performed on the event text; In the case where each of the event element dimensions has element characteristic characters, extracting text content of each of the event element dimensions from the session text based on the element characteristic words; In the case that at least one of the event element dimensions does not have element characteristic characters, based on the large language model, the scene text is analyzed according to the event element dimensions to obtain the text content of each event element dimension.

4. The method according to claim 3, characterized in that The element characteristic characters include characteristic words that match the time dimension, the location dimension, and the character dimension, respectively, and the plot start character that matches the event dimension; The step of performing element feature character recognition on the event text according to the preset event element dimension includes: From the scene header content of the scene text, identifying the feature words that match the time dimension, the location dimension, and the character dimension respectively; From the plot content of the scene text, identify the plot start characters that match the event dimension.

5. The method according to claim 1, characterized in that The training process of the scene event representation model includes: Determine a ternary sample group for event description samples of at least a portion of scenes in a sample script; the ternary sample group includes the event description sample, a positive sample whose event identifier is the same as that of the event description sample, and a negative sample whose event identifier is different from that of the event description sample; the positive sample and the event description sample constitute a positive sample pair, and the negative sample and the event description sample constitute a negative sample pair; Based on the ternary sample group, the initial scene event representation model is trained to obtain a scene event representation model.

6. The method according to claim 5, characterized in that The method of obtaining the positive sample includes: In the case where the event description sample has an associated sample, determining the associated sample as a positive sample of the event description sample; In the case where there is no associated sample for the event description sample, a part of the content of the event description sample is randomly replaced according to a set probability to obtain a positive sample of the event description sample; The associated sample and the event description sample belong to the same event.

7. The method according to claim 1, characterized in that The sum of the number of the static negative samples and the number of the dynamic negative samples is a first number, and the number of the default negative samples is a second number; The difference between the first amount and the second amount is less than a set threshold.

8. The method according to claim 5, characterized in that The initial scene event representation model is trained based on the ternary sample group to obtain the scene event representation model, including: Perform dictionary mapping on each sample in the triple sample group based on a Chinese dictionary to obtain an embedding vector corresponding to each sample; Based on the embedding vector carrying the event identifier, the text basic understanding module and the event representation embedding module in the initial scene event representation model are trained to obtain the output event representation; the initialization parameters of the event representation embedding module are the same as the pre-training parameters of the last layer in the text basic understanding module; Based on the model loss corresponding to the event representation, the initial scene event representation model is iteratively trained until a training stop condition is met, thereby obtaining a scene event representation model.

9. The method according to claim 8, characterized in that The model loss is a triplet loss; the calculation method of the triplet loss includes: Respectively obtaining first distances between respective event representations of positive samples and second distances between respective event representations of negative samples in the triplet samples; Based on a distance difference between the first distance and the second distance, a triplet loss is determined.

10. The method according to claim 1, characterized in that The step of aggregating the scenes corresponding to the event description texts based on the event representations of the event description texts to determine a set of scenes belonging to the same event includes: Determining the accuracy and recall of the scene event representation model based on a test set for the scene event representation model; Based on the accuracy and the recall rate, determining a decision threshold of the scene event representation model for event representation; Based on the decision threshold and the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event.

11. The method according to claim 1, characterized in that: The target script is a multi-episode script including multiple episodes; The step of aggregating the scenes corresponding to the event description texts based on the event representations of the event description texts to determine a set of scenes belonging to the same event includes: Based on the event representation of each event description text, the scenes corresponding to the event description text in the same subset are aggregated to determine a set of scenes belonging to the same event in each subset; Determining a target representation of the event represented by the set of scenes based on the event representation corresponding to each scene in the set of scenes; According to the episode arrangement order of the target script, the events contained in the latter episode are forward merged with the events contained in the previous episode according to the Euclidean distance between the target representations, until the forward merging of the events of the last episode of the target script is completed, thereby obtaining a set of scenes belonging to the same event in the target script.

12. The method according to claim 11, characterized in that The events include both recalled and non-recalled events; The aggregation process of the events contained in each episode includes: For each episode, identifying the recalled scenes, non-recalled scenes, and meaningless scenes in the episode; Eliminate the meaningless sessions; Aggregating the recollection scenes according to the event representation to obtain recollection events; The non-recall events are aggregated according to the event representation to obtain non-recall events.

13. The method according to claim 1, characterized in that The step of associating the events represented by each of the scene sets to obtain the plot content of the target script includes: Obtaining plot analysis requirements for the target script; When the plot analysis requirement is a brief description of an event, according to the correlation relationship between the events represented by each of the scene sets, the event highlights corresponding to each event in the target script are extracted in sequence; In the case where the plot analysis requirement is a detailed description of events, a plot summary corresponding to each event in the target script is generated in sequence according to the association relationship between the events represented by each of the scene sets.

14. The method according to claim 1, characterized in that The method further comprises: For each event represented by each of the scene sets, identifying the protagonists is performed to obtain protagonist identification results; In response to a request for analyzing the emotions of the protagonist of the target script, analyzing the emotions of the protagonist in the target script according to the protagonist identification result of each event, and obtaining an analysis result of the trend of the emotions of the protagonist; In response to a request for character analysis of the target script, based on an understanding of the script events for each of the events, character changes in the target script are analyzed according to the correlation between the events to obtain character development analysis results.

15. A script processing device, characterized in that: The device comprises: A text reconstruction module is used to obtain the scene texts contained in the target script, reconstruct the scene texts according to event elements, and obtain event description texts corresponding to each of the scene texts; An event representation extraction module, used to extract event representations of each event description text respectively through a scene event representation model, wherein the scene event representation model is obtained by training a ternary sample group, and the ternary sample group is used to form positive sample pairs with the same event identifier and negative sample pairs with different event identifiers; A session aggregation module, for aggregating the sessions corresponding to the event description texts based on the event representations of the event description texts, and determining a set of sessions belonging to the same event; A plot analysis module, used to associate the events represented by each of the scene sets to obtain the plot content of the target script; The negative sample pair is composed of an event description sample and a negative sample; the negative sample includes a static negative sample, a default negative sample and a dynamic negative sample; and the method for obtaining the negative sample corresponding to the event description sample includes: Based on the target set to which the event description sample belongs in the sample script, the upper and lower sets whose set number difference with the target set is less than the set number difference threshold are used as the screening interval to screen out static negative samples with different event identifiers from the event description sample; During each round of training of the event representation model, a default negative sample having an event identifier different from that of the event description sample is randomly extracted from the training samples of each round; After each round of training of the scene event representation model, event representation is extracted from the global event description samples based on the trained scene event representation model, and dynamic negative samples whose event representations are different from the target event representation are randomly selected from the global event description samples. The target event representation is the event representation of the event to which the event description sample belongs.

16. The device according to claim 15, characterized in that The text reconstruction module is used to extract content from the scene text according to preset event element dimensions to obtain text content matching each event element dimension; and to splice the text contents extracted from the same scene text to obtain event description text corresponding to the scene text.

17. The device according to claim 16, characterized in that The text reconstruction module is used to perform element feature character recognition on the scene text according to preset event element dimensions; when element feature characters exist in each of the event element dimensions, the text content of each event element dimension is extracted from the scene text based on element feature words; when element feature characters do not exist in at least one of the event element dimensions, text analysis is performed on the scene text according to the event element dimensions based on a large language model to obtain the text content of each event element dimension.

18. The device according to claim 17, characterized in that The element characteristic characters include characteristic words that match the time dimension, the location dimension, and the character dimension, respectively, and the plot start character that matches the event dimension; The text reconstruction module is used to identify the feature words that match the time dimension, the location dimension, and the character dimension respectively from the scene header content of the scene text; and to identify the plot start characters that match the event dimension from the plot content of the scene text.

19. The device according to claim 15, characterized in that The training process of the scene event representation model includes: determining a ternary sample group for event description samples of at least a part of the scenes in a sample script; training an initial scene event representation model based on the ternary sample group to obtain a scene event representation model; the ternary sample group includes the event description sample, a positive sample whose event identifier is the same as that of the event description sample, and a negative sample whose event identifier is different from that of the event description sample; the positive sample and the event description sample constitute a positive sample pair, and the negative sample and the event description sample constitute a negative sample pair.

20. The device according to claim 19, characterized in that The method for obtaining the positive sample includes: when an event description sample has an associated sample, determining the associated sample as a positive sample of the event description sample; when an event description sample does not have an associated sample, randomly replacing part of the content of the event description sample according to a set probability to obtain a positive sample of the event description sample; the associated sample and the event description sample belong to the same event.

21. The device according to claim 15, characterized in that The sum of the number of the static negative samples and the number of the dynamic negative samples is a first number, and the number of the default negative samples is a second number; and a difference between the first number and the second number is less than a set threshold.

22. The device according to claim 19, characterized in that The training method of the scene event representation model includes: performing dictionary mapping on each sample in the ternary sample group based on a Chinese dictionary to obtain an embedding vector corresponding to each sample; based on the embedding vector carrying the event identifier, training the text basic understanding module and the event representation embedding module in the initial scene event representation model to obtain an output event representation; the initialization parameters of the event representation embedding module are the same as the pre-training parameters of the last layer in the text basic understanding module; based on the model loss corresponding to the event representation, iteratively training the initial scene event representation model until the training stop condition is met to obtain the scene event representation model.

23. The device according to claim 22, characterized in that The model loss is a triplet loss; the calculation method of the triplet loss includes: respectively obtaining a first distance between respective event representations of positive samples in the triplet sample, and a second distance between respective event representations of negative samples; and determining the triplet loss based on the distance difference between the first distance and the second distance.

24. The device according to claim 15, characterized in that The session aggregation module is used to determine the accuracy and recall rate of the session event representation model based on a test set for the session event representation model; and determine a decision threshold of the session event representation model for event representation based on the accuracy and the recall rate; Based on the decision threshold and the event representation of each event description text, the scenes corresponding to the event description text are aggregated to determine a set of scenes belonging to the same event.

25. The device according to claim 15, characterized in that The target script is a multi-episode script including multiple episodes; the scene aggregation module is used to calculate the mean of the event representations corresponding to each scene included in each episode of the target script as the target representation of the event; According to the episode arrangement order of the target script, the events contained in the latter episode are forward merged with the events contained in the previous episode according to the Euclidean distance between the target representations, until the forward merging of events of the last episode of the target script is completed.

26. The device according to claim 25, characterized in that The events include both recalled and non-recalled events; The aggregation process of the events contained in each episode includes: for each episode, identifying the recall scenes, non-recall scenes and meaningless scenes in the episode; performing scene elimination processing on the meaningless scenes; aggregating the recall scenes according to the event representation to obtain recall events; and aggregating the non-recall scenes according to the event representation to obtain non-recall events.

27. The device according to claim 15, characterized in that The plot analysis module is used to obtain the plot analysis requirements for the target script; when the plot analysis requirements are event brief descriptions, the event highlights corresponding to each event in the target script are extracted in sequence according to the correlation relationship between the events represented by each of the scene sets; In the case where the plot analysis requirement is a detailed description of events, a plot summary corresponding to each event in the target script is generated in sequence according to the association relationship between the events represented by each of the scene sets.

28. The device according to claim 15, characterized in that The plot analysis module is used to identify the protagonists of the events represented by each of the scene sets, and obtain protagonist identification results; in response to a protagonist emotion analysis request for the target script, perform emotion change analysis on the protagonists in the target script according to the protagonist identification results of each of the events, and obtain protagonist emotion change trend analysis results; In response to a request for character analysis of the target script, based on an understanding of the script events for each of the events, character changes in the target script are analyzed according to the correlation between the events to obtain character development analysis results.

29. 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, the steps of the method according to any one of claims 1 to 14 are implemented.

30. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

31. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented.

Citation Information

Patent Citations

  • Data information identification method and device, equipment, storage medium and program product

    CN114329051A

  • Extraction method and device of story line in script, electronic equipment and storage medium

    CN117473992A