Long story text generation method and device and electronic equipment thereof

By determining the main event and refining the chapter outline during the story generation process, combining evaluation and structural control models, the content inconsistency caused by the linear event outline was solved, and high-quality long story text was generated.

CN120354837APending Publication Date: 2025-07-22TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510335768.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-20
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

In the prior art, automatic story generation methods based on large language models are likely to lead to problems such as inconsistent or divergence in the content before and after the linear event outline.

Method used

The long story text generation method is used to determine the main event through the foreground text, the outline agent is used to generate the event outline, the plan agent is to refine the chapter outline, and the long story text is generated by writing the agent, and the evaluation model and structural control model are combined to ensure the coherence and logic of the story.

Benefits of technology

It improves the information density of the event outline, provides a clear story framework, reduces the difficulty of obtaining key information, ensures the consistency and logic of the story, and significantly improves the quality of the generated long story text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354837A_ABST
    Figure CN120354837A_ABST
Patent Text Reader

Abstract

The invention provides a long story text generation method and device and electronic equipment thereof, and relates to the technical field of natural language processing. The method comprises the following steps: determining a foreground summary text; inputting the foreground summary text into a story generation model to obtain a long story text output by the story generation model; wherein the story generation model is used for determining a main line event based on the foreground summary text, obtaining an event outline according to the main line event, and generating the long story text based on the event outline, so that the risk that contents before and after the event outline are easily inconsistent or diverged during subsequent story extension can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of natural language processing, and in particular, to a method, device and electronic device for generating long story texts. Background Art

[0002] With the rapid development of artificial intelligence technology, the automatic story generation task based on large language models (LLMs) has become an important research direction in the field of natural language processing. Traditional methods mostly rely on the local coherence ability of language models, and promote the plot development through the connection of front and back sentences, and construct a linear event outline based on the way of generating descriptive language sentence by sentence. This linear event outline is prone to inconsistent or divergent front and back content when the subsequent story is extended. Summary of the Invention

[0003] Aiming at the problems existing in the prior art, the present invention provides a method, device and electronic device for generating long story texts.

[0004] The present invention provides a method for generating long story texts, including: Determine a foreground summary text; Input the foreground summary text into a story generation model to obtain a long story text output by the story generation model; Wherein, the story generation model is used to determine a main line event based on the foreground summary text, obtain an event outline according to the main line event, and generate the long story text based on the event outline.

[0005] According to a method for generating long story texts provided by the present invention, the story generation model includes an outline agent, a planning agent and a writing agent; The step of inputting the foreground summary text into the story generation model to obtain a story text output by the story generation model includes: Input the foreground summary text into the outline agent to obtain an event outline output by the outline agent; the outline agent is used to determine the main line event based on the foreground summary text and obtain an event outline according to the main line event; Input the event outline into the planning agent to obtain a chapter outline output by the planning agent; the planning agent is used to determine sub-events based on the main line event of the event outline and obtain a chapter outline according to the sub-events; Input the chapter outline into the writing agent to obtain the long story text output by the writing agent; the writing agent is used to determine sub-story texts based on the sub-events of the chapter outline and obtain the long story text according to the sub-story texts.

[0006] A method for generating a long story text according to the present invention, wherein the outline agent includes an event generation model; Input the foreground summary text into the outline agent to obtain an event outline output by the outline agent, including: Input the foreground summary text into the event generation model to obtain candidate events output by the event generation model; the event generation model is trained based on sample foreground summary texts and sample event outlines, and the sample event outlines include sample main events; When it is determined that the candidate event is the main event, repeatedly obtain the candidate events output by the event generation model until the last main event of the event outline is output by the event generation model.

[0007] A method for generating a long story text according to the present invention, wherein the outline agent further includes an evaluation model; Determining that the candidate event is the main event includes: Input the candidate event into the evaluation model to obtain an evaluation result output by the evaluation model, and the evaluation model is trained based on sample main events with labels; when the evaluation result is passed, determine that the candidate event is the main event.

[0008] A method for generating a long story text according to the present invention, wherein the planning agent includes an event refinement model and a chapter arrangement model; Input the event outline into the planning agent to obtain a chapter outline output by the planning agent, including: Input the event outline into the event refinement model to obtain sub-events corresponding to each main event in the event outline output by the event refinement model; the event refinement model is trained based on sample event outlines and sample sub-events; Input the sub-events into the chapter arrangement model to obtain a chapter outline output by the chapter arrangement model; the chapter arrangement model is trained based on sample sub-events and sample chapter outlines; the chapter arrangement model is used to perform non-linear narrative processing on the sub-events based on event relationships to obtain the chapter outline.

[0009] A method for generating a long story text according to the present invention, wherein the writing agent includes a text generation model; Input the chapter outline into the writing agent to obtain a story text output by the writing agent, including: Determine the target sub-events of the chapter outline, input the target sub-events into the text generation model, and obtain the candidate sub-story text output by the text generation model; the text generation model is trained based on sample sub-events and sample sub-story texts; When it is determined that the candidate sub-story text is the sub-story text, store the sub-story text in a specified location, repeat the step of obtaining the candidate sub-story text output by the text generation model until the last candidate sub-story text output by the text generation model is obtained, and obtain the long-story text according to the sub-story text.

[0010] According to a long-story text generation method provided by the present invention, the writing agent further includes a structure control model; After obtaining the candidate sub-story text output by the text generation model, the method further includes: Obtain a candidate story text based on the candidate sub-story text and the sub-story text generated in the previous step; Input the chapter outline, the candidate story text, and a first prompt word into the structure control model, and obtain a text judgment result output by the structure control model; When the text judgment result is not passed, determine that the candidate sub-story text is not the sub-story text; Input the chapter outline and a second prompt word into the structure control model, and obtain the sub-story text output by the structure control model.

[0011] According to a long-story text generation method provided by the present invention, obtaining a candidate story text based on the candidate sub-story text and the sub-story text generated in the previous step includes: Based on the event relationship between the candidate sub-story text and the sub-story text generated in the previous step, divide the sub-story text into key sub-story texts and non-key sub-story texts; Obtain a candidate story text based on the candidate sub-story text, the key sub-story text, and the sub-events corresponding to the non-key sub-story text.

[0012] The present invention also provides a long-story text generation device, including: A summary text determination module, configured to determine a foreground summary text; A story text output module, configured to input the foreground summary text into a story generation model, and obtain a long-story text output by the story generation model; wherein, the story generation model is used to determine a main event based on the foreground summary text, obtain an event outline according to the main event, and generate the long-story text based on the event outline.

[0013] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the method for generating a long-form story text as described in any of the above is implemented.

[0014] Compared with generating descriptive language sentence by sentence to construct a linear event outline, the method, apparatus, and electronic device for generating a long-form story text provided by the present invention determine the main events through a foreground summary text, obtain an event outline based on the main events, and generate the long-form story text based on the event outline, which can improve the information density of the event outline, provide a clear framework for subsequent story construction, reduce the difficulty of obtaining key information, and help maintain the coherence and logic of the story. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0016] Figure 1 It is a flowchart of the method for generating a long-form story text provided by the present invention.

[0017] Figure 2 It is a framework diagram of the method for generating a long-form story text provided by the present invention.

[0018] Figure 3 It is a structural diagram of the apparatus for generating a long-form story text provided by the present invention.

[0019] Figure 4 It is a structural diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the following will clearly and completely describe the technical solutions in the present invention in conjunction with the drawings in the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art without creative efforts based on the embodiments in the present invention belong to the scope of protection of the present invention.

[0021] The following will describe the method, apparatus, and electronic device for generating a long-form story text of the present invention in conjunction with Figures 1 - 4 Describe the method, apparatus, and electronic device for generating a long-form story text of the present invention.

[0022] Figure 1 It is a flowchart of the method for generating a long-form story text provided by the present invention, asFigure 1 As shown, the method includes the following steps: Step 101, determine the foreground summary text.

[0023] Specifically, the foreground summary text, also known as foreground summary prompts, refers to the input text used to generate a long story text. The foreground summary text can be the interactive text directly input by the user during the human-computer interaction process, or the text obtained by performing speech recognition on the speech input by the user. For example, when the user directly inputs "Generate a story about Xiaoming going to school" during the human-computer interaction process, "Generate a story about Xiaoming going to school" here is the foreground summary text.

[0024] Step 102, input the foreground summary text into the story generation model to obtain the long story text output by the story generation model; wherein, the story generation model is used to determine the main plot event based on the foreground summary text, obtain the event outline according to the main plot event, and generate the long story text based on the event outline.

[0025] Specifically, the main plot event refers to a complete plot node used to construct the story skeleton and logical framework, and can describe the key plot nodes of the story in the form of structured data. Each main plot event can include key elements such as time, place, and relationship. The event outline refers to the story skeleton and logical framework composed of the main plot events, which is used to guide the generation of the global narrative logic and detail expansion of the long story text.

[0026] Among them, the outline can be in the form of an event graph or in the form of a knowledge graph. Among them, the outline in the form of a knowledge graph is the preferred outline form, which can further provide the quality of the generated long story in dimensions such as creativity and logic.

[0027] The long story text refers to a story text whose length exceeds a certain threshold. The long story text can refer to a story text whose length exceeds 4000 words, or can refer to a story text whose length exceeds 8000 words, etc. The artistic styles of the long story text include scripts, poems, prose, etc. In this embodiment, based on training data in different forms and styles, the story generation model can generate long story text content in different forms and styles.

[0028] Taking the generation of a 10,000-word story about "a battle-hardened veteran and his loyal comrade" as an example, "a battle-hardened veteran and his loyal comrade" can be input into the story generation model. The story generation model can determine the main events such as "The Ambush" and "The Betrayal Revealed" based on "a battle-hardened veteran and his loyal comrade". Each event has corresponding settings, characters, actions, conflicts, and plot twists, etc. Then, an event outline can be obtained according to the main events, and a long story text of about 10,000 words can be generated based on the event outline.

[0029] It can be understood that in this embodiment, the languages of the foreground summary text and the generated long story text are not specifically limited. It can be Chinese, English, etc. The languages of the foreground summary text and the generated long story text are the same as the languages used when training the story generation model. For example, if the story generation model is trained based on English data, the languages of the foreground summary text and the generated long story text are English. The languages of the foreground summary text and the generated long story text can also be different from the languages used when training the story generation model. For example, fine-tuning the story generation model enables the story generation model to convert the foreground summary text into the languages used during training and output the long story text in the language of the foreground summary text. In this way, by supporting multiple languages, the application scope can be expanded.

[0030] Compared with generating descriptive language sentence by sentence to construct a linear event outline, the long story text generation method provided in the embodiment of the present invention determines the main events through the foreground summary text, obtains the event outline according to the main events, and generates the long story text based on the event outline, which can improve the information density of the event outline, provide a clear framework for subsequent story construction, reduce the difficulty of obtaining key information, and help maintain the coherence and logic of the story.

[0031] Based on the above embodiment, the story generation model includes an outline agent, a planning agent, and a writing agent; The inputting the foreground summary text into the story generation model to obtain the story text output by the story generation model includes: Inputting the foreground summary text into the outline agent to obtain the event outline output by the outline agent; the outline agent is used to determine the main events based on the foreground summary text and obtain the event outline according to the main events; Input the event outline into the planning agent to obtain the chapter outline output by the planning agent; the planning agent is used to determine sub-events based on the main event of the event outline and obtain the chapter outline according to the sub-events; Input the chapter outline into the writing agent to obtain the long story text output by the writing agent; the writing agent is used to determine the sub-story text based on the sub-events of the chapter outline and obtain the long story text according to the sub-story text.

[0032] The sub-event refers to the specific actions / scenes such as the execution steps and the choreographed narrative structure obtained by refining the main event. The chapter outline includes sub-events, which refers to an executable narrative framework formed by further splitting and arranging the event outline, providing a more explicit input for the writing agent and reducing the ambiguity of the generated long story text. The sub-story text refers to the short story text generated based on the sub-events, and the long story text can be obtained by combining the sub-story texts according to the chapter outline.

[0033] For example, the main event is an ambush, including time: before dawn; location: a foggy North Korean forest near the front line; characters: a veteran, a comrade-in-arms, an enemy patrol; action: the veteran and the comrade-in-arms encounter an ambush by the enemy patrol. Sub-event 1 is the silence before the ambush, including time: midnight; location: the forest entrance; characters: the veteran, the comrade-in-arms; action: the veteran and the comrade-in-arms rest at the forest entrance. Sub-event 2 is the outbreak of the ambush, including time: 2 am; location: the forest path; characters: the veteran, the comrade-in-arms, the enemy patrol; action: the outbreak of the enemy patrol's ambush. Sub-story text 1 is The fog clung tightly to the trees like a shroud, an unnatural silence... Sub-story text 2 is The chaos of the ambush erupted like a tide, sweeping over them mercilessly... Compared with the simple division of labor in the prior art where only the Plan Agent and Write Agent are constructed and the Multi-agent framework is formed by the central orchestrator for task allocation, in this embodiment, the outline agent generates the event outline according to the prospectus text. On this basis, the planning agent refines and generates the chapter outline according to the event outline. Further, the writing agent generates the long story text according to the chapter outline. By clearly and carefully dividing the work of the outline agent, the planning agent and the writing agent, the agents cooperate with each other to jointly generate a long story text whose length meets the specified standard.

[0034] Based on any of the above embodiments, the outline agent includes an event generation model; Input the prospectus text into the outline agent to obtain the event outline output by the outline agent, including: Input the foreground summary text into the event generation model to obtain candidate events output by the event generation model; the event generation model is trained based on sample foreground summary texts and sample event outlines, and the sample event outlines include sample main events. When it is determined that the candidate event is the main event, repeat the process of obtaining candidate events output by the event generation model until the last main event of the event outline is output by the event generation model.

[0035] A candidate event refers to an event output by the event generation model that has not been verified for its reasonableness and corresponds to the main event.

[0036] Exemplarily, the event generation model can determine the story ending based on the foreground summary text, and determine whether the output event is the last main event according to the story ending. If so, end the generation of candidate events; if not, continue the generation of candidate events.

[0037] Compared with directly taking the events output by the event generation model as the main events, in this embodiment, further judgment is made on the candidate events output by the event generation model. When it is determined that the candidate event is the main event, the step of repeating to obtain the candidate events output by the event generation model is performed to generate the next main event. Finally, the event outline is obtained based on each main event, which can increase the reasonableness of the event outline output by the outline agent and reduce the risk of incoherence between adjacent main events in the event outline.

[0038] Based on any of the above embodiments, the outline agent further includes an evaluation model. Determining that the candidate event is the main event includes: Input the candidate event into the evaluation model to obtain an evaluation result output by the evaluation model. The evaluation model is trained based on sample main events with labels; when the evaluation result is passed, determine that the candidate event is the main event.

[0039] The label can be used to indicate whether the sample main event passes or fails, or whether the sample main event is reasonable or unreasonable; when a test main event with a reasonable label is input into the trained evaluation model, the obtained evaluation result should be passed, and when a test main event with an unreasonable label is input into the trained evaluation model, the obtained evaluation result should be failed.

[0040] In this embodiment, the evaluation model is used to judge whether the candidate event is reasonable. When the candidate event is reasonable, it is determined that the candidate event is the main event, which can reduce the risk of incoherence between the generated main event and the previous main events.

[0041] In one embodiment, when the evaluation result is not passed, the event generation model can be controlled to re-output the candidate event. Exemplarily, the event generation model can be controlled to re-output the candidate event based on the event relationship.

[0042] Based on any of the above embodiments, the planning agent includes an event refinement model and a chapter arrangement model; Inputting the event outline into the planning agent to obtain a chapter outline output by the planning agent includes: Input the event outline into the event refinement model to obtain the refinement event corresponding to each main event in the event outline output by the event refinement model; the event refinement model is obtained by training based on the sample event outline and the sample refinement event; The segmented events are input into the chapter arrangement model to obtain the chapter outline output by the chapter arrangement model; the chapter arrangement model is obtained by training based on sample segmented events and sample chapter outlines; the chapter arrangement model is used to perform nonlinear narrative processing on the segmented events based on event relationships to obtain the chapter outline.

[0043] Event relationship refers to the relationship between the main events in the event outline. Event relationship may include cause-effect relationship, parent-child relationship, progressive relationship, etc. In this embodiment, the specific method for determining the relationship between the main events in the event outline is not further limited.

[0044] Non-linear narrative processing refers to the rearrangement of subdivided events without strictly following the order of events in the event outline.

[0045] Exemplarily, a customized prompt word can be generated by performing nonlinear narrative processing on segmented events according to event relationships to obtain a chapter outline. After initializing the chapter arrangement model, the customized prompt word is first input, and then the initialized chapter arrangement model is trained based on sample segmented events and sample chapter outlines to obtain a chapter arrangement model.

[0046] In this embodiment, the event refinement model is used to generate subdivided events corresponding to each main event in the event outline, the chapter arrangement model is used to perform nonlinear narrative processing on the subdivided events, and the event relationship constraint nonlinear narrative processing process is used to generate a chapter outline. This can enhance the interweaving of the story while ensuring that the sequence of the subdivided events in the chapter outline does not destroy the inherent logic of the story, generate complex structures such as flashbacks and interpolations, and enhance the drama and appeal of the story.

[0047] Based on any of the above embodiments, the writing agent includes a text generation model; Inputting the chapter outline into the writing agent to obtain the story text output by the writing agent includes: Determine the target sub - events of the chapter outline, and input the target sub - events into the text generation model to obtain the candidate sub - story text output by the text generation model; When it is determined that the candidate sub - story text is the sub - story text, store the sub - story text in a specified location, and repeat the step of obtaining the candidate sub - story text output by the text generation model until the last candidate sub - story text output by the text generation model is obtained, and obtain the long - form story text based on the sub - story text.

[0048] The candidate sub - story text refers to the short story text corresponding to the sub - events, which is output by the text generation model and has not been verified for its reasonableness.

[0049] Exemplarily, the text generation model can be trained based on sample sub - events and sample sub - story texts, or it can be a general inference model. As the function of the inference model for performing natural language processing tasks becomes more and more powerful, in order to reasonably arrange computing resources, a general inference model can be preferentially used as the text generation model. Here, the inference model refers to a type of large model in the field of artificial intelligence.

[0050] The specified location can be a local file in.txt,.json, etc. format, or a cloud object storage such as AWS S3.

[0051] Compared with directly using the story text output by the text generation model as the sub - story text, in this embodiment, the candidate sub - story text output by the text generation model is further judged. Only when it is determined that the candidate sub - story text is the sub - story text, the step of obtaining the candidate sub - story text output by the text generation model is repeated to generate the next sub - story text, and finally the long - form story text is obtained based on each sub - story text. This can increase the reasonableness of the long - form story text output by the text generation model and further reduce the risk of incoherence between adjacent sub - story texts in the long - form story text.

[0052] Moreover, compared with directly inputting the chapter outline into the text generation model to generate the long - form story text, in this embodiment, by determining the target sub - events from the chapter outline and inputting the target sub - events into the text generation model, the burden of the text generation model for processing long texts at one time is reduced, the constraints of the input of the text generation model are made clearer, and the computing resources consumed by the text generation model when generating candidate story texts are reduced.

[0053] Based on any of the above embodiments, the writing agent further includes a structure control model; After obtaining the candidate sub - story text output by the text generation model, the method further includes: Obtain the candidate story text based on the candidate sub - story text and the sub - story text generated in the previous step; Input the chapter outline, the candidate story text, and the first prompt word into the structure control model to obtain the text judgment result output by the structure control model; When the text judgment result fails, determine that the candidate sub-story text is not the sub-story text; Input the chapter outline and the second prompt word into the structure control model to obtain the sub-story text output by the structure control model.

[0054] Specifically, in this embodiment, the structure control model can use a general inference model or a deep learning model, etc. Therefore, different question-and-answer results such as the text judgment result and the sub-story text output by the structure control model can be obtained through different inputs.

[0055] When the text judgment result fails, it can be that the candidate sub-story text output by the text generation model does not meet the sub-story text standard defined by the first prompt word. The second prompt word can specify the target sub-events based on which the structure control model generates the sub-story text.

[0056] It can be understood that the specific content of the first prompt word and the second prompt word can be set according to the actual model, and this embodiment does not further limit this. When the structure control model outputs a text judgment result of passing, it can be determined that the candidate sub-story text is the sub-story text and store the sub-story text in a specified location.

[0057] In this embodiment, in the case where the candidate sub-story text output by the text generation model does not meet the sub-story text standard, by inputting the chapter outline and the second prompt word into the structure control model, the structure control model can determine a more complete story skeleton and logical framework based on the chapter outline, thereby generating a sub-story text with better coherence and storyliness.

[0058] In this embodiment, the candidate sub-story text is output by the text generation model. On this basis, the structure control model is used to judge whether the candidate sub-story text meets the standard. If it meets the standard, the candidate sub-story text is directly output as the sub-story text. If it does not meet the standard, the structure control model further regenerates the sub-story text to form a closed-loop correction mechanism. In this way, while reducing the computational resources consumed by the text generation model when generating the candidate story text, the coherence between the generated sub-story texts can be ensured.

[0059] In one embodiment, determining the target sub-events of the chapter outline includes: inputting the chapter outline and the third prompt word into the structure control model to obtain the target sub-events output by the structure control model.

[0060] Compared with using rules to determine the target sub-events in the chapter outline and judge whether the candidate sub-story text meets the criteria, in this embodiment, the target sub-events in the chapter outline are determined by the prompt-driven structure control model, and whether the candidate sub-story text meets the criteria is judged, realizing a closed-loop correction process, which can flexibly adapt to diverse narrative requirements and significantly improve the compatibility with different themes and styles.

[0061] As the sub-story text is continuously generated, the length of the candidate story text obtained based on the candidate sub-story text and the sub-story text generated in the previous steps will become longer and longer. To shorten the length of the candidate story text, based on any of the above embodiments, obtaining the candidate story text based on the candidate sub-story text and the sub-story text generated in the previous steps includes: Dividing the sub-story text into key sub-story text and non-key sub-story text based on the event relationship between the candidate sub-story text and the sub-story text generated in the previous steps; Obtaining the candidate story text based on the candidate sub-story text, the key sub-story text, and the sub-events corresponding to the non-key sub-story text.

[0062] Specifically, the sub-story text can be divided into key sub-story text and non-key sub-story text according to whether there is a direct event relationship between the candidate sub-story text and the sub-story text; it can also be divided into key sub-story text and non-key sub-story text according to whether there is a strong logical event relationship such as a causal relationship or a progressive relationship between the candidate sub-story text and the sub-story text, etc.

[0063] Exemplarily, the input and output of the writing agent can be processed through the ReIO technology, and the output sub-story text and the corresponding sub-events are associated and stored in the dynamic memory pool, and the stored data in the dynamic memory pool is continuously iteratively updated as new sub-story text is generated to retain key information at a distance, such as events, characters, and their relationships, to ensure the coherence or plot consistency in the generated story text.

[0064] After determining the non-key sub-story text, the sub-events corresponding to the non-key sub-story text can be determined based on the stored data in the dynamic memory pool, so as to generate the candidate story text in the order of the chapter outline based on the candidate sub-story text, the key sub-story text, and the sub-events corresponding to the non-key sub-story text.

[0065] In one embodiment, candidate sub-story text and stored data in the dynamic memory pool can be determined, and the candidate sub-story text and the stored data in the dynamic memory pool are input into a text compression model to obtain candidate story text output by the text compression model. The candidate story text includes sub-events corresponding to the candidate sub-story text, key sub-story text, and non-key sub-story text. Among them, the text compression model is trained based on sample story text, sample sub-story text, and associated stored data corresponding to the sub-events and sample compressed story text.

[0066] In this embodiment, by identifying non-key sub-story text and using the sub-events corresponding to the non-key sub-story text to replace the non-key sub-story text, the length of the candidate story text is compressed, which can reduce the computing resources consumed by the structure control model to obtain the text judgment result, while retaining important associated plots and ensuring the reliability of the text judgment result.

[0067] In some embodiments, during the process of generating sub-story text, the structure control model is also used to summarize the previous text to further compress the candidate story cost.

[0068] Figure 2 It is a schematic diagram of the architecture of the long story text generation method provided by the present invention. As Figure 2 shown, in order to specifically illustrate the functions of the long story text generation method provided in this embodiment, a specific example is provided below.

[0069] The story generation model STORYWRITER can be first implemented within the AutoGen framework. It can be understood that a specific domain multi-agent framework can also be used to meet the requirements of story generation tasks in the corresponding domain. In this example, no further limitation is made on the specific multi-agent framework. Then the foreground summary text is determined. For example, “… Generate a story with a length of about 10,000 words based on the premise”. The foreground summary text is input into the event generation model EventSeed to obtain candidate events output by the event generation model. For example, generate Event 1: Ambush; Scene: A foggy North Korean forest near the front line. ….

[0070] Input the candidate event into the evaluation model EventValidator to obtain the evaluation result output by the evaluation model. When the evaluation result is passed, determine that the candidate event is the main event, for example, output "Good, continue to generate"; when the evaluation result is not passed, determine that the candidate event is a non-main event and regenerate the second main event; for example, generate Event 2: The betrayal is revealed; Scene: At dusk, a secluded ridge.... Output "Not good, please regenerate"; repeat to obtain the candidate event output by the event generation model until the event generation model outputs the last main event of the event outline to obtain the event outline. Input the event outline into the event refinement model SubTasker to obtain the refined events corresponding to each main event in the event outline output by the event refinement model; for example, Event 1 is refined into Sub-event 1.1, Sub-event 1.2, and Sub-event 1.3. Input the refined events into the chapter arrangement model Weaver to obtain the chapter outline output by the chapter arrangement model; for example, Sub-event 1.1 and Sub-event 1.2 generate Chapter 1, Sub-event 1.3, Sub-event 2.1, and Sub-event 2.2 generate Chapter 2,..., and generate the chapter outline according to each chapter. Determine the target refined event of the chapter outline, input the target refined event into the text generation model FinalWriter to obtain the candidate sub-story text output by the text generation model; for example, obtain Story 1.1 corresponding to Sub-event 1.1: The fog clings tightly to the trees like a shroud - an unnatural silence...; input the chapter outline, the candidate story text, and the first prompt word into the structure control model Coordinator to obtain the text judgment result output by the structure control model; for example: Please generate the next story and outline (actually the next sub-event in the outline). Determine the target refined event of the chapter outline, input the target refined event into the text generation model to obtain Story 1.2 corresponding to Sub-event 1.2 output by the text generation model: The chaos of the ambush erupted like a tide, mercilessly sweeping over them; input the chapter outline, the candidate story text, and the first prompt word into the structure control model to obtain the text judgment result output by the structure control model, for example: It's not well written, I'll rewrite it. Repeat the step of obtaining the candidate sub-story text output by the text generation model until the last candidate sub-story text output by the text generation model is obtained, and obtain the long story text according to the sub-story text.

[0071] It has been verified that on the MoPS dataset, through manual and automatic evaluation, STORYWRITER significantly outperforms baseline models such as DOC, Agents’Room, and GPT-4o mini in six dimensions: relevance, coherence, empathy, surprise, creativity, and complexity. Moreover, the average length of the generated stories reaches 8,381 words, far exceeding other models, proving that STORYWRITER can generate high-quality long stories.

[0072] In terms of content diversity and creativity, STORYWRITER significantly outperforms all baseline models, demonstrating its effectiveness in generating high-quality long-form story texts with diverse content and creative content.

[0073] Furthermore, during the experiment, based on the high-quality long-form story texts with diverse and creative content output by the story generation model provided in the embodiments of the present invention based on the prospect summary text, the LONGSTORY dataset was constructed. Using the LONGSTORY dataset to fine-tune and train the Llama3.1-8B Instruct model, STORYWRITERLLAMA was obtained. When generating stories with more than 4,000 words, the quality score of STORYWRITERLLAMA is significantly better than that of Llama3.1-8B Instruct, and the length score is also better than that of Llama3.1-8B Instruct and GPT-4o, proving that the LONGSTORY dataset can be used as training data to fine-tune and train other baseline models so that the models can better follow the length constraints to generate stories.

[0074] Next, the long-form story text generation device provided by the present invention will be described. The long-form story text generation device described below can be correspondingly referred to the long-form story text generation method described above.

[0075] Figure 3 It is a schematic structural diagram of the long-form story text generation device provided by the present invention, as Figure 3 shown. The device includes: A summary text determination module 301 for determining the prospect summary text; A story text output module 302 for inputting the prospect summary text into a story generation model to obtain the long-form story text output by the story generation model; wherein, the story generation model is used to determine the main event based on the prospect summary text, obtain an event outline according to the main event, and generate the long-form story text based on the event outline.

[0076] Based on any of the above embodiments, the story text output module 302 is specifically used for: Input the foreground summary text into the outline agent to obtain the event outline output by the outline agent; the outline agent is used to determine the main event based on the foreground summary text and obtain the event outline according to the main event; Input the event outline into the planning agent to obtain the chapter outline output by the planning agent; the planning agent is used to determine the sub-events based on the main event of the event outline and obtain the chapter outline according to the sub-events; Input the chapter outline into the writing agent to obtain the long story text output by the writing agent; the writing agent is used to determine the sub-story text based on the sub-events of the chapter outline and obtain the long story text according to the sub-story text.

[0077] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Input the foreground summary text into the event generation model to obtain candidate events output by the event generation model; the event generation model is trained based on sample foreground summary texts and sample event outlines, and the sample event outlines include sample main events; When it is determined that the candidate event is the main event, repeatedly obtain the candidate events output by the event generation model until the last main event of the event outline is output by the event generation model.

[0078] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Input the candidate event into the evaluation model to obtain the evaluation result output by the evaluation model, and the evaluation model is trained based on the labeled sample main events; when the evaluation result is passed, determine that the candidate event is the main event.

[0079] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Input the event outline into the event refinement model to obtain the sub-events corresponding to each main event in the event outline output by the event refinement model; the event refinement model is trained based on sample event outlines and sample sub-events; Input the sub-events into the chapter arrangement model to obtain the chapter outline output by the chapter arrangement model; the chapter arrangement model is trained based on sample sub-events and sample chapter outlines; the chapter arrangement model is used to perform non-linear narrative processing on the sub-events based on the event relationship to obtain the chapter outline.

[0080] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Determine the target sub - events of the chapter outline, input the target sub - events into the text generation model, and obtain the candidate sub - story text output by the text generation model; the text generation model is trained based on sample sub - events and sample sub - story texts. When it is determined that the candidate sub - story text is the sub - story text, store the sub - story text in a specified location, repeat the step of obtaining the candidate sub - story text output by the text generation model until the last candidate sub - story text output by the text generation model is obtained, and obtain the long - story text according to the sub - story text.

[0081] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Obtain a candidate story text based on the candidate sub - story text and the sub - story text generated in the previous step. Input the chapter outline, the candidate story text, and the first prompt word into the structure control model, and obtain the text judgment result output by the structure control model. When the text judgment result is not passed, determine that the candidate sub - story text is not the sub - story text. Input the chapter outline and the second prompt word into the structure control model, and obtain the sub - story text output by the structure control model.

[0082] Based on any of the above embodiments, the story text output module 302 is specifically configured to: Based on the event relationship between the candidate sub - story text and the sub - story text generated in the previous step, divide the sub - story text into key sub - story texts and non - key sub - story texts. Obtain a candidate story text based on the candidate sub - story text, the key sub - story text, and the sub - events corresponding to the non - key sub - story text.

[0083] Figure 4 Illustrates a schematic structural diagram of an electronic device, such as Figure 4As shown in the figure, the electronic device may include: a processor 410, a communications interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communications interface 420, and the memory 430 complete mutual communication through the communication bus 440. The processor 410 may call the logical instructions in the memory 430 to execute the long story text generation method, which includes: determining a foreground summary text; inputting the foreground summary text into a story generation model to obtain the long story text output by the story generation model; where the story generation model is used to determine a main line event based on the foreground summary text, obtain an event outline according to the main line event, and generate the long story text based on the event outline.

[0084] In addition, when the logical instructions in the above-mentioned memory 430 can be implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.

[0085] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the long story text generation method provided by the above-mentioned various methods. The method includes: determining a foreground summary text; inputting the foreground summary text into a story generation model to obtain the long story text output by the story generation model; where the story generation model is used to determine a main line event based on the foreground summary text, obtain an event outline according to the main line event, and generate the long story text based on the event outline.

[0086] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a long story text generation method provided by the above-mentioned various methods is implemented. The method includes: determining a foreground summary text; inputting the foreground summary text into a story generation model to obtain a long story text output by the story generation model; wherein, the story generation model is used to determine a main line event based on the foreground summary text, obtain an event outline according to the main line event, and generate the long story text based on the event outline.

[0087] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor.

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating a long story text, characterized in that, Including: Determine the foreground summary text; Input the foreground summary text into the story generation model to obtain the long story text output by the story generation model; Wherein, the story generation model is used to determine the main line events based on the foreground summary text, obtain the event outline according to the main line events, and generate the long story text based on the event outline.

2. The method for generating a story text according to claim 1, wherein The story generation model includes an outline agent, a planning agent, and a writing agent; The inputting the foreground summary text into the story generation model to obtain the story text output by the story generation model includes: Input the foreground summary text into the outline agent to obtain the event outline output by the outline agent; the outline agent is used to determine the main line events based on the foreground summary text and obtain the event outline according to the main line events; Input the event outline into the planning agent to obtain the chapter outline output by the planning agent; the planning agent is used to determine the sub-events based on the main line events of the event outline and obtain the chapter outline according to the sub-events; Input the chapter outline into the writing agent to obtain the long story text output by the writing agent; the writing agent is used to determine the sub-story text based on the sub-events of the chapter outline and obtain the long story text according to the sub-story text.

3. The method for generating a story text according to claim 2, wherein The outline agent includes an event generation model; Inputting the foreground summary text into the outline agent to obtain the event outline output by the outline agent includes: Input the foreground summary text into the event generation model to obtain the candidate events output by the event generation model; the event generation model is trained based on the sample foreground summary text and the sample event outline, and the sample event outline includes the sample main line events; When it is determined that the candidate event is the main line event, repeat to obtain the candidate events output by the event generation model until the last main line event of the event outline is output by the event generation model.

4. The method for generating a story text according to claim 3, wherein The outline agent further includes an evaluation model; Determining that the candidate event is the main line event includes: Input the candidate event into the evaluation model to obtain the evaluation result output by the evaluation model, and the evaluation model is trained based on the labeled sample main line events; When the evaluation result is passed, determine that the candidate event is the main line event.

5. The method for generating a story text according to claim 2, wherein The planning agent includes an event refinement model and a chapter arrangement model; Inputting the event outline into the planning agent to obtain the chapter outline output by the planning agent includes: Input the event outline into the event refinement model to obtain the sub-events corresponding to each main line event in the event outline output by the event refinement model; the event refinement model is trained based on the sample event outline and the sample sub-events; Input the segmented event into the chapter arrangement model to obtain the chapter outline output by the chapter arrangement model; the chapter arrangement model is trained based on sample segmented events and sample chapter outlines; the chapter arrangement model is used to perform non-linear narrative processing on the segmented events based on event relationships to obtain the chapter outline.

6. The method for generating a story text according to claim 2, wherein The writing agent includes a text generation model; Input the chapter outline into the writing agent to obtain the story text output by the writing agent, including: Determine the target segmented event of the chapter outline, input the target segmented event into the text generation model to obtain the candidate sub-story text output by the text generation model; the text generation model is trained based on sample segmented events and sample sub-story texts; When it is determined that the candidate sub-story text is the sub-story text, store the sub-story text in a specified location, repeat the step of obtaining the candidate sub-story text output by the text generation model until the last candidate sub-story text output by the text generation model is obtained, and obtain the long-story text according to the sub-story text.

7. The method for generating a story text according to claim 6, wherein The writing agent further includes a structure control model; After obtaining the candidate sub-story text output by the text generation model, the method further includes: Obtain a candidate story text based on the candidate sub-story text and the sub-story text generated in the previous step; Input the chapter outline, the candidate story text, and a first prompt word into the structure control model to obtain the text judgment result output by the structure control model; When the text judgment result fails, determine that the candidate sub-story text is not the sub-story text; Input the chapter outline and a second prompt word into the structure control model to obtain the sub-story text output by the structure control model.

8. The method for generating a story text according to claim 7, wherein The obtaining of the candidate story text based on the candidate sub-story text and the sub-story text generated in the previous step includes: Based on the event relationship between the candidate sub-story text and the sub-story text generated in the previous step, divide the sub-story text into key sub-story texts and non-key sub-story texts; Obtain a candidate story text based on the candidate sub-story text, the key sub-story text, and the segmented events corresponding to the non-key sub-story texts.

9. A story text generation device, characterized in that, Includes: A synopsis text determination module for determining a foreground synopsis text; A story text output module for inputting the foreground synopsis text into a story generation model to obtain the long-story text output by the story generation model; wherein, the story generation model is used to determine the main events based on the foreground synopsis text, obtain an event outline according to the main events, and generate the long-story text based on the event outline.

10. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the long-story text generation method according to any one of claims 1 to 8.