Method and device for determining main figure of script, electronic equipment and storage medium

By acquiring the script text, extracting the plot importance scores of the characters, and using a pre-trained language model to analyze semantic relevance, this approach solves the problem of relying on surface statistical features in existing technologies. It achieves accurate identification and quantity matching of the main characters in the script, thus improving the accuracy of the analysis results.

CN120849599APending Publication Date: 2025-10-28SHANGHAI IQIYI NEW MEDIA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510801009.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-16
Publication Date
2025-10-28

AI Technical Summary

Technical Problem

Existing technologies rely on surface statistical features when analyzing the main characters in a script, which cannot accurately reflect the actual influence of the characters on the development of the plot, resulting in inaccurate analysis results.

Method used

By acquiring the script text, extracting the plot importance scores of the characters, using a pre-trained language model to analyze the semantic relevance and behavioral impact of the characters, and combining narrative structure features, dynamically adjusting the number of candidate characters and importance thresholds, the main characters are identified.

Benefits of technology

It improves the accuracy of identifying key characters, ensuring that the analysis results truly reflect the actual status and role of the characters in the development of the plot, and adapts to the analysis needs of different types of scripts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849599A_ABST
    Figure CN120849599A_ABST
Patent Text Reader

Abstract

The invention provides a script main character determination method and device, electronic equipment and a storage medium. The method comprises the steps of obtaining a to-be-processed script text; extracting at least one character and a plot importance score of each character from the to-be-processed script text; arranging all the figures in a descending order according to the story importance scores from high to low to obtain a figure sequence; selecting a preset number of persons before sorting as candidate persons; and determining a main person in the candidate persons. By means of the scheme, the accuracy of main figure judgment can be fundamentally improved, and it is ensured that the analysis result truly reflects the actual status and effect of all figures in plot development.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of script analysis technology, and in particular to a method, apparatus, electronic device and storage medium for determining the main characters in a script. Background Technology

[0002] Script evaluation is a crucial step in film and television creation and content analysis, with the identification of key characters directly impacting plot comprehension, character development, and audience experience. Traditionally, production teams and researchers have to manually read and analyze scripts to identify core characters and their importance, but this method is inefficient and highly subjective, making it unsuitable for large-scale script analysis.

[0003] The current field of automated script analysis mainly adopts statistical analysis methods, including: 1) Dialogue count method: determining importance by calculating the number of lines of dialogue for a character; 2) Appearance frequency method: ranking characters according to the number of times they appear in a scene; 3) Duration calculation method: calculating the cumulative appearance time of a character in the play.

[0004] However, existing technical solutions rely on superficial statistical characteristics when analyzing key characters, which cannot accurately reflect the actual influence of characters on the development of the plot, resulting in inaccurate analysis results. Summary of the Invention

[0005] The purpose of this application is to provide a method, apparatus, electronic device, and storage medium for determining the main characters in a script, in order to solve the problem that existing technical solutions rely on superficial statistical characteristics when analyzing main characters, which cannot accurately reflect the actual influence of the characters on the development of the plot, resulting in inaccurate analysis results. The specific technical solution is as follows:

[0006] Firstly, this application provides a method for determining the main characters in a script, including:

[0007] Obtain the script text to be processed;

[0008] Extract at least one character and a plot importance score for each character from the script text to be processed;

[0009] All characters are sorted in descending order of their importance in the plot, resulting in a character sequence;

[0010] Select a preset number of people as candidates before sorting;

[0011] Identify the main characters from the candidates.

[0012] In one possible implementation, identifying key figures among the candidates includes:

[0013] Calculate the score decrease for each pair of adjacent candidates;

[0014] Identify the largest decrease in the candidates' scores from the decrease in their scores;

[0015] The main characters are determined from the candidates based on the maximum decrease.

[0016] In one possible implementation, determining the key figures among the candidates based on the maximum decrease includes:

[0017] If the maximum drop exceeds the target threshold, all candidates before the position corresponding to the maximum drop are identified as the main characters;

[0018] If the maximum decrease does not exceed the target threshold, the preset number of candidates will be identified as key figures.

[0019] In one possible implementation, the method further includes:

[0020] Obtain the rating distribution data of the main characters and supporting characters in the historical script, and calculate the benchmark threshold based on the rating distribution data;

[0021] Identify the narrative structure features of the script text to be processed, and determine the adjustment coefficients based on the narrative structure features;

[0022] The target threshold is determined based on the baseline threshold and the adjustment coefficient.

[0023] In one possible implementation, the step of extracting at least one character and a plot importance score for each character from the script text to be processed includes:

[0024] The script text to be processed is divided into episodes to obtain the episode texts;

[0025] For each episode text, at least one character and a single episode plot score for each character in the episode text are identified from the episode text using a pre-trained language model;

[0026] For each character, the episode plot scores of the character in all the episode texts are weighted and merged to obtain the plot importance score of the character.

[0027] The weighting coefficients of the weighted fusion processing are determined based on the narrative weight of the episode text in the script text to be processed.

[0028] In one possible implementation, the step of identifying the episode plot ratings of each character in the episode text from the episode text using a pre-trained language model includes:

[0029] For the aforementioned text segmentation, a character interaction subgraph is constructed, where nodes in the character interaction subgraph represent characters, and edge weights are based on dialogue interaction frequency and scene co-occurrence intensity.

[0030] For each character, the semantic correlation between the character's dialogue and the episode's key plot is calculated using the attention mechanism of the pre-trained language model.

[0031] Based on the character interaction subgraph, the strength of the direct impact of the character's behavior on the episode plot direction of the episode text is analyzed.

[0032] The episode plot score is generated based on the semantic relevance and the direct impact strength.

[0033] In one possible implementation, the method further includes:

[0034] Obtain the script type characteristics of the script text to be processed;

[0035] The initial quantity range is determined based on the characteristics of the script type;

[0036] The initial quantity range is adjusted based on the total number of episodes of the script text to be processed to obtain the preset quantity.

[0037] Secondly, this application provides a device for determining the main characters in a script, comprising:

[0038] The acquisition module is used to acquire the script text to be processed;

[0039] The extraction module is used to extract at least one character and a plot importance score for each character from the script text to be processed;

[0040] The sorting module is used to sort all characters in descending order according to their importance rating in the plot, thus obtaining a character sequence.

[0041] The selection module is used to select a preset number of people as candidates before sorting.

[0042] The determination module is used to identify key figures among the candidates.

[0043] In one possible implementation, the determining module is specifically used for:

[0044] Calculate the score decrease for each pair of adjacent candidates;

[0045] Identify the largest decrease in the candidates' scores from the decrease in their scores;

[0046] The main characters are determined from the candidates based on the maximum decrease.

[0047] In one possible implementation, the determining module is further configured to:

[0048] If the maximum drop exceeds the target threshold, all candidates before the position corresponding to the maximum drop are identified as the main characters;

[0049] If the maximum decrease does not exceed the target threshold, the preset number of candidates will be identified as key figures.

[0050] In one possible implementation, the determining module is further configured to:

[0051] Obtain the rating distribution data of the main characters and supporting characters in the historical script, and calculate the benchmark threshold based on the rating distribution data;

[0052] Identify the narrative structure features of the script text to be processed, and determine the adjustment coefficients based on the narrative structure features;

[0053] The target threshold is determined based on the baseline threshold and the adjustment coefficient.

[0054] In one possible implementation, the extraction module is specifically used for:

[0055] The script text to be processed is divided into episodes to obtain the episode texts;

[0056] For each episode text, at least one character and a single episode plot score for each character in the episode text are identified from the episode text using a pre-trained language model;

[0057] For each character, the episode plot scores of the character in all the episode texts are weighted and merged to obtain the plot importance score of the character.

[0058] The weighting coefficients of the weighted fusion processing are determined based on the narrative weight of the episode text in the script text to be processed.

[0059] In one possible implementation, the extraction module is further configured to:

[0060] For the aforementioned text segmentation, a character interaction subgraph is constructed, where nodes in the character interaction subgraph represent characters, and edge weights are based on dialogue interaction frequency and scene co-occurrence intensity.

[0061] For each character, the semantic correlation between the character's dialogue and the episode's key plot is calculated using the attention mechanism of the pre-trained language model.

[0062] Based on the character interaction subgraph, the strength of the direct impact of the character's behavior on the episode plot direction of the episode text is analyzed.

[0063] The episode plot score is generated based on the semantic relevance and the direct impact strength.

[0064] In one possible implementation, the device further includes an adjustment module for:

[0065] Obtain the script type characteristics of the script text to be processed;

[0066] The initial quantity range is determined based on the characteristics of the script type;

[0067] The initial quantity range is adjusted based on the total number of episodes of the script text to be processed to obtain the preset quantity.

[0068] Thirdly, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0069] Memory, used to store computer programs;

[0070] When a processor executes a program stored in memory, it implements any of the steps described in the first aspect.

[0071] Fourthly, a computer-readable storage medium is provided, characterized in that the computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of any of the methods described in the first aspect.

[0072] Fifthly, a computer program product containing instructions is provided that, when run on a computer, causes the computer to execute any of the above-described methods for determining the main characters of a script.

[0073] Beneficial effects of the embodiments in this application:

[0074] This application provides a method, apparatus, electronic device, and storage medium for determining the main characters in a script. First, by extracting a "plot importance score," it fundamentally differs from superficial indicators such as dialogue quantity or appearance time. This score captures the substantial impact of characters on plot development, such as driving key plot twists and maintaining narrative logic. Second, an "adopt-a-candidate" mechanism intelligently defines the analysis scope, ensuring accurate identification of core narrative characters while meeting industry standards for the number of main characters. This solution fundamentally improves the accuracy of main character determination, ensuring that the analysis results truly reflect the actual status and role of each character in the plot development.

[0075] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0076] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0077] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0078] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0079] Figure 1 A flowchart illustrating a method for determining the main characters in a script, as provided in this application embodiment;

[0080] Figure 2 A flowchart illustrating another method for determining the main characters in a script, provided as an embodiment of this application;

[0081] Figure 3 A schematic diagram of a device for determining the main characters in a script, provided in an embodiment of this application;

[0082] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0083] To make the purpose, technical solutions, and advantages of the embodiments of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0084] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0085] Figure 1 This is a flowchart illustrating a method for determining key characters in a script, provided as an embodiment of this application. This method can be applied to one or more electronic devices such as smartphones, laptops, desktop computers, portable computers, and servers. Furthermore, the execution entity of this method can be hardware or software. When the execution entity is hardware, it can be one or more of the aforementioned electronic devices. For example, a single electronic device can execute this method, or multiple electronic devices can cooperate with each other to execute this method. When the execution entity is software, this method can be implemented as multiple software programs or software modules, or as a single software program or software module. No specific limitations are imposed here.

[0086] like Figure 1 As shown, the method specifically includes:

[0087] S101. Obtain the script text to be processed.

[0088] The script text to be processed refers to the original script data that is the object of processing in this invention, which is a data set containing complete narrative content. Specifically: Data content includes complete text elements that constitute the narrative structure of the script, such as character dialogues, plot descriptions, and scene transition markers; Data format can be in the form of electronic documents (such as PDF, Word), structured text (JSON / XML format), or database records; Data characteristics retain the inherent characteristics of the script, such as consistency of character titles, chronological order, and plot coherence.

[0089] In this embodiment, the script text to be processed can be obtained through at least one of the following methods: file import: supporting the parsing of script files in formats such as .txt and .docx; interface call: obtaining structured data from the script management system through an API interface; database query: extracting text content with metadata tags from the script database. This acquisition process must maintain the integrity of the script's narrative structure and the consistency of character referencing.

[0090] S102. Extract at least one character and a plot importance score for each character from the script text to be processed.

[0091] Characters: The characters that appear in the script, including protagonists and supporting characters, are identified through natural language processing technology.

[0092] Plot Importance Score: This refers to a numerical indicator that quantifies a character's influence on the plot development. It is calculated based on features such as semantic analysis and plot relevance and is used to objectively evaluate a character's narrative value.

[0093] In this embodiment, natural language processing techniques (such as large models) are used to identify all characters in the script and calculate a plot importance score for each character. This score comprehensively considers the character's role in driving key plot points, the intensity of their interaction with other characters, and their centrality within the narrative structure. Compared to traditional methods that rely solely on dialogue volume or screen time, this approach quantifies a character's actual influence through semantic understanding, enabling more accurate identification of core characters. This avoids misjudgments caused by screen time statistics (such as misclassifying characters with high screen time but low influence), ensuring that the score truly reflects the character's contribution to the plot and improving the accuracy of subsequent main character identification.

[0094] S103. Arrange all characters in descending order of their importance in the plot to obtain the character sequence.

[0095] Descending order: Sort characters from highest to lowest according to their importance in the plot, forming an ordered list.

[0096] Character sequence: refers to an ordered list of characters after sorting, in which characters are arranged in descending order of their importance rating.

[0097] In this embodiment, all characters are sorted in descending order of their importance in the plot, generating a character sequence. This sequence is ordered based on the score, ensuring that characters with the greatest narrative influence are placed at the top. This process provides a structured data foundation for subsequent candidate selection, enabling the system to focus on high-scoring characters and reduce irrelevant interference.

[0098] S104. Select a preset number of people as candidates before sorting.

[0099] Preset Quantity: The maximum number of candidates (e.g., 4-6 people) that is dynamically set according to business needs or script type, used to control the maximum scale of the main characters.

[0100] Candidate Characters: High-rated characters selected from the character sequence, forming a pool of potential main characters.

[0101] In this embodiment, based on the sorted character sequence, the top N (a preset number) high-rated characters are selected as candidates. This conforms to the industry's conventional limitations on the number of main characters (such as avoiding too many protagonists) while also covering the vast majority of core characters. Subsequent steps will further analyze within this candidate range to ensure the accuracy and practicality of the main character determination.

[0102] In addition, in another embodiment of this application, the method may further include the following steps: obtaining the script type characteristics of the script text to be processed; determining an initial quantity range based on the script type characteristics; adjusting the initial quantity range according to the total number of episodes of the script text to be processed to obtain the preset quantity.

[0103] Script Type Characteristics: These refer to the characteristic parameters reflecting the narrative structure of the script extracted through text analysis, including but not limited to single-protagonist, dual-protagonist, and ensemble drama classifications. Initial Number Range: A pre-defined range for the number of candidate main characters based on the script type; for example, 3-4 characters for an episodic drama and 5-6 characters for a serial drama. Total Episodes: The total number of episodes contained in the script to be processed, serving as an important reference dimension for adjusting the number of candidates.

[0104] This solution intelligently determines the range of candidates by analyzing the narrative structure characteristics of the script: first, it extracts the genre characteristics of the script (such as determining whether it is an ensemble drama by analyzing the density of key characters), and sets the initial range of candidates accordingly; then, it dynamically adjusts the number of candidates based on the total number of episodes of the script (for example, the range can be appropriately expanded for long dramas with more than 20 episodes). This dual adjustment mechanism ensures that the preset number conforms to genre conventions and adapts to changes in the size of the script.

[0105] This scheme uses a dual calibration of genre characteristics and episode count to ensure that the number of candidates is both in line with industry norms (such as avoiding missing key characters in ensemble dramas) and script-specific (adapting to different length requirements). Compared with a fixed number setting, it can improve the completeness of the coverage of main characters.

[0106] S105. Identify the main characters among the candidates.

[0107] Candidates: refers to the set of high-scoring characters selected through the aforementioned steps, which usually includes a preset number of preceding characters.

[0108] Main characters: refers to the group of characters who have a decisive influence on the development of the plot. Their identification requires comprehensive consideration of both the absolute value of the score and the relative distribution characteristics.

[0109] In this embodiment of the application, S105 may specifically include the following steps: calculating the score decrease between each pair of adjacent characters in the candidate; identifying the maximum decrease from the score decrease of the candidate; and determining the main character in the candidate based on the maximum decrease.

[0110] Rating Decrease: This refers to the relative difference in plot importance ratings between two adjacent characters in a candidate character sequence, usually expressed as a percentage, reflecting the degree of importance disparity between characters. Maximum Decrease: This refers to the largest rating difference among all adjacent character pairs, used to locate significant breakpoints in the importance distribution.

[0111] In this scheme, the candidate sequence is first traversed, and the relative decrease in the score of adjacent persons is calculated for each pair (e.g., (previous score - subsequent score) / previous score); then the maximum value among all decrease values ​​is identified; and the main person is determined based on the case of the maximum value.

[0112] Specifically, determining the main character from the candidates based on the maximum drop amplitude may include the following steps: if the maximum drop amplitude exceeds a target threshold, all candidates before the position corresponding to the maximum drop amplitude are determined as the main character; if the maximum drop amplitude does not exceed the target threshold, the preset number of candidates are determined as the main character.

[0113] Target threshold: A pre-set critical value for the rate of decline in ratings, used to determine whether there is a significant drop in the importance of a character. This threshold can be obtained through analysis of historical script data.

[0114] This scheme provides a dual judgment mechanism: when the detected maximum decrease exceeds the target threshold, it indicates a significant importance gap at that position, and all candidates preceding it are identified as key figures; if the maximum decrease does not reach the threshold, it indicates that the importance distribution among candidates is even, and all preset number of candidates are directly selected as key figures. For example, for 6 candidates, if the decrease between the 3rd and 4th candidates is the largest and exceeds the threshold, the first 3 are selected; if all adjacent decreases are small, all 6 are retained.

[0115] This scheme automatically determines the dividing point of the core character when there is a significant difference in the scores of adjacent characters (exceeding the target threshold); otherwise, all candidates are retained. This not only solves the problem of missing the identification of multiple core characters in ensemble dramas (such as multiple important characters in "Nirvana in Fire"), but also accurately captures the core status of "low-screen-but-high-influence" characters such as Zhang Dongsheng in "The Hidden Corner". Compared with the fixed-number selection method, it can improve the accuracy of identifying the main characters, and at the same time, it is perfectly adapted to the narrative characteristics of different types of scripts such as episodic dramas, serial dramas, and ensemble dramas.

[0116] In one embodiment, the target threshold can be obtained through the following steps: obtaining the rating distribution data of the main characters and supporting characters in the historical script, and calculating a baseline threshold based on the rating distribution data; identifying the narrative structure features of the script text to be processed, and determining an adjustment coefficient based on the narrative structure features; and determining the target threshold based on the baseline threshold and the adjustment coefficient.

[0117] Rating distribution data: refers to the statistical distribution characteristics of the importance ratings of main characters and supporting characters in the plot of historical scripts obtained through the same rating method, including parameters such as mean and variance.

[0118] Benchmark Threshold: An initial threshold reference value derived from statistical analysis of historical data, reflecting the typical score difference between main characters and supporting characters in a typical script.

[0119] Adjustment coefficient: A dynamic correction parameter calculated based on the unique narrative characteristics of the current script (such as the intensity of multi-narrative structure, the concentration of the main characters, etc.).

[0120] This solution first derives a baseline threshold based on statistical analysis of rating data from a large number of historical scripts, reflecting general industry trends. Then, it generates adjustment coefficients by analyzing the narrative characteristics of the current script (such as the distribution of key plot points and the complexity of character relationships). Finally, it combines the baseline threshold with the adjustment coefficients to output a dynamic target threshold adapted to the characteristics of the current script. For example, for ensemble dramas with multi-narrative structures, the system automatically raises the threshold to accommodate more core characters.

[0121] This approach allows the system to both inherit historical data experience (benchmark threshold) and adapt to specific script characteristics (adjustment coefficient), thereby improving the accuracy of identifying main characters in different types of scripts compared to the fixed threshold method.

[0122] In this embodiment, firstly, by extracting a "plot importance score," which is fundamentally different from superficial indicators such as dialogue quantity or appearance time, this score can capture the substantial impact of characters on plot development, such as driving key plot twists and maintaining narrative logic. Secondly, through a "candidate screening" mechanism, the analysis scope is intelligently defined, ensuring both accurate identification of core narrative characters and meeting industry standards for the number of main characters. This solution fundamentally improves the accuracy of main character identification, ensuring that the analysis results truly reflect the actual status and role of each character in the plot development.

[0123] See Figure 2 This is a flowchart illustrating another embodiment of a method for determining the main characters in a script, as provided in this application. Figure 2 The process shown above Figure 1 Based on the illustrated process, this section describes how to extract at least one character and a plot importance score for each character from the script text to be processed. For example... Figure 2 As shown, the process may include the following steps:

[0124] S201. Perform episode segmentation processing on the script text to be processed to obtain each episode text.

[0125] Episode-based processing: The complete script text is divided into episode text units according to the series, ensuring that the content of each episode is independent and analyzable.

[0126] Episode text: The complete script for each episode, including all dialogue, scene descriptions, and plot developments for that episode.

[0127] In this embodiment, the script text to be processed is split into individual episode texts through structured parsing (such as by timestamp, scene marker, or episode title). Episode-by-episode processing ensures that subsequent analysis can capture character performances episode by episode, avoiding the loss of details caused by mixing the entire series in the calculation. The granularity of episodes can be adapted to different script formats (such as each episode of an episodic drama being independent, and multiple episodes of a serial drama being interconnected).

[0128] This allows for fine-grained character analysis, avoiding rating bias caused by concentrated scenes in the later stages of long dramas.

[0129] S202. For each episode text, identify at least one character and the episode plot score of each character in the episode text using a pre-trained language model.

[0130] Episode Plot Rating: A numerical value that quantifies a character's influence on the plot within a single episode, calculated based on their dialogue, actions, and participation in the episode's storyline.

[0131] Pre-trained language models refer to deep learning models trained on large-scale text (such as BERT (Bidirectional Encoder Representations from Transformers) and GPT (Generative Pre-trained Transformer)), which have the ability to understand semantics and analyze plot connections.

[0132] In this embodiment of the application, after the model identifies the characters, it generates a single episode plot score by combining their dialogue semantics (such as their role in driving key conflicts), behavioral contributions (such as triggering turning events), and co-occurrence relationships.

[0133] Specifically, S202 may include the following steps: constructing a character interaction subgraph for the episode text, where nodes in the character interaction subgraph represent characters, and edge weights are based on dialogue interaction frequency and scene co-occurrence intensity; for each character, calculating the semantic correlation between the character's dialogue and the episode's key plot points using the attention mechanism of the pre-trained language model; analyzing the direct influence of the character's behavior on the episode's plot development based on the character interaction subgraph; and generating the episode plot score based on the semantic correlation and the direct influence intensity.

[0134] Character Interaction Subgraph: A graph structure constructed with the characters in the current episode as nodes and the interaction relationships between characters as edges. The edge weights combine the frequency of dialogue interaction (such as the number of dialogues) and the intensity of scene co-occurrence (such as the degree of closeness of joint participation in key plots).

[0135] Semantic relevance: The semantic relevance between character dialogues and key plot points in episodes is quantified through the attention mechanism of a pre-trained language model, reflecting the driving role of dialogue in plot development.

[0136] Direct impact strength: Based on the interaction subgraph analysis, the contribution of character behavior to the plot development of each episode is analyzed, including direct impacts such as triggering events and changing the decisions of other characters.

[0137] This approach first constructs a character interaction subgraph to quantify the strength of relationships between characters (e.g., the antagonistic interaction between Gao Qiqiang and An Xin in "The Storm"); secondly, it utilizes a language model attention mechanism to calculate the semantic relevance of character dialogues to key plot points (e.g., identifying core dialogues that drive case solving); and finally, it combines the interaction subgraph to analyze the direct impact of actions (e.g., a character's decision triggering a chain of events). Ultimately, it integrates semantic relevance and direct impact strength to generate a score, ensuring the capture of the narrative characteristic of "low dialogue, high impact." Compared to traditional dialogue statistics, this method, through interaction subgraphs and semantic relevance analysis, allows episode scores to more accurately reflect the actual influence of characters.

[0138] S203. For each character, perform a weighted fusion process on the single-episode plot scores of the character in all the episode texts to obtain the plot importance score of the character; wherein, the weight coefficient of the weighted fusion process is determined based on the narrative proportion of the episode text in the script text to be processed.

[0139] Weighted fusion processing: The scores of each character in each episode are summed according to their weights to generate a global importance score.

[0140] Narrative weight: An indicator reflecting the contribution of a single episode to the overall plot, which can be calculated through key plot density, duration ratio, etc.

[0141] In this embodiment, the weighting coefficient is dynamically determined by the narrative weight of each episode (e.g., key episodes have higher weight). For example, a character's score weight in the final episode may double because it has a greater impact on the plot's conclusion. The fusion formula can be expressed as: Global Score = Σ(Single Episode Score × Narrative Weight of That Episode). This scheme highlights a character's performance in key episodes through dynamic weighting, avoiding score dilution caused by time dispersion in non-linear narratives, and making the global score more closely reflect the actual core content.

[0142] Based on the same technical concept, embodiments of this application also provide a device for determining the main characters in a script, such as... Figure 3 As shown, the device includes:

[0143] Module 31 is used to acquire the script text to be processed;

[0144] Extraction module 32 is used to extract at least one character and a plot importance score for each character from the script text to be processed;

[0145] The sorting module 33 is used to sort all characters in descending order according to the importance score of the plot, so as to obtain the character sequence;

[0146] The selection module 34 is used to select a preset number of people as candidates before sorting.

[0147] The determination module 35 is used to determine the main figures among the candidates.

[0148] In one possible implementation, the determining module is specifically used for:

[0149] Calculate the score decrease for each pair of adjacent candidates;

[0150] Identify the largest decrease in the candidates' scores from the decrease in their scores;

[0151] The main characters are determined from the candidates based on the maximum decrease.

[0152] In one possible implementation, the determining module is further configured to:

[0153] If the maximum drop exceeds the target threshold, all candidates before the position corresponding to the maximum drop are identified as the main characters;

[0154] If the maximum decrease does not exceed the target threshold, the preset number of candidates will be identified as key figures.

[0155] In one possible implementation, the determining module is further configured to:

[0156] Obtain the rating distribution data of the main characters and supporting characters in the historical script, and calculate the benchmark threshold based on the rating distribution data;

[0157] Identify the narrative structure features of the script text to be processed, and determine the adjustment coefficients based on the narrative structure features;

[0158] The target threshold is determined based on the baseline threshold and the adjustment coefficient.

[0159] In one possible implementation, the extraction module is specifically used for:

[0160] The script text to be processed is divided into episodes to obtain the episode texts;

[0161] For each episode text, at least one character and a single episode plot score for each character in the episode text are identified from the episode text using a pre-trained language model;

[0162] For each character, the episode plot scores of the character in all the episode texts are weighted and merged to obtain the plot importance score of the character.

[0163] The weighting coefficients of the weighted fusion processing are determined based on the narrative weight of the episode text in the script text to be processed.

[0164] In one possible implementation, the extraction module is further configured to:

[0165] For the aforementioned text segmentation, a character interaction subgraph is constructed, where nodes in the character interaction subgraph represent characters, and edge weights are based on dialogue interaction frequency and scene co-occurrence intensity.

[0166] For each character, the semantic correlation between the character's dialogue and the episode's key plot is calculated using the attention mechanism of the pre-trained language model.

[0167] Based on the character interaction subgraph, the strength of the direct impact of the character's behavior on the episode plot direction of the episode text is analyzed.

[0168] The episode plot score is generated based on the semantic relevance and the direct impact strength.

[0169] In one possible implementation, the device further includes an adjustment module for:

[0170] Obtain the script type characteristics of the script text to be processed;

[0171] The initial quantity range is determined based on the characteristics of the script type;

[0172] The initial quantity range is adjusted based on the total number of episodes of the script text to be processed to obtain the preset quantity.

[0173] In this embodiment, firstly, by extracting a "plot importance score," which is fundamentally different from superficial indicators such as dialogue quantity or appearance time, this score can capture the substantial impact of characters on plot development, such as driving key plot twists and maintaining narrative logic. Secondly, through a "candidate screening" mechanism, the analysis scope is intelligently defined, ensuring both accurate identification of core narrative characters and meeting industry standards for the number of main characters. This solution fundamentally improves the accuracy of main character identification, ensuring that the analysis results truly reflect the actual status and role of each character in the plot development.

[0174] Based on the same technical concept, embodiments of this application also provide an electronic device, such as... Figure 4 As shown, it includes a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.

[0175] Memory 113 is used to store computer programs;

[0176] When processor 111 executes a program stored in memory 113, it performs the following steps:

[0177] Obtain the script text to be processed;

[0178] Extract at least one character and a plot importance score for each character from the script text to be processed;

[0179] All characters are sorted in descending order of their importance in the plot, resulting in a character sequence;

[0180] Select a preset number of people as candidates before sorting;

[0181] Identify the main characters from the candidates.

[0182] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0183] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0184] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0185] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0186] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the above-described methods for determining the main characters in a script.

[0187] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the script main character determination methods described above.

[0188] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.

[0189] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0190] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0191] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for determining the main characters in a script, characterized in that, The method includes: Obtain the script text to be processed; Extract at least one character and a plot importance score for each character from the script text to be processed; All characters are sorted in descending order of their importance in the plot, resulting in a character sequence; Select a preset number of people as candidates before sorting; Identify the main characters from the candidates.

2. The method according to claim 1, characterized in that, The process of identifying key figures among the candidates includes: Calculate the score decrease for each pair of adjacent candidates; Identify the largest decrease in the candidates' scores from the decrease in their scores; The main characters are determined from the candidates based on the maximum decrease.

3. The method according to claim 2, characterized in that, The step of determining the main figures among the candidates based on the maximum decrease includes: If the maximum drop exceeds the target threshold, all candidates before the position corresponding to the maximum drop are identified as the main characters; If the maximum decrease does not exceed the target threshold, the preset number of candidates will be identified as key figures.

4. The method according to claim 3, characterized in that, The method further includes: Obtain the rating distribution data of the main characters and supporting characters in the historical script, and calculate the benchmark threshold based on the rating distribution data; Identify the narrative structure features of the script text to be processed, and determine the adjustment coefficients based on the narrative structure features; The target threshold is determined based on the baseline threshold and the adjustment coefficient.

5. The method according to claim 1, characterized in that, The extraction of at least one character and a plot importance score for each character from the script text to be processed includes: The script text to be processed is divided into episodes to obtain the episode texts; For each episode text, at least one character and a single episode plot score for each character in the episode text are identified from the episode text using a pre-trained language model; For each character, the episode plot scores of the character in all the episode texts are weighted and merged to obtain the plot importance score of the character. The weighting coefficients of the weighted fusion processing are determined based on the narrative weight of the episode text in the script text to be processed.

6. The method according to claim 5, characterized in that, The step of identifying the episode plot ratings of each character in the episode text from the episode text using a pre-trained language model includes: For the aforementioned text segmentation, a character interaction subgraph is constructed, where nodes in the character interaction subgraph represent characters, and edge weights are based on dialogue interaction frequency and scene co-occurrence intensity. For each character, the semantic correlation between the character's dialogue and the episode's key plot is calculated using the attention mechanism of the pre-trained language model. Based on the character interaction subgraph, the strength of the direct impact of the character's behavior on the episode plot direction of the episode text is analyzed. The episode plot score is generated based on the semantic relevance and the direct impact strength.

7. The method according to claim 1, characterized in that, The method further includes: Obtain the script type characteristics of the script text to be processed; The initial quantity range is determined based on the characteristics of the script type; The initial quantity range is adjusted based on the total number of episodes of the script text to be processed to obtain the preset quantity.

8. A device for determining the main characters in a script, characterized in that, The device includes: The acquisition module is used to acquire the script text to be processed; The extraction module is used to extract at least one character and a plot importance score for each character from the script text to be processed; The sorting module is used to sort all characters in descending order according to their importance rating in the plot, thus obtaining a character sequence. The selection module is used to select a preset number of people as candidates before sorting. The determination module is used to identify key figures among the candidates.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method for determining the main characters of a script as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method for determining the main characters of a script as described in any one of claims 1-7.