Text content generation method, device and equipment and computer readable storage medium

By extracting and evaluating the importance of events from novels, the generated short stories retain key events and their sequential relationships, solving the problems of insufficient logic and narrative in existing technologies and improving text quality.

CN121210652APending Publication Date: 2025-12-26BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511215309.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-28
Publication Date
2025-12-26

AI Technical Summary

Technical Problem

Existing technologies, when converting novels into short stories, neglect key plot points and plot coherence, resulting in generated summary texts that lack logic and narrative, and thus have low text quality.

Method used

By extracting multiple events from the original text, calculating the importance score of each event based on the importance assessment index, determining the event node sequence, and generating the target text content based on the event node sequence, the key events and their sequential relationship are preserved.

Benefits of technology

It improves the quality of generated text, avoids the loss of key events or disruption of logical order due to word count reduction, and ensures the logic and narrative of the text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121210652A_ABST
    Figure CN121210652A_ABST
Patent Text Reader

Abstract

The invention relates to the field of natural language processing, in particular to a text content generation method and device, equipment and a computer readable storage medium. The key events in the original text content are determined through the importance scores of the events, and the key events in the original text content and the sequence relation between the events are represented through the event node sequence; therefore, the first target text content generated based on the event node sequence can retain the key events in the original text content and the sequential relationship between the events, the loss of the key events or the damage of the logic sequence between the events caused by simple word number reduction is avoided, and the quality of the generated text is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of natural language processing, and in particular to a method, apparatus, device, and computer-readable storage medium for generating text content. Background Technology

[0002] In the film and television production process, transforming lengthy novels into short stories has broad application value in scenarios such as fast-paced reading, initial evaluation of script adaptations, promotion of film and television intellectual property (IP), short video content creation, and educational support. For example, condensed story outlines generated from novel IPs can be used for project initiation evaluations, screenwriter references, or to generate shooting scripts for promotional short films.

[0003] Currently, the transformation of novels into short stories mainly relies on text summarization techniques, such as extractive summarization, which extracts key sentences from novels. However, these techniques often focus on compressing the length of the text, neglecting key plot points and narrative coherence, resulting in extracted summaries that lack logic and storytelling, and thus have low quality. Summary of the Invention

[0004] To address the aforementioned technical problems, this disclosure provides a text content generation method, apparatus, device, and computer-readable storage medium to improve the quality of the generated text.

[0005] In a first aspect, embodiments of this disclosure provide a method for generating text content, including:

[0006] Extract multiple events from the original text content;

[0007] An importance score for each event is calculated based on multiple importance assessment metrics;

[0008] The event node sequence corresponding to the original text content is determined based on the importance score of each event; wherein, the event node sequence includes at least one event node with an order relationship, and the event node is used to identify events whose importance score is greater than a preset threshold;

[0009] Based on the event node sequence, a first target text content corresponding to the original text content is generated. The first target text content includes event description content corresponding to the event identified by the event node.

[0010] Secondly, embodiments of this disclosure provide a text content generation apparatus, including:

[0011] The event extraction module is used to extract multiple events from the original text content;

[0012] The calculation module is used to calculate the importance score of each event based on multiple importance assessment metrics;

[0013] The first determining module is used to determine the event node sequence corresponding to the original text content based on the importance score of each event; wherein the event node sequence includes at least one event node with an order relationship, and the event node is used to identify the event whose importance score is greater than a preset threshold;

[0014] The first generation module is used to generate a first target text content corresponding to the original text content based on the event node sequence. The first target text content includes event description content corresponding to the event identified by the event node.

[0015] Thirdly, embodiments of this disclosure provide an electronic device, including:

[0016] Memory;

[0017] Processor; and

[0018] Computer programs;

[0019] The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in the first aspect.

[0020] Fourthly, embodiments of this disclosure provide a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the method described in the first aspect.

[0021] Fifthly, embodiments of this disclosure also provide a computer program product, which includes a computer program or instructions that, when executed by a processor, implement the text content generation method described above.

[0022] The text content generation method, apparatus, device, and computer-readable storage medium provided in this disclosure determine key events in the original text content by scoring the importance of events, and represent the key events and the sequential relationship between events in the original text content by using an event node sequence. This enables the first target text content generated based on the event node sequence to retain the key events and the sequential relationship between events in the original text content, avoiding the loss of key events or the disruption of the logical order between events due to simple word reduction, thereby improving the quality of the generated text. Attached Figure Description

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

[0024] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying 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.

[0025] Figure 1 A flowchart of a text content generation method provided in this embodiment of the disclosure;

[0026] Figure 2 A flowchart of a text content generation method provided in another embodiment of this disclosure;

[0027] Figure 3 A schematic diagram of the structure of the text content generation apparatus provided in the embodiments of this disclosure;

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

[0029] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0030] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

[0031] This disclosure provides a method for generating text content, which will be described below with reference to specific embodiments.

[0032] Figure 1 This is a flowchart illustrating a text content generation method provided in an embodiment of this disclosure. This method can be applied to terminals with data processing capabilities, such as smartphones, PDAs, tablets, desktop computers, laptops, all-in-one computers, and servers. It is understood that the text content generation method provided in this disclosure can also be applied in other scenarios.

[0033] The following is about Figure 1 The text content generation method shown is described below, and the specific steps of this method are as follows:

[0034] S101. Extract multiple events from the original text content.

[0035] The original text content refers to the text that needs to be re-created. An event is a narrative unit with complete semantics within the original text content.

[0036] Events are extracted from the original text content to obtain multiple events, which provide a basis for subsequent importance assessment.

[0037] Optionally, multiple events can be extracted from the original text content using a preset large language model. The original text content and corresponding event extraction prompts are input into the preset large language model to obtain multiple events output by the model. The event extraction information is used to enable the preset large language model to extract events from the currently input text content.

[0038] S102. Calculate the importance score for each event based on multiple importance assessment indicators.

[0039] Importance assessment metrics include, but are not limited to, plot conflict metrics, plot development metrics, and character association metrics. Among them, plot conflict metrics are used to quantify the degree to which characters are hindered from achieving their goals in an event; plot development metrics are used to assess the event's role in advancing the overall narrative through semantic differences; and character association metrics are used to measure the number of characters involved in the event and the frequency of their interactions.

[0040] For each event, the importance index value corresponding to each importance assessment indicator is calculated, and then the importance score of the event is calculated by summation or weighted summation. The higher the importance score of an event, the more important the event is to the plot development in the original text content; the lower the importance score of an event, the less important the event is to the plot development in the original text content.

[0041] S103. Determine the event node sequence corresponding to the original text content based on the importance score of each event; wherein the event node sequence includes at least one event node with an order relationship, and the event node is used to identify events with an importance score greater than a preset threshold.

[0042] Key events are those events with an importance score greater than a preset threshold among multiple events corresponding to the original text content; that is, at least one event with a high importance score. Each key event corresponds to an event node. For example, when the original text content is a novel, key events can be the core conflict plot or plot points that drive the main plot forward.

[0043] An event node sequence is a set of event nodes arranged in a sequential order, where the order includes the order in which key events appear in the original text content, or the causal order between key events. The event node sequence represents the key events in the original text content according to this sequential order.

[0044] S104. Generate the first target text content corresponding to the original text content based on the event node sequence. The first target text content includes event description content corresponding to the event identified by the event node.

[0045] The event node sequence provides the event content and sequence relationship of key events in the original text content. Therefore, the first target text content generated based on the event node sequence includes the event description content corresponding to each key event, and also retains the sequence relationship between each key event.

[0046] Optionally, in text abbreviation scenarios, the event description can be a summary based on the event content of the key events, meaning that the number of words in the event description is less than the event content of the key events in the original text.

[0047] For example, when the original text content is a novel, the first target text content generated in this step retains the key plots of the novel, as well as the narrative or causal relationships between the key plots. When generating a novel summary, the key plots or the logical relationships of the novel's plot will not be lost due to the compression of word count and length.

[0048] Optionally, in the text expansion scenario, the event description content can be obtained by describing the event content of the key event in detail, that is, the number of words in the event description content is more than the event content of the key event in the original text content.

[0049] This embodiment of the disclosure determines key events in the original text content by scoring the importance of events, and represents the key events in the original text content and the sequential relationship between events by using event node sequences. This allows the first target text content generated based on the event node sequences to retain the key events in the original text content and the sequential relationship between events, avoiding the loss of key events or the disruption of the logical order between events due to simple word reduction, thereby improving the quality of the generated text.

[0050] Based on the above embodiments, before extracting multiple events from the original text content, the text content generation method further includes preprocessing the original text content.

[0051] Specifically, the terminal or a system call file parsing library within the terminal parses the raw text to obtain the raw text content. For example, BeautifulSoup in Python can be used to parse raw text content in Hyper Text Markup Language (HTML) format; ebooklib can be used to parse raw text content in Electronic Publication (ePub) format.

[0052] Furthermore, non-content characters, such as formatting tags, headers, and footers, are removed from the original text content. Specifically, predefined regular expressions (such as the `re` library in Python) are used as clear rules to remove non-content characters from the original text content, thus purifying the original text content and avoiding interference from non-content characters in the generation of text content.

[0053] Next, the purified original text content undergoes text structure recognition, including different levels of text structure such as characters, words, sentences, paragraphs, and chapters. According to text content segmentation requirements, the purified original text content is segmented to obtain sequences that meet the segmentation criteria. For example, sentence boundary detection and paragraph segmentation algorithms from the Natural Language Processing (NLP) toolkit can be used to segment the original text content into sentence sequences and paragraph sequences. Furthermore, the original text content can be labeled based on the text structure recognition results, such as performing document-level structural labeling. Finally, original text content with a hierarchical structure is obtained, facilitating segmentation or block processing during the text content generation process.

[0054] In some embodiments, generating a first target text content corresponding to the original text content based on an event node sequence includes: obtaining a preset first prompt information template, the first prompt information template including a first placeholder; replacing the first placeholder in the first prompt information template with an event node sequence to obtain a first prompt information, the first prompt information being used to guide a preset large language model to generate event description content according to the event node sequence; and inputting the first prompt information into the preset large language model to obtain the first target text content corresponding to the original text content.

[0055] The first prompt message template is a pre-defined template for generating the first target text content. It includes a first placeholder to reserve space for filling in the event node sequence. The first prompt message template provides a specific input format and guidance information for the preset large language model, enabling the preset large language model to generate the required first target text content based on the first prompt message template and the subsequently filled time node sequence.

[0056] After the first prompt information filled with the event node sequence is input into the preset large language model, the preset large language model analyzes and processes the first prompt information according to its own natural language processing mechanism and algorithm, and then generates the first target text content corresponding to the original text content according to its internal language generation logic.

[0057] Optionally, the first prompt message template includes a second placeholder. When obtaining the first prompt message, the first placeholder in the first prompt message template is replaced with an event node sequence, and the second placeholder is replaced with a first preset condition to obtain the first prompt message; wherein, the first preset condition is used to determine the number of characters in the first target text content.

[0058] The first preset condition is a predefined word count requirement for the first target text content. This first preset condition includes: the word count being greater than a first word count threshold; or, the word count being less than the first word count threshold; or, the word count being within a first word count range.

[0059] Correspondingly, the number of words in the first target text content generated based on the first prompt information meets the requirements of the first preset condition.

[0060] For example, in a summary extraction scenario, the number of characters corresponding to the first preset condition is less than the number of characters in the original text content, thus obtaining the first target text content as a summary of the original text content.

[0061] Specifically, the first preset condition can be determined based on a predefined first condensation parameter, where the first condensation parameter refers to the ratio of the number of words in the first target text content to the number of words in the original text content. Correspondingly, the number of words in the first target text content satisfies the first preset condition, including that the number of words in the first target text content is less than a first word count threshold, where the first word count threshold is the product of the first condensation parameter and the number of words in the original text content.

[0062] For example, in a text expansion scenario, the number of characters corresponding to the first preset condition is greater than the number of characters in the original text content.

[0063] Therefore, the embodiments of this disclosure fully utilize the natural language processing capabilities of the preset large language model, so that the first target text content retains the event description content corresponding to each key event in the original text content and the sequential relationship between each key event, while its word count also meets the first preset condition, which can meet the different requirements of text content generation scenarios such as summary extraction or text expansion.

[0064] In addition, by using placeholder replacement to generate the first prompt message, the computational resources required to generate the first prompt message are reduced, thus improving the efficiency of text generation.

[0065] The following describes an implementation method for extracting multiple events from original text content. The original text content includes multiple sub-text contents; for example, when the original text content is a novel, the multiple sub-text contents would be multiple chapters within the novel.

[0066] Optionally, text segmentation techniques can be used to divide the original text content into multiple sub-text contents.

[0067] Due to the limitations of the single input content size and single processing capacity of the preset large language model, when the size of the original text content exceeds the single input content size limit of the preset large language model, the method of inputting multiple sub-text contents into the preset large language model in sequence is adopted, and the events of multiple sub-text contents are extracted separately.

[0068] Specifically, the first sub-text content is input into a preset large language model for event extraction to obtain at least one event corresponding to the first sub-text content; starting from the second sub-text content, the sub-text content and at least one event corresponding to the previous sub-text content are input into the preset large language model for event extraction to obtain at least one event corresponding to each sub-text content; based on at least one event corresponding to each of the multiple sub-text contents, multiple events corresponding to the original text content are obtained.

[0069] In the process of extracting events from multiple subtext contents, in order to preserve the sequential relationship between events in the original text content, starting from the second subtext content, the event extraction of each subtext content needs to be combined with the event extraction results of the previous subtext content.

[0070] The first subtext content refers to the first unit obtained after breaking down the original text content, such as the first chapter of a novel. Event extraction refers to identifying key actions, conflicts, or turning points that drive the story forward from the text content.

[0071] Inputting the first sub-text content into a preset large language model yields at least one event extracted from the first sub-text content. Inputting the at least one event corresponding to the first sub-text content and the second sub-text content into the preset large language model, the at least one event corresponding to the first sub-text content is used as background information for the second sub-text content currently being processed. Event extraction is then performed on the second sub-text content to obtain at least one event corresponding to the second sub-text content. This process is repeated until at least one event corresponding to each sub-text content is obtained.

[0072] Furthermore, at least one event corresponding to each sub-text content is integrated to obtain multiple events corresponding to the original text content.

[0073] Optionally, preset event extraction prompts can be set to guide the preset large language model to extract events from the input content. That is, the first sub-text content and the preset event extraction prompts are input into the preset large language model to obtain at least one event corresponding to the first sub-text content; from the second sub-text content onwards, the sub-text content, at least one event corresponding to the previous sub-text content, and the preset event extraction prompts are input into the preset large language model to obtain at least one event corresponding to each sub-text content.

[0074] For example, an event extraction prompt could be: "Please analyze the following text, identify and list the key events that drive the story forward and their core conflicts in chronological or causal order."

[0075] This embodiment of the disclosure avoids the impact of the input content size limitation of the large language model by extracting events for each sub-text content separately. At the same time, the events corresponding to the previous sub-text content and the current sub-text content for which event extraction is required are input into the large language model together. When extracting events for the current sub-text content, the information of the previous sub-text content can be referenced, which makes up for the lack of contextual information caused by the input of text content in stages, improves the completeness of event extraction, and provides high-quality event data for text re-creation.

[0076] In some embodiments, the importance score of an event can be determined by a preset large language model. Specifically, multiple events and the calculation rules for multiple importance assessment indicators are input into the preset large language model to obtain multiple importance indicator values ​​corresponding to each event, with each importance indicator value corresponding to an importance assessment indicator. For each event, a weighted calculation is performed based on the preset weights of the multiple importance assessment indicators and the multiple importance indicator values ​​corresponding to the event to obtain the importance score of the event.

[0077] The pre-defined large language model obtains multiple importance index values ​​for an event by understanding the calculation rules of the input event and the importance evaluation index, thereby realizing a quantitative score for the importance of the event.

[0078] The importance assessment indicators include plot conflict indicators, plot development indicators, and character relevance indicators.

[0079] The calculation rules for the plot conflict index are related to the degree of plot conflict in the event. The plot conflict index value is positively correlated with the degree of plot conflict. The degree of plot conflict represents at least one of the following: the time taken by the character to achieve the goal, the number of obstacles encountered in the process of achieving the goal, the density of obstacles, and the duration of the obstacles.

[0080] The obstacles encountered by characters in achieving their goals are the source of plot tension in an event. The more difficult the obstacles are to overcome, the higher the degree of plot conflict. For example, in an event, the longer it takes for a character to achieve their goal, the more obstacles they encounter, the greater the density of these obstacles, and the longer they persist, the stronger the plot conflict and the higher the plot conflict index value.

[0081] The multiple events extracted in the previous steps and the first scoring instruction are input into a preset large language model to obtain the plot conflict index value corresponding to each event. The first scoring instruction is used to enable the preset large language model to quantify the degree of plot conflict of each event within a first preset score range.

[0082] The first scoring instruction includes the aforementioned quantitative rules for the degree of plot conflict. Optionally, the first preset score range is determined by a first lower limit and a first upper limit, for example, it can be 0-1. The closer the plot conflict index value of an event is to the first lower limit, the lower the degree of plot conflict of the event; the closer the plot conflict index value of an event is to the first upper limit, the higher the degree of plot conflict of the event.

[0083] Specifically, when the plot conflict index is related to any one of the following influencing factors: the time taken for a character to achieve their goal, the number of obstacles encountered during the process, the density of obstacles, or the duration of the obstacles, the score of that influencing factor within a first preset score range is used as the plot conflict index value for the event. When the plot conflict index is related to multiple influencing factors, the score values ​​of each influencing factor are weighted and summed or averaged to obtain the plot conflict index value for the event.

[0084] The following describes the quantitative scoring methods for each influencing factor of the plot conflict index. It should be noted that the number of thresholds involved in the quantification process of each influencing factor below is only an example; in actual application scenarios, the number of thresholds and their specific values ​​can be determined according to specific needs.

[0085] When the factors influencing the plot conflict index include the time taken by the character to achieve the goal, the time taken by the character to achieve the goal can be compared with multiple preset time thresholds to obtain the corresponding score.

[0086] For example, a first time threshold and a second time threshold are set, with the first time threshold being less than the second time threshold. In an event, if the time taken by a character to achieve their goal is less than the first time threshold, then the score for this influencing factor—the time taken by the character to achieve their goal—is determined to be a first time score. If the time taken by the character to achieve their goal is greater than or equal to the first time threshold and less than the second time threshold, then the score for this influencing factor—the time taken by the character to achieve their goal—is determined to be a second time score. If the time taken by the character to achieve their goal is greater than or equal to the second time threshold, then the score for this influencing factor—the time taken by the character to achieve their goal—is determined to be a third time score. The first time score is less than the second time score, and the second time score is less than the third time score.

[0087] For example, in the event "Character A goes to a convenience store to buy breakfast", the time taken by Character A to achieve the goal of "buying breakfast" is extremely short, less than the first time threshold. Therefore, the score of the influencing factor of the time taken by the character to achieve the goal in this event is the first time score.

[0088] For example, in the event "Character B climbs a mountain with a friend on the weekend and reaches the summit", the time taken by Character B to achieve the goal of "reaching the summit" is greater than the first time threshold but less than the second time threshold. Therefore, the score of the influencing factor of the time taken by the character to achieve the goal in this event is the second time score.

[0089] For example, in the event "Character C spent half a year crossing the desert despite various dangers", the time taken by Character C to achieve the goal of "crossing the desert" is relatively long, exceeding the second time threshold. Therefore, the score of the influencing factor of the time taken by the character to achieve the goal in this event is the third time score.

[0090] Optionally, the first time threshold and the second time threshold can be determined based on the total duration corresponding to the original text content. For example, the first time threshold can be the product of the total duration and a first proportion, and the second time threshold can be the product of the total duration and a second proportion, where the first proportion is less than the second proportion.

[0091] Alternatively, the first and second time thresholds can be determined based on the average duration of events in the original text content (the ratio of the number of events to the total duration corresponding to the original text content). For example, the average duration can be used as the first time threshold, and two or more times the average duration can be used as the second time threshold.

[0092] When the factors influencing the plot conflict index value include the number of obstacles encountered by the character in achieving their goal, the number of obstacles can be compared with multiple preset quantity thresholds to obtain the corresponding score value.

[0093] For example, a first quantity threshold and a second quantity threshold are set, where the first quantity threshold is less than the second quantity threshold. In an event, if the number of obstacles is less than the first quantity threshold, then the score for the influencing factor of the number of obstacles encountered by the character in achieving the goal in that event is determined to be the first quantity score value. If the number of obstacles is greater than or equal to the first quantity threshold and less than the second quantity threshold, then the score for the influencing factor of the number of obstacles encountered by the character in achieving the goal in that event is determined to be the second quantity score value. If the number of obstacles is greater than or equal to the second quantity threshold, then the score for the influencing factor of the number of obstacles encountered by the character in achieving the goal in that event is determined to be the third quantity score value.

[0094] Additionally, if no obstacles occur during the event, the score for the factor of the number of obstacles encountered by the character in achieving the goal during the event is determined as the first lower limit.

[0095] For example, in the event "Character A goes to a convenience store to buy breakfast", there are no obstacles in this event, so the score for the factor of the number of obstacles encountered by the character in achieving the goal in this event is determined to be the first lower limit (e.g., 0).

[0096] For example, in the event "Character B and his friend climbed a mountain together on the weekend and reached the summit", Character B only encountered two obstacles: physical fatigue and getting lost. The number of obstacles is greater than the first threshold and less than the second threshold. Therefore, the score of the number of obstacles encountered by the character in achieving the goal in this event is determined to be the second threshold score.

[0097] For example, in the event "Character C spent half a year crossing the desert despite various dangers", Character C encountered a total of 8 obstacles in the process of achieving the goal of "crossing the desert", such as high temperature, lack of water, sandstorm, and compass failure. This is greater than the second quantity threshold. Therefore, the score of the number of obstacles encountered by the character in the process of achieving the goal is determined to be the third quantity score.

[0098] When the factors influencing the plot conflict index value include the density of obstacles encountered by the character in achieving their goal, the density of obstacles in the event can be compared with multiple preset density thresholds to obtain the corresponding score value.

[0099] For example, a first density threshold and a second density threshold are set, with the first density threshold being less than the second density threshold. In an event, if the density of obstruction is less than the first density threshold, the score for the obstruction density as an influencing factor in that event is determined to be a first density score. If the density of obstruction is greater than or equal to the first density threshold and less than the second density threshold, the score for the obstruction density as an influencing factor in that event is determined to be a second density score. If the density of obstruction is greater than or equal to the second density threshold, the score for the obstruction density as an influencing factor in that event is determined to be a third density score. The first density score is less than the second density score, and the second density score is less than the third density score.

[0100] In addition, if no obstacles are present in the event, the score for the factor of the number of obstacles in the event is determined to be the first lower limit.

[0101] For example, in the event "Character A goes to a convenience store to buy breakfast", there are no obstacles in the event, so the score for the influencing factor of the number of obstacles in the event is determined to be the first lower limit (e.g., 0).

[0102] For example, in the event "Character B and his friends climbed a mountain together on the weekend and reached the summit", there are relatively few obstacles in this event. However, because the event is short, the density of obstacles is greater than the first density threshold and less than the second density threshold. Therefore, the score of the influencing factor of the number of obstacles in this event is determined to be the second density score.

[0103] For example, if an event is described as "Character C spent half a year crossing the desert despite various dangers", the number of obstacles in this event is large and dense, with a density greater than the second density threshold. Therefore, the score for the number of obstacles in this event is the third density score.

[0104] Optionally, the first density threshold and the second density threshold can be determined based on the average density of obstructions in each event in the original text content (the average density of obstructions in each event). For example, the average density can be used as the first density threshold, and two or more times the average density can be used as the second density threshold.

[0105] When the impact factor on the plot conflict index value includes the duration of the obstacle's existence, the duration of the obstacle's existence can be compared with multiple time thresholds to obtain the corresponding score. Specifically, if multiple obstacles exist in the event, the duration of the obstacle's existence is the average duration of all obstacles.

[0106] For example, a third time threshold and a fourth time threshold are set, with the third time threshold being less than the fourth time threshold. In an event: if the duration of the obstacle is less than the third time threshold, the score for the duration of the obstacle's existence in that event is determined to be the fourth time threshold. If the duration of the obstacle's existence is greater than or equal to the third time threshold but less than the fourth time threshold, the score for the duration of the obstacle's existence in that event is determined to be the fifth time threshold. If the duration of the obstacle's existence is greater than or equal to the fourth time threshold, the score for the duration of the obstacle's existence in that event is determined to be the sixth time threshold.

[0107] In addition, if no obstacles occur in the event, the score for the influencing factor of determining the duration of the obstacles in the event is the first lower limit.

[0108] For example, in the event "Character A goes to a convenience store to buy breakfast", there is no obstacle in the event, so the score for the influencing factor of the duration of the obstacle in the event is determined to be the first lower limit (e.g., 0).

[0109] For example, in the event "Character B and his friend climbed a mountain together on the weekend and reached the summit", the obstacle was not present throughout the entire event. The time during which the obstacle existed was greater than the third time threshold but less than the fourth time threshold. Therefore, the score for the influencing factor of the time during which the obstacle existed in this event was determined to be the fifth time score.

[0110] For example, in the event "Character C spent half a year crossing the desert despite various dangers", there are obstacles such as high temperature and lack of water throughout the event. If the average time of the existence of multiple obstacles is greater than the fourth time threshold, then the score of the influencing factor of the time of the obstacles in the event is determined to be the sixth time score.

[0111] In summary, for the event "Character A goes to a convenience store to buy breakfast," the plot conflict index is the average of the first-time score and the three first-lower limits. For the event "Character B and a friend climb a mountain together on the weekend and reach the summit," the plot conflict index is the average of the second-time score, the second-quantity score, the second-density score, and the fifth-time score. For the event "Character C spends six months traversing the desert through various dangers," the plot conflict index is the average of the third-time score, the third-quantity score, the third-density score, and the sixth-time score. It is evident that among the three events, the plot conflict index of "Character A goes to a convenience store to buy breakfast" is the lowest, "Character B and a friend climb a mountain together on the weekend and reach the summit" has a moderate plot conflict index, and "Character C spends six months traversing the desert through various dangers" has the highest plot conflict index. The plot conflict index values ​​of the three events reflect the degree of plot conflict.

[0112] The calculation rules for the plot development index are related to the degree to which events drive the plot forward. The plot development index value is positively correlated with the degree of plot development, which includes a first semantic difference and / or a second semantic difference. The first semantic difference is the difference between the semantics of the character's description at the beginning of the event and the semantics of the character's description at the end of the event. The second semantic difference is the difference between the semantics of the plot's description at the beginning of the event and the semantics of the plot's description at the end of the event.

[0113] The changes an event causes to characters and the plot reflect its impact on the storyline, i.e., the degree of plot development. Utilizing the natural language analysis and processing capabilities of a pre-defined large language model, the semantics at the beginning and end of the event are obtained, further determining the first and second semantic differences.

[0114] The changes an event causes to a character are quantified by the first semantic difference. The character's description includes their personality traits and relationships. The greater the semantic difference between the character's description at the beginning and end of the event, the greater the change the event causes to the character, and consequently, the greater its impact on the plot. Conversely, the smaller the semantic difference between the character's description at the beginning and end of the event, the smaller the change the event causes to the character, and consequently, the smaller its impact on the plot.

[0115] The impact of an event on the state of the plot is quantified by a second semantic difference. The greater the semantic difference between the plot description at the beginning and the plot description at the end of the event, the greater the change in the plot state caused by the event, and the greater the impact of the event on the plot. Conversely, the smaller the semantic difference between the plot description at the beginning and the plot description at the end of the event, the smaller the change in the plot state caused by the event, and the smaller the impact of the event on the plot.

[0116] Optionally, when the degree of plot development includes a first semantic difference and a second semantic difference, the average of the two shall be taken as the final degree of plot development; or, the larger of the two shall be taken as the final degree of plot development.

[0117] The multiple events extracted in the previous steps and the second scoring instruction are input into the preset large language model to obtain the plot development index value corresponding to each event. The second scoring instruction is used to enable the preset large language model to quantify the plot development degree of each event within the second preset score range.

[0118] The second scoring instruction includes the aforementioned quantitative rules for the degree of plot development. Optionally, the second preset score range is determined by a second lower limit and a second upper limit, for example, it can be 0-1. The closer the plot development index value of an event is to the second lower limit, the lower the contribution of the event to the plot development, and the lower the corresponding degree of plot development; the closer the plot development index value of an event is to the second upper limit, the higher the contribution of the event to the plot development, and the higher the corresponding degree of plot development.

[0119] Specifically, when the plot development index is related to either the first semantic difference or the second semantic difference, the first semantic difference or the second semantic difference is mapped to a second preset score range to obtain the plot development index value of the event. Alternatively, when the plot development index value is related to both the first semantic difference and the second semantic difference, the average or weighted sum of the first and second semantic differences is mapped to a second preset score range to obtain the plot development index value of the event.

[0120] Specifically, when the difference is 0%, the plot development index value of the event is the second lower limit, representing that the event has no impact on the characters and / or plot. When the difference is 100%, the plot development index value of the event is the second upper limit, representing that the event has a significant impact on the characters and / or plot. It can be understood that the difference refers to the first semantic difference or the second semantic difference, or the average or weighted sum of the first semantic difference and the second semantic difference.

[0121] For example, the event "Character A goes to a convenience store to buy breakfast" does not change either the character or the plot. The semantics of the descriptions at the beginning and end of the event are consistent, and the plot development index value of the event is the second lower limit value of 0.

[0122] For example, regarding the event "Character B climbs a mountain with a friend on the weekend and reaches the summit", this event changes Character B's mood, and the things encountered during the event have a certain impact on the plot of subsequent events. Therefore, there is a semantic difference between the corresponding descriptions at the beginning and end of the event. The degree of difference is mapped to the second preset score range (taking 0-1 as an example) to obtain a plot development index value of 0.3.

[0123] For example, regarding the event "Character C spent half a year traversing the desert through various dangers," this event significantly alters Character C's personality and character image. Furthermore, the plot descriptions at the beginning and end of the event differ significantly. Therefore, the semantics of the corresponding descriptions at the beginning and end of the event are quite different. The degree of difference is mapped to the second preset score range (taking 0-1 as an example) to obtain a plot development index value of 0.9.

[0124] In summary, the plot development index value of the event "Character A goes to a convenience store to buy breakfast" is the lowest, the plot development index value of the event "Character B climbs a mountain with a friend on the weekend and reaches the summit" is in the middle, and the plot development index value of the event "Character C spends half a year crossing the desert after experiencing various dangers" is the highest. Therefore, the plot development index value can reflect the degree to which the event drives the plot.

[0125] The role association index is related to the degree of role association in an event. The value of the role association index is positively correlated with the degree of role association. The degree of role association represents at least one of the following: the number of roles appearing in the event, the frequency of role interactions in the event, and the proportion of the event content corresponding to the interactions between roles.

[0126] Generally, events closely related to characters are more important to the narrative. Within an event, the more characters, the more frequent their interactions, and the more detailed the descriptions of those interactions, the stronger the connection between the event and the characters, resulting in a higher character association score. The detailed descriptions of character interactions are calculated as the proportion of the event's content containing these interactions; a higher proportion indicates a stronger connection.

[0127] Multiple events and the third scoring instruction are input into the preset large language model to obtain the role association index value corresponding to each event. The third scoring instruction is used to make the preset large language model quantify the role association degree of each event within the third preset score range.

[0128] The third scoring instruction includes the aforementioned quantitative rules for the degree of role association. Optionally, the third preset score range is determined by a third lower limit and a third upper limit, for example, it can be 0-1. The closer the role association index value of an event is to the third lower limit, the lower the degree of role association of the event; the closer the role association index value of an event is to the third upper limit, the higher the degree of role association of the event.

[0129] Specifically, when the role association index is related to any one of the following influencing factors: the number of roles appearing in the event, the frequency of role interactions in the event, or the proportion of descriptive content corresponding to interactions between roles to the total event content, the score of that influencing factor within the third preset score range is used as the role association index value for the event. When the role association index is related to multiple influencing factors, the score values ​​of each influencing factor are weighted and summed or averaged to obtain the role association index value for the event.

[0130] The following section introduces the quantitative scoring methods for each influencing factor of the role-related index value.

[0131] When the influencing factors of the role association index value include the number of roles appearing in the event, the maximum number of roles in a single event is determined based on the number of roles in multiple events corresponding to the original text content. This corresponds to the third upper limit of the third preset score range, and a number of roles of 0 corresponds to the third lower limit of the third preset score range. In this way, different numbers of roles are mapped to the third preset score range to obtain the score value of the influencing factor of the number of roles in the event.

[0132] Taking a maximum of 10 characters as an example, if 10 characters appear in an event, the score for the factor of "number of characters" is 1. If no characters appear in an event, the score for the factor of "number of characters" is 0.

[0133] For example, in the event "Character A goes to a convenience store to buy breakfast", only Character A appears in this event, the number of characters is 1, and the score of the influencing factor of the number of characters is 0.1.

[0134] For example, in the event "Character B and a friend climbed a mountain together on the weekend and reached the summit", there are two characters in this event: Character A and a friend. The score for the factor of the number of characters is 0.2.

[0135] For example, in the event "Character C spent half a year crossing the desert through various dangers", there is Character C, three other characters who helped him, and six villains who posed a danger to Character C. The total number of characters is 10, and the score for the influence factor of the number of characters is 1.

[0136] The interaction frequency of a character in an event is the ratio of the number of times a character interacts during the event to the corresponding time. When the influencing factors of a character's associated metric value include the interaction frequency of the character during the event, the interaction frequency can be compared with multiple preset frequency thresholds to obtain the corresponding score.

[0137] For example, a first frequency threshold and a second frequency threshold are set, where the first frequency threshold is less than the second frequency threshold. In an event, if a character's interaction frequency is less than the first frequency threshold, then the rating value for this influencing factor is determined to be the first frequency rating value. If a character's interaction frequency is greater than or equal to the first frequency threshold and less than the second frequency threshold, then the rating value for this influencing factor is determined to be the second frequency rating value. If a character's interaction frequency is greater than or equal to the second frequency threshold, then the rating value for this influencing factor is determined to be the third frequency rating value.

[0138] Additionally, if there is no interaction between characters in an event, the score for the factor of the frequency of interaction between characters in that event is determined to be the third lower limit.

[0139] For example, in the event "Character A goes to a convenience store to buy breakfast", there is no interaction between the characters in this event, so the score for the influencing factor of the frequency of character interaction in this event is determined to be the third lower limit (e.g., 0).

[0140] For example, in the event "Character B and a friend climbed a mountain together on the weekend and reached the summit", the interaction frequency between Character B and his friend is relatively high, exceeding the second frequency threshold. Therefore, the rating value of the interaction frequency of the characters in this event is the third frequency rating value.

[0141] For example, in the event "Character C spent half a year crossing the desert through various dangers", there are interactions such as other characters helping Character C, and villains threatening and confronting Character C. However, the event corresponds to a long period of time. Therefore, the frequency of interaction between characters in this event is greater than the first frequency threshold and less than the second frequency threshold. Thus, the score of the influencing factor of the frequency of interaction between characters in this event is the second frequency score value.

[0142] It is understandable that the number and value of frequency thresholds can be adjusted according to actual needs; the above is merely an example for ease of description.

[0143] When the influencing factors of the role association index value include the proportion of the description content corresponding to the interaction between roles to the event content, the third upper limit value is determined when the proportion is 100%, and the third lower limit value is determined when the proportion is 0%. The proportion of the description content corresponding to the interaction between roles to the event content in different events is mapped to the third preset score range to obtain the corresponding score value.

[0144] For example, in the event "Character A goes to a convenience store to buy breakfast", there is no interaction between characters in this event. Therefore, the score of the influencing factor that corresponds to the description of interaction between characters to the event content is the third lower limit (e.g., 0).

[0145] For example, in the event "Character B and a friend climbed a mountain together on the weekend and reached the summit", the description of the interaction between Character B and his friend accounts for 90% of the event content. Taking the third preset score range of 0-1 as an example, the score of the influencing factor of the proportion of the description of the interaction between characters to the event content is 0.9.

[0146] For example, in the event "Character C spent half a year crossing the desert through various dangers", the description of the interaction between Character C and other characters accounts for 50% of the event content. Taking the third preset score range of 0-1 as an example, the score of the influencing factor of the proportion of the description of the interaction between characters to the event content is 0.5.

[0147] In summary, taking the second frequency score of 0.6 and the third frequency score of 0.9 as an example, and rounding the results to two decimal places, the role association index value for the event "Character A goes to a convenience store to buy breakfast" is 0.03, the role association index value for the event "Character B climbs a mountain with a friend on the weekend and reaches the summit" is 0.67, and the role association index value for the event "Character C spends half a year crossing the desert through various dangers" is 0.7. It can be seen that the role association index value can reflect the degree of association between the characters in the event.

[0148] Furthermore, for each event, after obtaining multiple importance index values ​​for that event, a weighted average is calculated to obtain the importance score for that event.

[0149] Optionally, when each importance indicator value has the same weight, it is equivalent to calculating the average of multiple importance indicators to obtain the importance score of the event.

[0150] A higher importance score indicates that an event is more important within the original text and should be selected as a key event. Conversely, a lower importance score indicates that an event is less important within the original text and should not be selected if there is a limit to the number of key events.

[0151] For example, for the three events mentioned above, the average value of multiple importance indicators for "Character A goes to a convenience store to buy breakfast" is the lowest, and its priority is the lowest when selecting key events. The average value of multiple importance indicators for "Character B climbs a mountain with a friend on the weekend and reaches the summit" is in the middle. The average value of multiple importance indicators for "Character C spends half a year crossing the desert through various dangers" is the highest, and its priority is the highest when selecting key events.

[0152] Optionally, the number of key events (events with an importance score greater than a preset threshold) is positively correlated with the number of words in the first target text content. That is, it is positively correlated with the number of words required by the first preset condition. Correspondingly, the preset threshold for the importance score when selecting key events is also positively correlated with the number of words required by a preset condition.

[0153] The more words required by the first preset condition, the higher the preset threshold will be when selecting key events from multiple events corresponding to the original text content, and the more key events will be selected; the fewer words required by the first preset condition, the lower the preset threshold will be, and the fewer key events will be selected.

[0154] This embodiment of the disclosure uses quantitative scoring from multiple dimensions, including plot conflict, plot development, and character relationships, to ensure that the importance score of an event comprehensively and accurately reflects its criticality, avoiding misjudgment based on a single dimension. Ultimately, the key events selected based on the importance score retain the core conflict, narrative logic, and development of the original text content, further improving the quality of the subsequent primary target text content.

[0155] Based on any of the above embodiments, before generating the first target text content corresponding to the original text content based on the event node sequence, constraint information corresponding to the original text content is obtained. The constraint information includes one or more of the following: character relationship information, theme descriptive words, and narrative style features.

[0156] Accordingly, after generating the first target text content corresponding to the original text content based on the event node sequence, the second target text content corresponding to the original text content is generated based on the first target text content and the constraint information. The second target text content includes the event description content and the content corresponding to the constraint information.

[0157] Constraint information refers to key information that limits and guides the generation process. Among them, character relationship information reflects the interaction patterns, emotional connections, or conflicts of interest between characters; theme descriptive words reflect the core ideas that the original text content wants to convey; and narrative style characteristics reflect the linguistic features of the original text content.

[0158] The first target text content generated in the above embodiments is a core plot summary formed after event screening, retaining the basic logic and key plot of the original text content. The second target text is content that is further re-created based on the constraint information and the first target text content. It not only includes descriptions of key events, but also incorporates artistic features such as character development or changes in character relationships, the themes of the original text content, and narrative style, making the second target text more impactful and profound.

[0159] Optionally, the first target text content can be re-created using a preset large language model to obtain the second target text content. Specifically, a preset second prompt information template is obtained. This template includes at least one third placeholder, which corresponds one-to-one with constraint information. When multiple constraint information exists, multiple third placeholders exist accordingly. The third placeholders are then replaced with constraint information to obtain the second prompt information.

[0160] Furthermore, a second preset condition is set for the second target text content to determine the number of words in the second target text content. A second prompt message is generated based on the first target text content, constraint information, and the second preset condition; this second prompt message is then input into a preset large language model to obtain the second target text content corresponding to the original text content.

[0161] The second preset condition can be the same as the first preset condition or different from the first preset condition.

[0162] For example, when the second preset condition is the same as the first preset condition, the second target text content is generated based on the keyword set and the first target text content, which is equivalent to only adjusting the expression of the first target text content; when the second preset condition is different from the first preset condition, the second target text content is generated based on the keyword set and the first target text content, which means that the second target text content needs to be further abbreviated or expanded based on the first target text content.

[0163] For example, based on the first preset condition, a first target text content of 800 characters is generated; based on the second preset condition, the first target text content is further abbreviated to generate a second target text content of 500 characters.

[0164] In some embodiments, when the constraint information includes role relationship information, obtaining the constraint information corresponding to the original text content includes: obtaining the role relationship information corresponding to the original text content; wherein, the role relationship information includes the relationship attributes between roles and / or the relationship change process.

[0165] Accordingly, generating second target text content corresponding to the original text content based on the first target text content and constraint information includes: generating second target text content corresponding to the original text content based on the first target text content and role relationship information, wherein the second target text content includes role description content corresponding to the role relationship information.

[0166] When compressing original texts involving characters, such as novels and biographies, complex information such as the character's personality, motivations, and growth arc is easily lost, making the character image thin.

[0167] Therefore, by utilizing the role relationship information to retain the role relationships in the original text content, the second target text content generated based on the first target text content and the role relationship information includes role description content, which can describe the role image, role relationship and other content, forming a full-bodied role image.

[0168] Specifically, the process of obtaining the role relationship information corresponding to the original text content includes: identifying multiple role names in the original text content; obtaining the relationship change information between the roles corresponding to the role names based on the fragments in the original text content that contain at least two role names; and constructing a role relationship graph corresponding to the original text content with the role names as vertices and the relationship change information as the relationship edges between the vertices. The role relationship graph is used to describe the role relationship information.

[0169] Optionally, the named entity recognition capability of a pre-defined large language model is utilized to identify character name entities in the original text content. For segments of the original text content containing at least two character names, the causes, processes, and results of interactions between the characters are analyzed to obtain the relationship attributes and relationship changes between the characters, which are then used as the relationship edges between the vertices corresponding to each character, ultimately resulting in a character relationship graph corresponding to the original text content. The character relationship graph can be graph data in JSON format.

[0170] For example, a fragment containing at least two character names and relationship extraction prompts are input into a preset large language model to obtain a character relationship graph output by the preset large language model. The relationship extraction prompts are used to enable the preset large language model to analyze the character relationship information in the input text content, such as "Analyze the interaction between [Character A] and [Character B] in the following text, describe their relationship and its changes in this text."

[0171] Optionally, the roles involved in the role relationship information are key roles that have been filtered. The filtering methods include, but are not limited to, roles that appear more than a preset threshold number of times in the original text content, and roles corresponding to entities whose relationship edges connected in the role relationship graph exceed a preset threshold number.

[0172] This embodiment of the disclosure uses role relationship information as constraint information when generating the second target text content, so that the second target text content also includes character descriptions corresponding to the role relationship information. Therefore, the second target text content can not only describe the key events corresponding to the original text content in sequence, but also describe the role relationship information corresponding to the original text content. While retaining the key events and the sequential relationships between events in the original text content, it also retains the character relationship descriptions in the original text content, making the character images in the second target text content more three-dimensional and further improving its text quality.

[0173] In some embodiments, the original text content includes a pre-marked first sampled paragraph.

[0174] When the constraint information includes topic descriptive words, the constraint information corresponding to the original text content is obtained, including: inputting the first sampled paragraph and the first preset instruction into the preset large language model to obtain the topic descriptive words output by the preset large language model. The first preset instruction is used to enable the preset large language model to analyze the theme and / or emotional tone expressed by the first sampled paragraph.

[0175] In text regeneration scenarios, taking text summarization as an example, simple word count and length compression may obscure the deeper themes and meanings that the original text intends to convey. Therefore, by rewriting the first target text content using thematic descriptive words corresponding to the original text content, a second target text content can be obtained, which can retain the deeper themes and meanings of the original text content in terms of emotional expression.

[0176] The first sampled paragraph is a pre-labeled representative paragraph that reflects the main theme and / or emotional tone of the original text content; for example, it could be a summary paragraph from the original text content. The first sampled paragraph, along with a first preset instruction, is input into a preset large language model to obtain the topic descriptors corresponding to the first sampled paragraph, which are also the topic descriptors corresponding to the original text content.

[0177] Optionally, the first preset instruction is used to guide the preset large language model to extract the topic descriptive words corresponding to the first sampled paragraph, such as "summarize the core theme of the input content and determine its main emotional tone".

[0178] The theme includes the viewpoints, principles, or understanding of the world that the original text wants to convey, while the emotional tone refers to the emotional atmosphere conveyed by the original text, such as sadness, passion, or irony.

[0179] Accordingly, generating second target text content corresponding to the original text content based on the first target text content and constraint information includes: generating second target text content corresponding to the original text content based on the first target text content and topic descriptive words, wherein the second target text content includes descriptive content corresponding to the topic descriptive words.

[0180] By integrating the topic descriptors with the content of the first target text, the second target text retains the key events in the original text while also integrating the core theme of the original text, making the content expressed by the topic descriptors an implicit clue to the content of the event description.

[0181] This embodiment extracts topic descriptive words based on a first sampled segment to obtain topic descriptive words corresponding to the original text content. It then further re-creates the first target text content based on these topic descriptive words to obtain second target text content including descriptive content corresponding to the topic descriptive words. This solves the problem of topic loss in traditional text re-creation, enabling the second target text content to convey the theme and emotional tone of the original text based on topic descriptive words without losing the logically related key events contained in the first target text content. This improves the artistry of the second target text content and further enhances the quality of the generated text content.

[0182] In some embodiments, the original text content includes a pre-tagged second sampled paragraph. The second sampled paragraph is used to obtain narrative style features of the original text content.

[0183] Narrative style refers to the linguistic expression of text content, reflecting the writing style of the original author. In the process of regenerating text content, writing style is often overlooked, especially for original texts with strong artistic merit, such as novels and essays. The loss of writing style can render the generated text lacking in artistic appeal.

[0184] Therefore, using the narrative style features extracted from the original text content as the basis for generating the second target text content can enable the second target text content to have narrative style features similar to the original text content.

[0185] The following section introduces various ways to obtain narrative style characteristics.

[0186] When the constraint information includes narrative style features, the constraint information corresponding to the original text content is obtained, including: inputting the second sampled paragraph and the second preset instruction into the preset large language model to obtain the narrative style features output by the preset large language model. The second preset instruction is used to enable the preset large language model to analyze the narrative style of the second sampled paragraph.

[0187] The second sampling segment is a representative segment from the original text content that is pre-marked and can reflect the textual features of the original text content, such as the segment corresponding to a key event.

[0188] The pre-defined large language model analyzes the narrative style features of the second sampled paragraph through the guidance of the second pre-defined instructions, such as recurring metaphors and frequently used dialect words, and integrates these elements to obtain the narrative style features of the second sampled paragraph, that is, the narrative style features corresponding to the original text content.

[0189] Alternatively, when the constraint information includes narrative style features, the constraint information corresponding to the original text content is obtained, including: determining the narrative style features based on the text features of the second sampled paragraph, where the text features include at least one of average sentence length, lexical density, and high-frequency word distribution features.

[0190] Among these, average sentence length reflects the narrative rhythm of the second sampled paragraph; for example, short sentences correspond to a fast narrative rhythm, while long sentences correspond to a slow narrative rhythm. Lexical density reflects the linguistic conciseness of the second sampled paragraph; for example, the proportion of content words in the second sampled paragraph. The distribution of high-frequency words reflects the word usage preferences of the second sampled paragraph. Through statistical analysis of these indicators, the corresponding narrative style characteristics can be derived.

[0191] Alternatively, when the constraint information includes narrative style features, obtain the constraint information corresponding to the original text content, including: obtaining the preset narrative style features.

[0192] The preset narrative style features represent the text style that the user expects, thus obtaining a second target text content with a different writing style from the original text content, in order to meet the needs of style conversion of the original text content.

[0193] Accordingly, the generation of second target text content corresponding to the original text content based on the first target text content and constraint information includes: generating second target text content corresponding to the original text content based on the first target text content and narrative style features, wherein the second target text content possesses narrative style features.

[0194] This embodiment of the disclosure obtains the narrative style features of the original text content through a second sample paragraph. Based on this, the generated second target text content has a writing style similar to the original text content. In text content regeneration scenarios such as summary generation, the final generated text content can effectively retain or imitate the writing style of the original text content while not lacking the description of key events. Especially when the original text content has a high degree of artistry, it can effectively improve the artistry of the second target text content and further improve the text quality.

[0195] In addition, by setting various methods for determining narrative style features, the embodiments of this disclosure can meet the needs of various scenarios and improve the flexibility of text re-creation.

[0196] Based on any of the above embodiments, after obtaining the first target text content or the second target text content, it is necessary to format the first target text content or the second target text content.

[0197] Optionally, a content title can be generated for either the first target text content or the second target text content based on the text name or topic of the original text content.

[0198] Optionally, text processing functions (such as string formatting functions and paragraph formatting functions) can be used to adjust the format of the first or second target text content to ensure that the text is correctly encoded, conforms to mainstream text encoding forms (such as UTF-8 encoding), and conforms to certain formats, such as font, font size, paragraph spacing, etc.

[0199] Finally, the formatted first or second target text content is stored as a file in the specified path. The file format can be txt or md, so that users can directly read the first or second target text content in the specified path.

[0200] Figure 2 A flowchart of a text content generation method provided in another embodiment of this disclosure is shown below. Figure 2 As shown, the method includes the following steps:

[0201] S201. Obtain the original text content.

[0202] S202. Preprocess the original text content.

[0203] S203. Extract the event node sequence and constraint information of the preprocessed original text content.

[0204] Specifically, multiple events are extracted from the original text content; an importance score for each event is calculated based on multiple importance assessment indicators, and events with an importance score greater than a preset threshold are selected as key events, thus obtaining an event node sequence composed of key events.

[0205] Constraint information includes one or more of the following: character relationship information, theme descriptive words, and narrative style characteristics.

[0206] S204. Generate the first target text content based on the event node sequence.

[0207] S205. Generate the second target text content based on the constraint information and the first target text content.

[0208] S206. Format the content of the first target text and / or the second target text.

[0209] It is understandable that the aforementioned preset large language models can be different sub-models within the same large language model, the same preset large language model, different preset large language models, or any other combination of models, as long as they can achieve the functions in each step.

[0210] Optionally, corresponding illustrations, storyboards, or concept art can be generated based on the second target text.

[0211] Optionally, dedicated models and / or sub-models can be trained for different literary genres (such as science fiction, martial arts, and romance), and then the appropriate model can be selected based on the literary genre of the original text content to implement the above process.

[0212] Based on the above text content generation process, by finely controlling and constraining the generation process from different angles, we can obtain a second target text that is accurate in content, complete and reasonable in structure, vivid in character image, and appropriate in style, thus ensuring the narrative and artistic quality of the output text content and obtaining high-quality output text content.

[0213] Figure 3This is a schematic diagram of the structure of a text content generation apparatus provided in an embodiment of this disclosure. The text content generation apparatus provided in this embodiment can execute the processing flow provided in the text content generation method embodiment, such as... Figure 3 As shown, the text content generation device 30 includes: an event extraction module 31, a calculation module 32, a first determination module 33, and a first generation module 34. The event extraction module 31 is used to extract multiple events from the original text content. The calculation module 32 is used to calculate the importance score of each event according to multiple importance evaluation indicators. The first determination module 33 is used to determine the event node sequence corresponding to the original text content according to the importance score of each event. The event node sequence includes at least one event node with an order relationship, and the event node is used to identify events with an importance score greater than a preset threshold. The first generation module 34 is used to generate a first target text content corresponding to the original text content based on the event node sequence. The first target text content includes event description content corresponding to the events identified by the event nodes.

[0214] Optionally, the first generation module 34 includes a first acquisition unit, a replacement unit, and a first input unit; the first acquisition unit is used to acquire a preset first prompt information template, the first prompt information template including a first placeholder; the replacement unit is used to replace the first placeholder in the first prompt information template with an event node sequence to obtain the first prompt information, the first prompt information being used to guide a preset large language model to generate event description content according to the event node sequence; the first input unit is used to input the first prompt information into the preset large language model to obtain the first target text content corresponding to the original text content.

[0215] Optionally, the first prompt information template includes a second placeholder, and the replacement unit is further used to replace the first placeholder in the first prompt information template with an event node sequence and replace the second placeholder with a first preset condition to obtain the first prompt information; wherein, the first preset condition is used to determine the number of characters in the first target text content.

[0216] Optionally, the event extraction module includes a second input unit, a second acquisition unit, and a third acquisition unit; the second input unit is used to input the first sub-text content into a preset large language model for event extraction, and obtain at least one event corresponding to the first sub-text content; the second acquisition unit is used to input the sub-text content and at least one event corresponding to the previous sub-text content into the preset large language model for event extraction, starting from the second sub-text content, and obtain at least one event corresponding to each sub-text content; the third acquisition unit is used to obtain multiple events corresponding to the original text content based on at least one event corresponding to each of the multiple sub-text contents.

[0217] Optionally, the calculation module includes a third input unit and a calculation unit. The third input unit is used to input the calculation rules of multiple events and multiple importance assessment indicators into a preset large language model to obtain multiple importance indicator values ​​corresponding to each event. The importance indicator values ​​correspond one-to-one with the importance assessment indicators. The calculation unit is used to perform weighted calculation for each event according to the preset weights of multiple importance assessment indicators and the multiple importance indicator values ​​corresponding to the event to obtain the importance score of the event.

[0218] Optionally, the importance assessment index includes a plot conflict index. The third input unit is specifically used to input multiple events and the first scoring instruction into the preset large language model to obtain the plot conflict index value corresponding to each event. The first scoring instruction is used to enable the preset large language model to quantify the degree of plot conflict of each event within a first preset score range. The plot conflict index value is positively correlated with the degree of plot conflict. The degree of plot conflict represents at least one of the following: the time taken by the character to achieve the goal in the event, the number of obstacles encountered in the process of the character achieving the goal, the density of obstacles, and the duration of the obstacles.

[0219] Optionally, the importance assessment indicators include plot development indicators. The third input unit is specifically used to input multiple events and the second scoring instruction into the preset large language model to obtain the plot development indicator value corresponding to each event. The second scoring instruction is used to enable the preset large language model to quantify the degree of plot development of each event within a second preset score range. The plot development indicator value is positively correlated with the degree of plot development. The degree of plot development includes a first semantic difference degree and / or a second semantic difference degree. The first semantic difference degree is the difference between the semantics of the character's description at the beginning of the event and the semantics of the character's description at the end of the event. The second semantic difference degree is the difference between the semantics of the plot description at the beginning of the event and the semantics of the plot description at the end of the event.

[0220] Optionally, the importance assessment indicators include role association indicators. The third input unit is specifically used to input multiple events and the third scoring instruction into the preset large language model to obtain the role association indicator value corresponding to each event. The third scoring instruction is used to make the preset large language model quantify the role association degree of each event within the third preset score range. The role association indicator value is positively correlated with the role association degree. The role association degree represents at least one of the following: the number of roles appearing in the event, the frequency of interaction between roles in the event, and the proportion of the description content corresponding to the interaction between roles to the event content.

[0221] Optionally, the number of key events is positively correlated with the number of words in the first target text content.

[0222] Optionally, the text content generation device 30 further includes an acquisition module and a second generation module; wherein, the acquisition module is used to acquire constraint information corresponding to the original text content, the constraint information including one or more of the following: character relationship information, theme descriptive words, and narrative style features; the second generation module is used to generate second target text content corresponding to the original text content based on the first target text content and the constraint information, the second target text content including event description content and content corresponding to the constraint information.

[0223] Optionally, the second generation module is specifically used to generate second prompt information based on the first target text content, constraint information, and second preset conditions; input the second prompt information into a preset large language model to obtain the second target text content corresponding to the original text content, wherein the number of characters in the second target text content meets the second preset conditions.

[0224] Optionally, the acquisition module includes a role relationship acquisition unit. When the constraint information includes role relationship information, the role relationship acquisition unit is used to acquire the role relationship information corresponding to the original text content; wherein, the role relationship information includes the relationship attributes between roles and / or the relationship change process; the second generation module is used to generate a second target text content corresponding to the original text content based on the first target text content and the role relationship information, wherein the second target text content includes role description content corresponding to the role relationship information.

[0225] Optionally, the role relationship acquisition unit is specifically used to identify multiple role names in the original text content; based on the fragments in the original text content that contain at least two role names, to obtain the relationship change information between the roles corresponding to the role names; and to construct a role relationship graph corresponding to the original text content with the role names as vertices and the relationship change information as the relationship edges between the vertices, the role relationship graph being used to describe the role relationship information.

[0226] Optionally, the acquisition module includes a topic descriptor acquisition unit. The original text content includes a pre-labeled first sampled paragraph. When the constraint information includes topic descriptors, the topic descriptor acquisition unit is used to input the first sampled paragraph and a first preset instruction into a preset large language model to obtain the topic descriptors output by the preset large language model. The first preset instruction is used to enable the preset large language model to analyze the theme and / or emotional tone expressed by the first sampled paragraph. The second generation module is used to generate a second target text content corresponding to the original text content based on the first target text content and the topic descriptors. The second target text content includes descriptive content corresponding to the topic descriptors.

[0227] Optionally, the acquisition module includes a narrative style feature acquisition unit. The original text content includes a pre-labeled second sampled paragraph. When the constraint information includes narrative style features, the narrative style feature acquisition unit is used to input the second sampled paragraph and the second preset instruction into a preset large language model to obtain the narrative style features output by the preset large language model. The second preset instruction is used to enable the preset large language model to analyze the narrative style of the second sampled paragraph. Alternatively, the narrative style features are determined based on the text features of the second sampled paragraph. The text features include at least one of average sentence length, vocabulary density, and high-frequency word distribution features. Alternatively, preset narrative style features are acquired.

[0228] Optionally, the second generation module is used to generate a second target text content corresponding to the original text content based on the first target text content and narrative style features, wherein the second target text content has narrative style features.

[0229] Figure 3 The text content generation apparatus of the illustrated embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effect are similar, and will not be repeated here.

[0230] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. The electronic device can be a terminal with data processing capabilities as described in the above embodiments. The electronic device provided in this embodiment of the present disclosure can execute the processing flow provided in the text content generation method embodiments, such as… Figure 4 As shown, the electronic device 40 includes: a memory 41, a processor 42, a computer program, and a communication interface 43; wherein the computer program is stored in the memory 41 and configured to be executed by the processor 42 as described above in the text content generation method.

[0231] In addition, this disclosure also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the text content generation method described in the above embodiments.

[0232] Furthermore, this disclosure also provides a computer program product, which includes a computer program or instructions that, when executed by a processor, implement the text content generation method described above.

[0233] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0234] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. 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 this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for generating text content, characterized in that, The method includes: Extract multiple events from the original text content; An importance score for each event is calculated based on multiple importance assessment metrics; The event node sequence corresponding to the original text content is determined based on the importance score of each event; wherein, the event node sequence includes at least one event node with an order relationship, and the event node is used to identify events whose importance score is greater than a preset threshold; Based on the event node sequence, a first target text content corresponding to the original text content is generated. The first target text content includes event description content corresponding to the event identified by the event node.

2. The method according to claim 1, characterized in that, The step of generating the first target text content corresponding to the original text content based on the event node sequence includes: Obtain a preset first prompt information template, wherein the first prompt information template includes a first placeholder; Replace the first placeholder in the first prompt information template with the event node sequence to obtain the first prompt information. The first prompt information is used to guide the preset large language model to generate the event description content according to the event node sequence. The first prompt information is input into the preset large language model to obtain the first target text content corresponding to the original text content.

3. The method according to claim 2, characterized in that, The first prompt message template includes a second placeholder. The step of replacing the first placeholder in the first prompt message template with the event node sequence to obtain the first prompt message includes: The first placeholder in the first prompt information template is replaced with the event node sequence, and the second placeholder is replaced with the first preset condition to obtain the first prompt information; wherein, the first preset condition is used to determine the number of characters in the first target text content.

4. The method according to claim 1, characterized in that, The original text content includes multiple sub-text contents, and the extraction of multiple events from the original text content includes: The first sub-text content is input into a preset large language model for event extraction to obtain at least one event corresponding to the first sub-text content; Starting from the second sub-text content, the sub-text content and at least one event corresponding to the previous sub-text content are input into the preset large language model for event extraction, so as to obtain at least one event corresponding to each sub-text content; Based on at least one event corresponding to each of the multiple sub-text contents, multiple events corresponding to the original text content are obtained.

5. The method according to claim 1, characterized in that, The calculation of the importance score for each event based on multiple importance assessment metrics includes: The calculation rules for the multiple events and the multiple importance assessment indicators are input into a preset large language model to obtain multiple importance indicator values ​​corresponding to each event, and the importance indicator values ​​correspond one-to-one with the importance assessment indicators. For each event, an importance score is obtained by weighting the event according to the preset weights of the plurality of importance assessment indicators and the values ​​of the plurality of importance indicators corresponding to the event.

6. The method according to claim 5, characterized in that, The importance assessment indicators include plot conflict indicators. The calculation rules for the multiple events and the multiple importance assessment indicators are input into a preset large language model to obtain multiple importance indicator values ​​corresponding to each event, including: The multiple events and the first scoring instruction are input into a preset large language model to obtain a plot conflict index value corresponding to each event. The first scoring instruction is used to enable the preset large language model to quantify the plot conflict degree of each event within a first preset score range. The plot conflict index value is positively correlated with the plot conflict degree. The plot conflict degree represents at least one of the following: the time taken by the character to achieve the goal in the event, the number of obstacles encountered by the character in achieving the goal, the density of the obstacles, and the duration of the obstacles.

7. The method according to claim 5, characterized in that, The importance assessment indicators include plot development indicators. The calculation rules for the multiple events and the multiple importance assessment indicators are input into a preset large language model to obtain multiple importance indicator values ​​corresponding to each event, including: The multiple events and the second scoring instruction are input into a preset large language model to obtain a plot development index value corresponding to each event. The second scoring instruction is used to enable the preset large language model to quantify and score the plot development degree of each event within a second preset score range. The plot development index value is positively correlated with the plot development degree. The plot development degree includes a first semantic difference degree and / or a second semantic difference degree. The first semantic difference degree is the difference between the semantics of the character's description at the beginning of the event and the semantics of the character's description at the end of the event. The second semantic difference degree is the difference between the semantics of the plot description at the beginning of the event and the semantics of the plot description at the end of the event.

8. The method according to claim 5, characterized in that, The importance assessment indicators include role association indicators. The calculation rules for the multiple events and the multiple importance assessment indicators are input into a preset large language model to obtain multiple importance indicator values ​​corresponding to each event, including: The multiple events and the third scoring instruction are input into a preset large language model to obtain the role association index value corresponding to each event. The third scoring instruction is used to enable the preset large language model to quantify and score the role association degree of each event within a third preset score range. The role association index value is positively correlated with the role association degree. The role association degree represents at least one of the following: the number of roles appearing in the event, the interaction frequency of the roles in the event, and the proportion of the description content corresponding to the interaction between the roles to the content of the event.

9. The method according to claim 1, characterized in that, The number of events with an importance score greater than a preset threshold is positively correlated with the number of words in the first target text content.

10. The method according to any one of claims 1-9, characterized in that, Before generating the first target text content corresponding to the original text content based on the event node sequence, the method further includes: Obtain constraint information corresponding to the original text content, wherein the constraint information includes one or more of the following: character relationship information, theme descriptive words, and narrative style features; After generating the first target text content corresponding to the original text content based on the event node sequence, the method further includes: Based on the first target text content and the constraint information, a second target text content corresponding to the original text content is generated. The second target text content includes event description content and content corresponding to the constraint information.

11. The method according to claim 10, characterized in that, The step of generating the first target text content corresponding to the original text content based on the event node sequence and the constraint information includes: A second prompt message is generated based on the first target text content, the constraint information, and the second preset conditions; The second prompt information is input into a preset large language model to obtain the second target text content corresponding to the original text content. The number of characters in the second target text content meets the second preset condition.

12. The method according to claim 10, characterized in that, When the constraint information includes role relationship information, obtaining the constraint information corresponding to the original text content includes: Obtain the role relationship information corresponding to the original text content; wherein, the role relationship information includes the relationship attributes between roles and / or the relationship change process; The step of generating the second target text content corresponding to the original text content based on the first target text content and the constraint information includes: Based on the first target text content and the character relationship information, a second target text content corresponding to the original text content is generated. The second target text content includes character description content corresponding to the character relationship information.

13. The method according to claim 12, characterized in that, The step of obtaining the role relationship information corresponding to the original text content includes: Identify multiple character names in the original text content; Based on the original text content containing at least two of the character names, obtain the relationship change information between the characters corresponding to the character names; Using the character name as the vertex and the relationship change information as the relationship edges between the vertices, a character relationship graph corresponding to the original text content is constructed. The character relationship graph is used to describe the character relationship information.

14. The method according to claim 10, characterized in that, The original text content includes a pre-labeled first sampled paragraph. When the constraint information includes the topic descriptor, obtaining the constraint information corresponding to the original text content includes: The first sampled paragraph and the first preset instruction are input into the preset large language model to obtain the topic description words output by the preset large language model. The first preset instruction is used to enable the preset large language model to analyze the theme and / or emotional tone expressed by the first sampled paragraph. The step of generating the second target text content corresponding to the original text content based on the first target text content and the constraint information includes: Based on the first target text content and the topic descriptor, a second target text content corresponding to the original text content is generated, wherein the second target text content includes descriptive content corresponding to the topic descriptor.

15. The method according to claim 10, characterized in that, The original text content includes a pre-labeled second sampled paragraph. When the constraint information includes the narrative style features, obtaining the constraint information corresponding to the original text content includes: The second sampled paragraph and the second preset instruction are input into a preset large language model to obtain the narrative style features output by the preset large language model. The second preset instruction is used to enable the preset large language model to analyze the narrative style of the second sampled paragraph; or... The narrative style features are determined based on the text features of the second sampled segment, wherein the text features include at least one of average sentence length, lexical density, and high-frequency word distribution features; or, Obtain preset narrative style features.

16. The method according to claim 15, characterized in that, The step of generating the second target text content corresponding to the original text content based on the first target text content and the constraint information includes: A second target text content corresponding to the original text content is generated based on the first target text content and the narrative style features, wherein the second target text content possesses the narrative style features.

17. A text content generation device, characterized in that, include: The event extraction module is used to extract multiple events from the original text content; The calculation module is used to calculate the importance score of each event based on multiple importance assessment metrics; The first determining module is used to determine the event node sequence corresponding to the original text content based on the importance score of each event; wherein the event node sequence includes at least one event node with an order relationship, and the event node is used to identify the event whose importance score is greater than a preset threshold; The first generation module is used to generate a first target text content corresponding to the original text content based on the event node sequence. The first target text content includes event description content corresponding to the event identified by the event node.

18. An electronic device, characterized in that, include: Memory; processor; as well as Computer programs; The computer program is stored in the memory and configured to be executed by the processor to implement the method as described in any one of claims 1-16.

19. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-16.