A long script automatic generation method based on language model role playing

CN118394926BActive Publication Date: 2026-08-21ZHEJIANG UNIV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410499288.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-24
Publication Date
2026-08-21
Estimated Expiration
2044-04-24

AI Technical Summary

Technical Problem

而现有的用于剧本生成的方法主要是通过人机合作的方式,生成每个剧本时都需要安排一个人甚至是专家和机器不断交互逐步生成整个剧本,这样的生成过程需要耗费巨大的人力成本和时间成本

Benefits of technology

[0024]This invention relates to the field of literary creation. Specifically, this invention addresses the task of script generation by breaking it down into three parts: plot planning, plot expansion, and script generation. Each part is assigned a specific role by Large Language Models (LLMs) to simulate the human creative process. In particular, a role-playing mechanism based on language models is introduced in the script generation process to make the generated character performances more vivid and lifelike.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118394926B_ABST
    Figure CN118394926B_ABST
Patent Text Reader

Abstract

The application discloses a long script automatic generation method based on language model role playing. The application inputs a short story outline, and assigns language models to different roles in the human creation process. In addition to being considered as "authors", language models also act as "editors" responsible for providing feedback and suggestions for modification to "authors". In addition, in order to enrich the character image and deepen the plot, the language model also acts as an "actor" to let them communicate and interact with each other in the plot. Compared with the existing method, the method directly generates a script as the target, does not need a long and tedious human-computer cooperation process, and directly and automatically generates a script. Compared with the existing method, the method can generate a long script of more than 5000 words while maintaining the coherence of the plot. The method not only helps non-professional users to create an interesting script, but also reduces the creation burden of professional people in the industry, and even can stimulate their creative inspiration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of deep learning and natural language processing, and in particular relates to a method for automatically generating long scripts based on language model role-playing. Background Technology

[0002] Automatic script generation is a highly relevant and widely applicable problem worthy of in-depth research. It holds significant importance and plays a crucial role in the film and television industry, education and training, and artistic creation. In the film and television industry, automatic script generation can quickly produce script drafts, providing screenwriters with inspiration and creativity, accelerating the speed and efficiency of scriptwriting. Simultaneously, it can automatically generate scripts of various genres based on different plot requirements and character settings, from comedy to thriller, from romance to science fiction, meeting the needs of different genres. In the education and training field, automatic script generation can be used to create educational videos, training courses, and other teaching materials, providing vivid and engaging teaching content to enhance learners' interest and learning outcomes. In artistic creation, automatic script generation can serve as a creative tool for artists, helping them break through traditional creative thinking, explore new creative possibilities, and create more creative and imaginative works.

[0003] A screenplay is a type of literary creation. Existing literary creation methods are mainly used for story generation tasks. In this task, a two-step planning-drafting process is typically used to generate a story: first, an outline is generated to plan the plot, and then the complete text is drafted based on the plot outline. Building upon this planning-drafting process, to generate long stories exceeding 1000 words while maintaining coherence, recursive hints and iterative modifications are usually applied to the large language model. Although current story generation methods can generate longer stories of improved quality, the stories generated using existing methods are more like novels, containing extensive environmental descriptions, situational descriptions, narration, and descriptions of characters' psychology and motivations. Such generated content cannot be directly used as a screenplay for film and television production. The form of a screenplay differs significantly from that of a novel. A screenplay directly serves performance, focusing on highlighting character performances in different scenes: character actions, dialogue, expressions, and interactions. Existing screenplay generation methods primarily rely on human-computer collaboration. Generating each screenplay requires a person, or even an expert, to continuously interact with the machine to gradually generate the entire screenplay. This generation process incurs enormous human and time costs. This language model-based automatic long script generation method directly aims at script generation. It designs three modules: plot planning, plot expansion, and script generation. It uses an innovative role-playing approach to automatically generate long scripts of about 5,000 words, thus expanding the application of large language models in literary creation. Summary of the Invention

[0004] The technical problem this invention aims to solve is how to automatically generate long and high-quality scripts based on a short story synopsis, and provides a method for automatically generating long scripts based on language model role-playing.

[0005] To achieve the above-mentioned objectives, the present invention specifically adopts the following technical solution:

[0006] A method for automatically generating long scripts based on language model role-playing includes the following steps:

[0007] S1. Input the first text instruction into the language model, making the language model play the role of a writer. The writer designs characters and drafts a story outline based on the obtained story synopsis. Input the second text instruction into the language model, making the language model play the role of an editor. The editor simulates the human creative process in the real world and provides feedback and suggestions to the writer. Input the third text instruction into the language model, making the language model play the role of a writer. The writer modifies the characters and story outline based on the editor's feedback and suggestions. After the modification is completed, the improved characters and story outline are obtained.

[0008] When designing characters, each character must have both a name and a description, and the description must be consistent with the story synopsis. The story outline has a two-tiered structure: the first tier consists of multiple top-level plot points, and the second tier consists of multiple bottom-level plot points. Each top-level plot point corresponds to multiple bottom-level plot points, which are used to expand and refine the content of the top-level plot points. Each top-level or bottom-level plot point consists of a scene, characters involved, and plot elements. When generating the story outline, the writer generates all the plot elements at once.

[0009] S2. Input the fourth text instruction into the language model, so that the language model plays the role of a writer and expands each underlying plot point in the improved story outline into a complete story chapter. When expanding the current underlying plot point, the writer needs to refer to the scene, characters and plot involved, as well as the obtained story outline. Except for the first underlying plot point of each top plot point, each other underlying plot point belonging to the same top plot point also needs to refer to the plot that happened before.

[0010] S3. First, input the fifth text instruction into the language model, making the language model play the role of a writer and adapt each story chapter into a script draft. Each script draft consists of a scene title and a series of events describing the characters' actions. After adaptation, input the sixth text instruction into the language model, making the language model play the role of an actor. Each language model plays the only role involved in the script draft and interacts and performs according to the sequence of events in each script draft in a role-playing manner. After the role-playing is completed, save the output of the actors' performance to obtain an episode script corresponding to each script draft. After obtaining all the scripts, splice all the scripts together according to the labels of the underlying plot points to output the final full-length script.

[0011] Based on the above scheme, each step can be implemented in the following preferred manner.

[0012] Preferably, in step S1, the story synopsis is a description of the main plot, story background and theme of a film or television work. The film or television work includes six genres, namely romance, science fiction, horror, drama, crime and comedy.

[0013] As a preferred option, in step S1, when the writer designs the character, the character's name must be the character's full name, and the character introduction can involve one or more of the following: gender, age, appearance, background, personality, experience, goals, motivations, conflicts, development, and relationships with other characters.

[0014] As a preferred option, in step S1, when designing characters and drafting a story outline, the content created by the writer is wrapped around a start identifier and an end identifier.

[0015] Preferably, in step S1, when providing feedback, the editor needs to determine whether the characters in the writer's work are consistent with the story synopsis, whether the characters are attractive to the audience and evoke emotional resonance, whether the story outline does not conflict with the story synopsis, whether the story outline does not conflict with the characters, whether the plot in the story outline is coherent, whether the continuous plot can constitute a story, and whether the story outline has a clear ending. If all conditions are met, the editor will not provide feedback, and the writer does not need to modify the work. Otherwise, the writer will modify the characters and story outline according to the editor's feedback until the editor no longer provides feedback or the number of modifications reaches the pre-set maximum number of modifications.

[0016] Preferably, in step S2, when the writer expands the j-th bottom-level plot point of the i-th top-level plot point, if j is 1, the story plot of the j-th bottom-level plot point is put into the prompt words and input into the language model playing the writer, and the story chapter of the corresponding j-th bottom-level plot point is output; if j is not 1, the story chapters of the n bottom-level plot points that have been expanded and are closest to the j-th bottom-level plot point are put into the prompt words, and the story chapter of the corresponding j-th bottom-level plot point is output.

[0017] When the writer expands the j-th bottom plot point of the i-th top plot point, if the current character appearing in the j-th bottom plot point does not exist in the pre-built list of characters who have appeared, the prompt word will prompt the language model playing the writer to reasonably plan the plot of the current character's first appearance during the expansion and add the current character to the list of characters who have appeared.

[0018] When the writer expands the j-th underlying plot point of the i-th top plot point, if the j-th underlying plot point is the last underlying plot point of the i-th top plot point, then the cue words will prompt the language model playing the writer to arrange a clear story ending during the expansion.

[0019] Preferably, in step S3, the scene title of each script draft includes three parts: interior / exterior scene and the time and place of the event.

[0020] As a preferred approach, before role-playing the current script draft, the language model of the actor includes the character introduction of the character to be played, the events in the current script draft to be played, the scene title, and the obtained actor performance history in the role-playing prompts. The role-playing prompts are then input into the language model of the actor, and then the language model of the actor is input into the current scene title for spontaneous performance.

[0021] Preferably, in step S3, the output content after the actor's performance includes three parts: a description of the character's specific actions corresponding to the event in the scene title, the character's lines, and the character's state when delivering the lines.

[0022] Preferably, in step S3, for each script draft, the output content after the actors' performance is processed into a script format, and the script format is spliced ​​together according to the chronological order of events to obtain an episode script; the structure of the script format is: character specific action description [character name]: (the character's state when expressing lines) the character's lines.

[0023] Compared with the prior art, the present invention has the following advantages:

[0024] This invention relates to the field of literary creation. Specifically, this invention addresses the task of script generation by breaking it down into three parts: plot planning, plot expansion, and script generation. Each part is assigned a specific role by Large Language Models (LLMs) to simulate the human creative process. In particular, a role-playing mechanism based on language models is introduced in the script generation process to make the generated character performances more vivid and lifelike.

[0025] Compared with existing literary creation methods, this method directly aims to generate scripts, and the generated content can be directly used as a blueprint for film and television creation.

[0026] Compared with existing script generation methods, this method does not require a lengthy and cumbersome human-computer collaboration process and can directly generate scripts in a fully automated manner.

[0027] Compared to existing methods, this approach breaks down the script generation task into three key parts: plot creation, script format adjustment, and script optimization. Each part is meticulously designed, focusing on one important aspect at a time, thus alleviating the pressure of juggling multiple aspects when generating a script all at once.

[0028] Compared to existing methods, this method can maintain the coherence of the plot while generating long scripts of more than 5,000 words.

[0029] This method requires no specialized knowledge in the relevant field. Users only need to provide an initial story outline as input, and the method will automatically handle complex script generation tasks, thus democratizing fields that traditionally require extensive experience or specific skills. This method not only helps non-professional users create compelling scripts but also reduces the creative burden on industry professionals and even inspires their creativity. Attached Figure Description

[0030] Figure 1 This is a diagram illustrating the overall method architecture of the present invention;

[0031] Figure 2 This is a schematic diagram of the plot planning part of the present invention;

[0032] Figure 3 This is a schematic diagram illustrating the HTML generation format of characters and story outlines in an embodiment of the present invention;

[0033] Figure 4 This is a schematic diagram of the expanded plot of the present invention;

[0034] Figure 5 This is a schematic diagram of the script generation part of the present invention. Detailed Implementation

[0035] To make the above-mentioned objects, features, and advantages of the present invention more apparent and understandable, the specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention can be practiced in many other ways different from those described herein, and those skilled in the art can make similar modifications without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below. Technical features in the various embodiments of the present invention can be combined accordingly without mutual conflict.

[0036] In the description of this invention, it should be understood that the terms "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first" and "second" may explicitly or implicitly include at least one of those features.

[0037] Scripts are a core element of film, television, theater, and other creative industries. Automatic script generation can inspire creators, accelerate the creative process, and help them create content more efficiently. This has a positive impact on the development of the creative industries. The technical problem this invention aims to solve is how to automatically generate long, high-quality scripts from a short, input story synopsis. This invention provides an effective method for automatically generating long scripts based on language model role-playing.

[0038] The core of this invention is to break down the script generation task into three parts: plot planning, plot expansion, and script generation, with the corresponding overall flowchart as follows: Figure 1 As shown, each part is meticulously designed—giving the large language model a specific role to simulate the human creative process, especially by introducing a role-playing mechanism in the script generation process to make the generated characters more vivid and lifelike. By breaking down the task, the large language model focuses on one important thing at a time, alleviating the pressure of having to consider all aspects when generating a script all at once. Specifically, the story outline is input first, and after the plot planning part generates characters and an outline, the input story outline and the improved characters and story outline from the first step are then entered into the plot expansion part to obtain a series of detailed story chapters. Similarly, the story chapters output from the previous part are then entered into the script generation part to obtain the final script as the task output. Compared with existing methods, the method of this invention can maintain the coherence of the plot while generating long scripts of more than 5,000 words.

[0039] like Figure 1 As shown, in a preferred embodiment of the present invention, the above-mentioned method for automatically generating long scripts based on language model role-playing includes the following steps S1 to S3. The specific implementation process of each step will be described in detail below.

[0040] S1. Input the first text instruction into the language model, making the language model play the role of a writer. The writer designs characters and drafts a story outline based on the obtained story synopsis. Input the second text instruction into the language model, making the language model play the role of an editor. The editor simulates the human creative process in the real world and provides feedback and suggestions to the writer. Input the third text instruction into the language model, making the language model play the role of a writer. The writer modifies the characters and story outline based on the editor's feedback and suggestions. After the modification is completed, the improved characters and story outline are obtained.

[0041] When designing characters, each character must have both a name and a description, and the description must be consistent with the story synopsis. The story outline has a two-layer structure: the first layer consists of multiple top-level plot points, and the second layer consists of multiple bottom-level plot points. Each top-level plot point corresponds to multiple bottom-level plot points, which are used to expand and refine the content of the top-level plot points. Each top-level or bottom-level plot point consists of a scene, characters involved, and plot elements. When generating the story outline, the writer generates all the plot elements at once.

[0042] It should be noted that step S1 of this invention is the plot planning part. In this invention, the first text instruction, the second text instruction, and the third text instruction are the prompt words input to the language model. Through the first and second text instructions, the language model plays the roles of "writer" and "editor," respectively. Specifically, the first text instruction instructs the "writer" to design a series of characters and draft a two-layer story outline based on the input story synopsis. Based on a feedback-revision polishing mechanism, the second text instruction indicates that the "editor" will provide feedback suggestions to the "writer" so that the "writer" can revise and improve the character and outline design. The third text instruction instructs the writer to revise the generated characters and story outline according to the editor's feedback suggestions.

[0043] It should be noted that in step S1 of this embodiment, the input is a brief story synopsis. The story synopsis provides a concise description of a film or television work, typically including the main plot, background, and theme, thus setting the tone for the film. The film or television work includes six common film genres: romance, science fiction, horror, drama, crime, and comedy.

[0044] It should be noted that in step S1 of this invention, when the writer designs the character, the character's name must be the character's full name, and the character introduction may involve one or more of the following: the character's gender, age, appearance, background, personality, experience, goals, motivations, conflicts, development, and relationships with other characters.

[0045] In this embodiment, the plot planning process in S1 is as follows: Figure 2As shown. From Figure 2 As can be seen, in the plot planning section, the language model needs to complete two parts: character design and story outline formulation. When the language model plays the role of the "writer," the designed character includes two parts: the character's name and a character introduction. The character's name needs to be the full name, accurate, and without special symbols. The character introduction needs to be concise but relevant to the story, and may include gender, age, appearance, background, personality, experience, goals, motivations, conflicts, development, relationships with other characters, and other relevant details.

[0046] It should also be noted that in step S1 of this invention, the number of characters designed by the author can be selected according to the actual situation, as long as it meets the needs of the story outline. In this embodiment, the number of characters is 3-6.

[0047] It should be noted that in step S1 of the present invention, from Figure 2 As can be seen, when the language model acts as a "writer" to draft a story outline, it mainly refers to the input story synopsis and the aforementioned generated characters. The drafted story outline is designed with a two-layer structure, each layer including multiple plot points. The first layer of the story outline consists of multiple top-level plot points, and the second layer consists of multiple bottom-level plot points. Each top-level plot point corresponds to multiple bottom-level plot points, which are used to expand and refine the content of the top-level plot points. In addition, the number of generated plot points is determined by the language model itself. The number of bottom-level plot points associated with the first top-level plot point can differ from the number associated with the second top-level plot point; this is not limited in this invention.

[0048] It should be noted that in step S1 of this invention, each plot point in the story outline consists of three parts: scene, characters involved, and plot. That is, whether it is a top-level plot point or a bottom-level plot point, it is composed of scene, characters involved, and plot. In addition, it should be noted that when the "writer" generates the story outline, it generates all the plot points at once, rather than generating them point by point iteratively.

[0049] It should be noted that in step S1 of this invention, when designing characters and drafting a story outline, the content created by the author is enclosed before and after the start identifier and end identifier.

[0050] In this embodiment, when the writer played by the language model generates the name and introduction of each character, as well as each plot point in the story outline, it is prompted to output in a format similar to HTML, that is, the generated content is wrapped with "<>" and "< / >", so as to keep the generated content in a clear structure and facilitate subsequent parsing of the generated content. Add a start identifier "<>" before the content generated by the writer, and add an end identifier "< / >" after the content generated by the writer. The content between the start identifier and the end identifier is the generated content. As Figure 3 shown, each character name generated by the writer is wrapped with "<Full_Name>" and "< / Full_Name>"; the character introduction is wrapped with "<Character_Introduction>" and "< / Character_Introduction>"; a complete character is wrapped with " <character> "and"< / character> ". In the story outline, the top-level plot points are wrapped with "<POINT_top-level plot point number>" and "< / POINT_top-level plot point number>", and the top-level plot point numbers are labeled 1, 2, 3... in the order of the top-level plot points; the bottom-level plot points are wrapped with "<POINT_bottom-level plot point number>" and "< / POINT_bottom-level plot point number>", and the bottom-level plot point numbers are labeled 1a, 1b, 1c,..., 2a, 2b... according to which top-level plot point the bottom-level plot point belongs to and the order; a complete story outline is wrapped with " <outline> "and"< / outline> ", so as to keep the generated content in a clear structure and facilitate subsequent parsing of the generated content.

[0051] It should be noted that in step S1 of the present invention, when the editor provides feedback suggestions, it is necessary to judge whether the characters in the content created by the writer meet the requirements of being consistent with the story synopsis, whether the characters meet the requirements of attracting the audience and causing emotional resonance, whether the story outline meets the requirements of not conflicting with the story synopsis, whether the story outline meets the requirements of not conflicting with the characters, whether the plot in the story outline is coherent, whether the continuous plot can form a story, and whether the story outline has a clear ending: if all are met, the editor does not provide feedback suggestions and the writer does not need to modify the created content; otherwise, the writer modifies the characters and the story outline according to the editor's feedback suggestions until the editor does not provide feedback suggestions or the number of modification times reaches the pre-set upper limit of the number of modification times.

[0052] The above feedback suggestions, that is, modification suggestions, are generated by the editor. The content of the feedback suggestions is to tell the writer what needs to be modified, and then the writer modifies the content generated by himself according to the editor's feedback suggestions, such as the characters and the story outline.

[0053] In an embodiment of the present invention, a "feedback-modification" polishing mechanism is used in the plot planning section. That is, the language model plays the role of "editor" to simulate the human creative process in the real world, providing feedback to the "writer" so that he / she can modify the characters and outlines he / she has created.

[0054] When providing feedback, the "editors" primarily focus on the "coherence" and "interest" of the "writer's" content, offering detailed suggestions for revision. Specifically, the "editors" consider the following aspects during review: 1. Do the characters match the input story synopsis? 2. Are the characters engaging enough to attract the audience and evoke emotional resonance? 3. Does the story outline not conflict with the input story synopsis? Does the story outline not conflict with the characters? 4. Are the plot points in the story outline coherent and consistent? 5. Do the continuous plot points in the story outline constitute an interesting and captivating story? In addition, the "editors" pay special attention to whether the story outline has a clear ending, a necessary condition for the writer's work. If the "editors" find that the writer's content meets all of the above criteria, no revision suggestions are provided. If the "editor" finds during the review process that the author's work does not meet one or more of the above-mentioned aspects, the "editor" and "author" will engage in multiple rounds of "feedback-revision-feedback..." interaction to continuously improve the characters and story outline. Specifically, the "author" first creates the initial character draft, the "editor" provides suggestions for revision, the "author" makes the corresponding revisions to meet the "editor's" requirements, the "editor" continues to provide suggestions for revision... until the "editor" has no more suggestions for revision or the number of revisions reaches the set limit, resulting in the final character. After the character is revised, the same process is used to generate a complete story outline: the "author" first creates the initial story outline, the "editor" provides suggestions for revision, the "author" makes the corresponding revisions to meet the "editor's" requirements, the "editor" continues to provide suggestions for revision... until the "editor" has no more suggestions for revision or the number of revisions reaches the set limit, resulting in the complete story outline.

[0055] Furthermore, during the modification process of characters and story outlines, the maximum number of modifications allowed for each can be different, and can be specified by the user or the large language model. In this embodiment, the maximum number of modifications is uniformly set to 2.

[0056] S2. Input the fourth text instruction into the language model, so that the language model plays the role of a writer and expands each underlying plot point in the improved story outline into a complete story chapter. When expanding the current underlying plot point, the writer needs to refer to the scene, characters and plot involved, as well as the obtained story outline. Except for the first underlying plot point of each top plot point, each other underlying plot point belonging to the same top plot point also needs to refer to the plot that happened before.

[0057] It should be noted that step S2 of this invention is the plot expansion part. In this invention, the fourth text instruction is the prompt word input to the language model. Through the third text instruction, the language model plays the role of a "writer," who expands each underlying plot point in the story outline obtained in Step 1 into a complete story chapter. When expanding the current underlying plot point, the "writer" refers to the following: the scene in which the current underlying plot point occurs, the characters involved and their introductions, the plot of the current underlying plot point, and the original input story outline. In addition, if the underlying plot point being expanded is not the first underlying plot point, it also needs to refer to the previously occurring plot. For example, if the first top-level plot point contains 10 underlying plot points, and the second top-level plot point also contains 10 underlying plot points, in addition to the first underlying plot point of the first top-level plot point and the first underlying plot point of the second top-level plot point, the remaining underlying plot points of the first top-level plot point also need to refer to the previously occurring plot. Similarly, the remaining underlying plot points of the second top-level plot point also need to refer to the previously occurring plot.

[0058] In an embodiment of the present invention, the process of expanding the plot in S2 is as follows: Figure 4 As shown. From Figure 4 It is evident that the language model, acting as a "writer," adds more details to each underlying plot point in the story outline obtained by S1, expanding it into a complete story chapter.

[0059] It should be noted that in step S2 of this invention, when the writer expands the j-th bottom-level plot node of the i-th top-level plot node, if j is 1, the story plot of the j-th bottom-level plot node is put into the prompt words and input into the language model playing the role of the writer, and the story chapter of the corresponding j-th bottom-level plot node is output; if j is not 1, the story chapters of the n bottom-level plot nodes that have been expanded and are closest to the j-th bottom-level plot node are put into the prompt words, and the story chapter of the corresponding j-th bottom-level plot node is output.

[0060] When the writer expands the j-th bottom plot point of the i-th top plot point, if the current character appearing in the j-th bottom plot point does not exist in the pre-built list of characters who have appeared, the prompt word will prompt the language model playing the writer to reasonably plan the plot of the current character's first appearance during the expansion and add the current character to the list of characters who have appeared.

[0061] When the writer expands the j-th underlying plot point of the i-th top plot point, if the j-th underlying plot point is the last underlying plot point of the i-th top plot point, then the cue words will prompt the language model playing the writer to arrange a clear story ending during the expansion.

[0062] In an embodiment of the present invention, when the aforementioned "writer" expands each underlying plot point, in order to maintain the continuity with the previously occurred plot, the prompt words of the language model acting as the "writer" include the story chapters of the n most recently expanded underlying plot points. Underlying plot points farther away than n, due to the limitation of the language model's context length, only include unexpanded plots in the context. In this embodiment, i and j represent the labels of the top-level plot point and the underlying plot point, respectively, and n represents the number of the nearest underlying plot points; in this embodiment, n is set to 1.

[0063] When the "writer" expands each underlying plot point, if any character involved in that plot point appears for the first time in the entire story outline, the "writer" is prompted to appropriately plan the scene of that character's first appearance during the expansion. To determine if a character is appearing for the first time, a pre-built list of characters who have already appeared can be used. This list is empty before expansion begins. When expansion starts, each character appearing in the current underlying plot point is checked against the list of characters who have already appeared. If a character is not found, it means that this is their first appearance. At this point, a prompt word is input to remind the language model that this is the character's first appearance, and the scene of their first appearance should be appropriately planned during expansion. The current character is then added to the list of characters who have already appeared, and the process continues for the next character until all underlying plot points have been traversed and all characters are confirmed to be in the list of characters who have already appeared.

[0064] When the "writer" expands the last underlying plot point in the story outline, they also need to remind the language model to arrange a clear story ending during the expansion by inputting prompts. Specifically, the aforementioned process generates top-level and bottom-level plot points when generating the story outline. In step S2, the number of top-level and bottom-level plot points is fixed, making it easy to determine whether the last bottom-level plot point has been reached. In this embodiment, a variable is pre-set; after each bottom-level plot point is expanded, this variable is incremented by 1 until it matches the label of the last bottom-level plot point. At this point, prompts are input to the language model acting as the writer, informing it to arrange a clear story ending during the expansion.

[0065] S3. First, input the fifth text instruction into the language model, making the language model play the role of a writer and adapt each story chapter into a script draft. Each script draft consists of a scene title and a series of events describing the characters' actions. After adaptation, input the sixth text instruction into the language model, making the language model play the role of an actor. Each language model plays the only role involved in the script draft and interacts and performs according to the sequence of events in each script draft in a role-playing manner. After the role-playing is completed, save the output of the actors' performance to obtain an episode script corresponding to each script draft. After obtaining all the scripts, splice all the scripts together according to the labels of the underlying plot points to output the final full-length script.

[0066] It should be noted that step S3 of this invention is the script generation part. Based on the story chapters obtained in S2, the fifth and sixth text instructions are the prompt words input to the language model. Through the fifth and sixth text instructions, the language model plays the roles of "writer" and "actor," respectively. When the language model plays the role of "writer," it makes appropriate deletions and adjustments based on each story chapter, adapting it into an initial script draft corresponding to each story chapter. Each script draft includes scenes and a series of ordered, roughly described events depicting character behavior. Then, when multiple language models act as "actors," they respectively play the characters involved in the script draft, interacting and performing in a role-playing manner, thereby enriching the character performances in the script draft and obtaining the final script.

[0067] In an embodiment of the present invention, step S3 describes the script generation process as follows: Figure 5 As shown. From Figure 5As can be seen, the language model, acting as the "writer," appropriately edits and adjusts each story chapter obtained from S2, adapting it into an initial script draft for an episode (scene + a series of events (character actions)). Each script draft's scene title includes three parts: interior / exterior, the time and place of the event, and the specific time and place of the event. Here, interior / exterior refers to whether the scene is indoors or outdoors, the time of the event is the specific time of day (e.g., morning / noon / night), and the event content is the characters' actions, such as "who did what."

[0068] After receiving the script draft, each character in the draft is assigned a language model as an "actor" to portray. These "actors" interact and perform according to the sequence of events in the script draft, using role-playing. The "actors" perform from a first-person perspective, guided by the events in the corresponding script draft, adding more details such as actions, expressions, and dialogue to enrich the character portrayals. Furthermore, when assigning roles to language models, the same language model is used for the same character, while different language models are used for different characters. In other words, for the entire story outline, the language model used for the same character must be consistent throughout the story.

[0069] It should be noted that in step S3 of the present invention, before the language model of the actor plays the role of the current script draft, the character introduction of the character to be played, the event in the current script draft to be played, the scene title, and the obtained actor performance history are included in the role-playing prompts. The role-playing prompts are input into the language model of the actor, and then the language model of the actor is input into the current scene title to perform spontaneous performance.

[0070] In an embodiment of the invention, the process of role-playing a script draft is regarded as a round. Before each round of performance, the language model of the "actor" puts the character introduction of the character it is to play, the content of the script draft event to be performed in this round, the scene where the event occurs, and the performance history of the "actor" (and other "actors") in the context. The "actor" is put into the current scene sandbox and performs spontaneously based on the character's personality and the current event.

[0071] It should be noted that in step S3 of the present invention, the output content after the actor's performance includes three parts: a description of the specific actions of the character corresponding to the event that occurred in the scene title, the character's lines, and the character's state when expressing the lines.

[0072] In embodiments of the present invention, such as Figure 5As shown, when the language model acts as an "actor," the output after the performance includes three parts: a description of the specific actions of the characters corresponding to the events in the scene, the characters' lines, and the characters' state while delivering those lines. Specifically, the description of the specific actions of the characters corresponding to the events in the scene describes the actions and events that occur, written in the present tense, to intuitively describe what the audience will see on the screen. The characters' lines describe their spoken language, which is a core element in conveying the story, character traits, and interactions. The state of the characters while delivering their lines is the supplementary content in parentheses, used to indicate how the lines should be expressed, such as facial expressions and tone of voice, and should be enclosed in parentheses.

[0073] It should be noted that in step S3 of the present invention, for each script draft, the output content after the actors' performance is processed into a script format, and the script format is spliced ​​together according to the chronological order of events to obtain an episode script; the structure of the script format is: character specific action description [character name]: (the character's state when expressing lines) the character's lines.

[0074] In an embodiment of the present invention, after the role-playing of the current episode's script draft is completed, the interactions of the "actors" are collected and processed into the format of "character's specific action description [character's name]: (character's state when expressing lines) character's lines," resulting in script-formatted interactions. These script-formatted interactions are then pieced together in chronological order to obtain the final episode script (i.e., the script corresponding to a basic plot point). Finally, each episode script after the role-playing in Step 3 is pieced together according to the labels of the basic plot points to obtain the final long script output.

[0075] To better demonstrate the specific implementation and technical effects of the present invention, the method for automatically generating long scripts based on language model role-playing, as shown in steps S1 to S3 of the above preferred implementation, is applied to a specific example below.

[0076] Example

[0077] The overall process in this embodiment can be divided into three stages: plot planning, plot expansion, and script generation. The overall method flow is as follows: Figure 1 As shown.

[0078] Step 1: Plot Planning Stage

[0079] Step 1.1: In this case, input a brief story outline. The language model, acting as the "writer," first creates the character and then continuously modifies and refines the character based on the "editor's" suggestions, such as... Figure 2 .

[0080] Step 1.2: Using the story synopsis and the characters obtained in Step 1.1 as input, the language model, acting as the "writer," generates a story outline and collaborates with the "editor" to continuously refine it, such as... Figure 2 .

[0081] Step 2: Plot Expansion Stage

[0082] Step 2.1: Put the scene where the current plot takes place, the characters involved in the current plot and their introductions, the story content of the current plot, the story content that happened before the current plot, and the original input story outline into the context of the language model to initialize the "writer" for plot expansion.

[0083] Step 2.2: The language model, acting as the "writer," adds more details to each plot point in the story outline obtained in Step 1, expanding it into a complete story chapter, such as... Figure 4 .

[0084] 3. Script generation stage

[0085] Step 3.1: The language model, acting as the "writer," appropriately edits and shortens each story chapter obtained in Step 2, adapting it into an initial script draft for each episode. Each episode's script draft includes scenes and a series of ordered, roughly described events depicting the characters' actions, such as... Figure 5 .

[0086] Step 3.2: Based on the script draft obtained in Step 3.1, each character in the script draft is assigned a language model as an "actor" to play. The "actors" interact and perform according to the event sequence in the script draft through role-playing. The "actors" perform from a first-person perspective under the guidance of the corresponding events in the script draft, adding more details such as actions, expressions, and dialogue to enrich the character portrayal in the script. After the role-playing of the current episode's script draft is completed, the interactions of the "actors" are collected, processed, and the final episode script is obtained. The scripts of each episode after role-playing are pieced together to obtain the final full-length script output.

[0087] This embodiment mainly evaluates the script generation task on a self-built story outline dataset, as shown in Table 1.

[0088] Table 1 Comparison of evaluation metrics on the self-built story synopsis dataset in this embodiment.

[0089]

[0090]

[0091] The experimental results above demonstrate that, compared to other script generation methods in the prior art, this invention can effectively improve the coherence, relevance, interest, and overall quality of the generated scripts. In Table 1, Ties represent the probability of a tie; Wins represent the win rate of a certain method. Plan-then-Write and Directly-Write represent the comparison methods, where Directly-Write prompts the language model to directly generate a complete script consisting of several plots based on the input story outline. Plan-then-Write prompts the language model to first design several characters and formulate an outline based on the input story outline, and then generate each episode's script one by one based on the plot points in the outline. For both comparison methods, this embodiment will include a complete script as an example in the prompts provided to the language model.

[0092] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the invention. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the invention. Therefore, all technical solutions obtained through equivalent substitution or transformation fall within the protection scope of the present invention.

Claims

1. A method for automatically generating long scripts based on language model role-playing, characterized in that, Includes the following steps: S1. Input the first text instruction into the language model, making the language model play the role of a writer. The writer designs characters and drafts a story outline based on the obtained story synopsis. Input the second text instruction into the language model, making the language model play the role of an editor. The editor simulates the human creative process in the real world and provides feedback and suggestions to the writer. Input the third text instruction into the language model, making the language model play the role of a writer. The writer modifies the characters and story outline based on the editor's feedback and suggestions. After the modification is completed, the improved characters and story outline are obtained. When designing characters, each character must have both a name and a description, and the description must be consistent with the story synopsis. The story outline has a two-tiered structure: the first tier consists of multiple top-level plot points, and the second tier consists of multiple bottom-level plot points. Each top-level plot point corresponds to multiple bottom-level plot points, which are used to expand and refine the content of the top-level plot points. Each top-level or bottom-level plot point consists of a scene, characters involved, and plot elements. When generating the story outline, the writer generates all the plot elements at once. S2. Input the fourth text instruction into the language model, so that the language model plays the role of a writer and expands each underlying plot point in the improved story outline into a complete story chapter. When expanding the current underlying plot point, the writer needs to refer to the scene, characters and plot involved, as well as the obtained story outline. Except for the first underlying plot point of each top-level plot point, each other underlying plot point belonging to the same top-level plot point also needs to refer to the plot that happened before. S3. First, input the fifth text instruction into the language model, making the language model act as a writer and adapt each story chapter into a script draft. Each script draft consists of a scene title and a series of events describing the characters' actions. After adaptation, input the sixth text instruction into the language model, making the language model act as an actor. Each language model plays the only role involved in the script draft and interacts and performs according to the sequence of events in each script draft in a role-playing manner. After the role-playing is completed, save the output of the actors' performance to obtain an episode script corresponding to each script draft. After obtaining all the scripts, splice all the scripts together according to the labels of the underlying plot points to output the final full-length script. When providing feedback, editors need to determine whether the characters in the writer's work are consistent with the story synopsis, whether the characters are engaging and evoke emotional resonance in the audience, whether the story outline does not conflict with the story synopsis, whether the story outline does not conflict with the characters, whether the plot points in the story outline are coherent, whether the continuous plot points constitute a complete story, and whether the story outline has a clear ending. If all these conditions are met, the editor will not provide feedback, and the writer does not need to revise the work. Otherwise, the writer will revise the characters and story outline according to the editor's feedback until the editor provides no further feedback or the number of revisions reaches the pre-set limit. Before role-playing the current script draft, the language model of the actor includes the character introduction of the character to be played, the event in the current script draft to be played, the scene title, and the obtained actor performance history in the role-playing prompts. The role-playing prompts are then input into the language model of the actor, and then the language model of the actor is input into the current scene title for spontaneous performance. The output of an actor's performance includes three parts: a description of the specific actions of the characters corresponding to the events in the scene title, the characters' lines, and the characters' state when delivering their lines.

2. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S1, the story synopsis is a description of the main plot, story background and theme of a film or television work. The film or television work includes six genres, namely romance, science fiction, horror, drama, crime and comedy.

3. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S1, when the writer designs the characters, the character's name must be the character's full name, and the character introduction should include one or more of the following: gender, age, appearance, background, personality, experience, goals, motivations, conflicts, development, and relationships with other characters.

4. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S1, when designing characters and drafting a story outline, the content created by the writer is wrapped around a start identifier and an end identifier.

5. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S2, when the writer expands the j-th bottom plot point of the i-th top plot point, if j is 1, the story plot of the j-th bottom plot point is put into the prompt words and input into the language model playing the writer, and the corresponding story chapter of the j-th bottom plot point is output. If j is not 1, then the story chapters of the n bottom-level plot nodes that have been expanded and are closest to the j-th bottom-level plot node are put into the prompt words, and the story chapter of the corresponding j-th bottom-level plot node is output. When the writer expands the j-th bottom plot point of the i-th top plot point, if the current character appearing in the j-th bottom plot point does not exist in the pre-built list of characters who have appeared, the prompt word will prompt the language model playing the writer to reasonably plan the plot of the current character's first appearance during the expansion and add the current character to the list of characters who have appeared. When the writer expands the j-th underlying plot point of the i-th top plot point, if the j-th underlying plot point is the last underlying plot point of the i-th top plot point, then the cue words will prompt the language model playing the writer to arrange a clear story ending during the expansion.

6. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S3, the scene title of each script draft includes three parts: interior / exterior scene and the time and place of the event.

7. The method for automatically generating long scripts based on language model role-playing as described in claim 1, characterized in that, In step S3, for each script draft, the output content after the actors' performance is processed into a script format, and the script format is spliced ​​together according to the chronological order of events to obtain an episode script; the structure of the script format is: character specific action description [character name]: (character's state when expressing lines) character's lines.

Citation Information

Patent Citations

  • Scenario generation method and related device

    CN117149971A