Story generation method and device, electronic device and storage medium
By obtaining basic information and writing requirements, using a large language model to generate a story outline and add details, and combining it with an evaluation model to optimize the story text, it solves the problems of low efficiency and low quality of traditional manual creation methods, and achieves efficient, logical and reasonable automatic story generation.
Patent Information
- Application Number
- CN202411814168.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-12-10
AI Technical Summary
Traditional manual creation methods are inefficient and of low quality in story writing, and cannot meet people's growing reading needs.
By obtaining basic information and writing requirements, using a large language model to generate a story outline and add details, combined with an evaluation model to optimize the story text, the target story text is automatically generated with logic and rationality.
It realizes the intelligent and automatic generation of story texts that meet user needs, improving the efficiency and quality of story creation.
Smart Images

Figure CN119761503B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to a story generation method and device, an electronic device, and a storage medium. Background Art
[0002] In today's information age, with the widespread use of the internet and the development of big data technologies, people's demand for text information continues to grow. Story writing has a wide range of applications in various fields, such as novel writing and screenwriting. However, traditional manual creation methods often suffer from low efficiency and quality, making it difficult to meet people's growing reading needs. Summary of the Invention
[0003] In view of this, the present disclosure proposes a story generation method and device, an electronic device and a storage medium, which can intelligently and automatically generate a target story text that is detailed, logical and reasonable and meets the user's creative needs.
[0004] According to one aspect of the present disclosure, a story generation method is provided, comprising: obtaining basic information of a story to be generated, the basic information comprising background information and writing requirements, the background information comprising character information and story antecedents; determining auxiliary information based on the basic information, the auxiliary information comprising information affecting the development of the story after the story antecedents; generating at least one story outline based on the basic information and the auxiliary information, the story outline being used to indicate an outline of the plot developed after the story antecedents; supplementing each story outline in the at least one story outline with story details based on the auxiliary information, to obtain a plurality of story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details; evaluating each story text in the plurality of story texts to obtain an evaluation result for each story text, the evaluation result representing the quality of the story text; and determining a target story text based on the evaluation result for each story text in the plurality of story texts.
[0005] In one possible implementation, the writing requirements are used to indicate the direction of the story to be generated; the auxiliary information includes at least one of character emotional information, character relationship information, story writing purpose and plot ending point, the character emotional information is used to indicate the emotional state and changes between characters, the character relationship information is used to indicate the relationship between characters, the story writing purpose is used to indicate the type of story to be generated, and the plot ending point is used to indicate the end node of the story development.
[0006] In one possible implementation, determining the auxiliary information based on the basic information includes: using a first language model to determine whether the writing requirements are reasonable; and if the first language model determines that the writing requirements are reasonable, using a second language model to extract the auxiliary information from the basic information.
[0007] In one possible implementation, generating at least one story outline based on the basic information and the auxiliary information includes: looping through the following processing based on the basic information and the auxiliary information until the generated i-th target deduction plot reaches the plot ending point: generating a plurality of i-th deduction plots developed after the i-1-th target deduction plot based on the basic information, the auxiliary information and the i-1-th target deduction plot using a third language model; wherein, i≥1, the 0th target deduction plot is the story background; filtering out abnormal plots from the plurality of i-th deduction plots based on the auxiliary information using a fourth language model to obtain at least one i-th target deduction plot; for any i-th target deduction plot that reaches the plot ending point, determining the deduction plots from the 1st target deduction plot to the i-th target deduction plot as a story outline; at least one i-th target deduction plot that reaches the plot ending point corresponds to at least one story outline.
[0008] In one possible implementation, the method of supplementing story details for each of the at least one story outline based on the auxiliary information to obtain multiple story texts corresponding to the at least one story outline includes: for any story outline, using the fifth language model to supplement at least one story detail for the story outline based on the auxiliary information to obtain at least one story text corresponding to the story outline; wherein the story details include at least one of the following: character's actions, expressions, dialogues, psychological states, behavioral purposes, story background, location, and environment.
[0009] In one possible implementation, the evaluating of each of the multiple story texts to obtain an evaluation result of each story text includes: for any story text, using the sixth language model to evaluate at least one story characteristic of the story text at least once based on the basic information and the auxiliary information, to obtain at least one evaluation score for each of the at least one story characteristic of the story text; taking the average of the at least one evaluation scores of each story characteristic as the characteristic evaluation result of each story characteristic, and the evaluation result of the story text includes the characteristic evaluation result of the at least one story characteristic of the story text.
[0010] In one possible implementation, the story characteristics include at least one of the following: the degree to which the story is relevant to the title, the degree to which the story is complete, the degree to which the logic is rigorous, the degree to which the plot is novel, the degree to which the plot is exciting, the degree to which the characters are portrayed, the degree to which the relationships between the characters are displayed, the degree to which the emotional changes of the characters are displayed, the degree to which the character information is fictional, and the degree to which the dialogue is described.
[0011] In one possible implementation, determining the target story text based on the evaluation results of each story text among the multiple story texts includes: determining a comprehensive evaluation result of each story text based on a characteristic evaluation result of at least one story characteristic of each story text among the multiple story texts; and determining the target story text based on the comprehensive evaluation result of each story text among the multiple story texts.
[0012] In one possible implementation, determining a target story text based on a comprehensive evaluation result of each story text among the multiple story texts includes: selecting a story text with the highest comprehensive evaluation result from the multiple story texts based on the comprehensive evaluation result of each story text among the multiple story texts; when the degree of fictionality in the story characteristics corresponding to the selected story text indicates that there is fictional character information in the selected story text, removing the fictional character information in the selected story text based on the character information in the basic information to obtain a target story text; wherein the fictional character information is character information different from the character information in the basic information.
[0013] According to another aspect of the present disclosure, a story generation device is provided, comprising: an acquisition module for acquiring basic information of a story to be generated, wherein the basic information includes background information and writing requirements, and the background information includes character information and a story context; a determination module for determining auxiliary information based on the basic information, wherein the auxiliary information includes information that affects the development of the story after the story context; a generation module for generating at least one story outline based on the basic information and the auxiliary information, wherein the story outline is used to indicate an outline of the story plot developed after the story context; a supplementation module for supplementing story details for each story outline in the at least one story outline based on the auxiliary information to obtain multiple story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details; an evaluation module for evaluating each story text in the multiple story texts to obtain an evaluation result for each story text, wherein the evaluation result represents the quality of the story text; and a target determination module for determining a target story text based on the evaluation result of each story text in the multiple story texts.
[0014] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0015] According to another aspect of the present disclosure, a non-volatile computer-readable storage medium is provided, on which computer program instructions are stored, wherein the computer program instructions implement the above method when executed by a processor.
[0016] According to another aspect of the present disclosure, a computer program product is provided, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0017] According to various aspects of the present disclosure, by generating auxiliary information based on basic information, generating a story outline based on the basic information and the auxiliary information, then supplementing the story outline with story details, and then evaluating the quality of the story text after the details are supplemented, and then determining the target story text based on the evaluation results of the quality, it is possible to intelligently and automatically generate a target story text that is more detailed, logical, and reasonable and meets the user's creative needs.
[0018] Further features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the disclosure and, together with the description, serve to explain the principles of the disclosure.
[0020] Figure 1 A flowchart of a story generating method according to an embodiment of the present disclosure is shown.
[0021] Figure 2 A schematic diagram illustrating a story generation link according to an embodiment of the present disclosure is shown.
[0022] Figure 3 A block diagram of a story generating device according to an embodiment of the present disclosure is shown.
[0023] Figure 4 A block diagram of an electronic device 1900 according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0024] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numerals in the accompanying drawings represent elements with the same or similar functions. Although various aspects of the embodiments are shown in the accompanying drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
[0025] The word “exemplary” is used exclusively herein to mean “serving as an example, example, or illustration.” Any embodiment described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other embodiments.
[0026] The term "and / or" herein simply describes an association relationship between associated objects, indicating that three relationships can exist. For example, "A and / or B" can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Furthermore, the term "at least one" herein represents any combination of at least two of any one or more of a plurality of items. For example, "at least one of A, B, and C" can represent any one or more elements selected from the set consisting of A, B, and C. In the description of this disclosure, "plurality" means two or more, unless otherwise specifically defined.
[0027] It should be understood that the terms "first," "second," and the like in the claims, specification, and drawings of the present disclosure are used to distinguish between different objects, rather than to describe a specific order. The terms "include" and "comprising" used in the specification and claims of the present disclosure indicate the presence of the described features, integers, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or combinations thereof.
[0028] In addition, numerous specific details are provided in the following detailed description to better illustrate the present disclosure. Those skilled in the art will appreciate that the present disclosure can be practiced without certain specific details. In some instances, methods, means, components, and circuits well known to those skilled in the art are not described in detail in order to highlight the main points of the present disclosure.
[0029] The story generation method of the embodiment of the present disclosure can be deployed on various terminal devices through software or hardware modification. The terminal device involved in the embodiment of the present disclosure can refer to a device with a wireless connection function and / or a wired connection function. The wireless connection function means that it can be connected to other devices through wireless connection methods such as wifi and Bluetooth. The terminal device involved in the embodiment of the present disclosure can also communicate with other devices through a wired connection function. The terminal device involved in the embodiment of the present disclosure can be touch-screen, non-touch-screen, or without a screen. The touch-screen terminal device can be controlled by clicking, sliding, etc. on the display screen with a finger or stylus. The non-touch-screen device can be connected to an input device such as a mouse, keyboard, touch panel, etc., and the terminal device can be controlled by the input device. For example, a device without a screen can be a Bluetooth speaker without a screen. For example, the terminal device of the present application can include but is not limited to user equipment (UE), mobile device, user terminal, terminal, handheld device, tablet computer, laptop computer, PDA, computing device, etc.
[0030] The story generation method of the embodiment of the present disclosure can also be deployed on a server. The server can be located in the cloud or locally. It can be a physical device or a virtual device, such as a virtual machine, a container, etc., and has a wireless communication function, wherein the wireless communication function can be set in the chip (system) or other parts or components of the server. It can refer to a device with a wireless connection function. The wireless connection function means that it can be connected to other servers or terminal devices through wireless connection methods such as Wi-Fi and Bluetooth. The server involved in the embodiment of the present disclosure can also have the function of communicating via a wired connection. For example, the server of the embodiment of the present disclosure can be located in the cloud, communicate with the terminal device, receive the basic information of the story to be generated sent by the terminal device, and use the story generation method deployed on the server to generate the target story text based on the basic information, and return it to the terminal device to generate the target story text for the user in the terminal device.
[0031] Figure 1 A flowchart of a story generation method according to an embodiment of the present disclosure is shown. The method can be executed by an electronic device such as the terminal device or server, such as Figure 1 As shown, the method includes: steps S11 to S16.
[0032] In step S11, basic information of the story to be generated is obtained, wherein the basic information includes background information and writing requirements, and the background information includes character information and story context.
[0033] The writing requirements are used to indicate the direction of the story to be generated, and can be understood as the user's design requirements for the story to be generated. For example, they may include one or more of the following: the characters to be included in the story to be generated, the relationships between the characters, the characters' emotions, the key plot points to be included in the story, the ending of the story, the nature of the story (such as tragedy or comedy), etc. Character information can include the character's identity characteristics (such as name, gender, age, occupation, etc.), personality traits, relationships with other characters, and other information used to describe the character's image. The story background can be understood as the background information of the story to be generated, or the above information.
[0034] It should be understood that the above-mentioned background information and writing requirements are exemplary basic information provided by the embodiment of the present disclosure. In fact, users can set the specific content of the background information and writing requirements according to their actual needs for story creation, and the embodiment of the present disclosure does not limit this.
[0035] In step S12, auxiliary information is determined based on the basic information, where the auxiliary information includes information that affects the development of the story after the preceding story.
[0036] Among them, auxiliary information can be information generated or extracted based on basic information, which can affect the development of the story after the story, or play a decisive / constraining role. For example, auxiliary information can include at least one of character emotional information, character relationship information, story writing purpose and plot ending point; wherein, character emotional information is used to indicate the emotional state and changes (that is, emotional direction) between characters, and emotional state and change information can be extracted from writing requirements. For example, if the writing requirements are: write a plot that makes the emotions of two people drop sharply. Then this situation has a clear emotional trend, and by identifying the emotional changes between characters, subsequent plot generation can be made more accurate. Among them, character relationship information is used to indicate the relationship between characters. Character relationship information can be extracted from character information. Character relationship allows subsequent plot writing to recognize what kind of relationship there is between characters, so that the subsequent steps can clearly know the relationship between characters and avoid the situation where character relationship disorder occurs in the story. Among them, the plot ending point is used to indicate the end node of the development of the story, or in other words, to indicate the key position or result that the story development finally reaches; the plot ending point can be extracted from the writing requirements. For example, if the writing requirements are: write a plot that makes character B particularly angry and return to his parents' home, then "character B returns to his parents' home" can be the plot ending point of the story to be generated.
[0037] Among them, the purpose of story writing is used to indicate the type of story to be generated. The purpose of story writing can be extracted from the writing requirements. The significance of extracting the purpose of story writing is to accurately explore the user's creative needs and to find out what specific type of story creation purpose it is. Among them, the purpose of story writing (that is, the type of story to be generated) can include: information explanation type (representing that the generated story text is mainly to explain information), plot advancement type (representing that the generated story text is mainly to advance the plot), value change type (representing that the generated story text is mainly to reflect the changes in various aspects of the characters), dramatic conflict type (representing that the generated story text is mainly to reflect dramatic conflict). For example, the writing requirements are: write a wonderful fighting scene; then the purpose of story writing is the plot advancement type, and the generated story can revolve around the perspective of plot advancement.
[0038] Among them, the information explanation category can specifically include two subcategories, namely the event explanation subcategory and the character explanation subcategory. The event explanation subcategory is used to indicate that the story to be generated is presented in the form of character dialogue, narration, scene description, etc., so that readers can understand the background, time, place and cause of the story, and prepare for understanding the subsequent plot; the character explanation subcategory is used to indicate that the story to be generated is presented in the form of descriptions of the character's words, deeds, appearance characteristics, background stories, etc., so that readers can recognize and understand the character, identity and experience of the characters in the text, and lay the foundation for the subsequent plot development.
[0039] Among them, the plot advancement category can specifically include two subcategories, namely the event node subcategory and the suspense setting subcategory. The event node subcategory is used to indicate that the story to be generated is to prompt this plot or event to reach a result through a series of behaviors of the characters, forming a node in the story sequence, so that readers can understand the latest development and direction of the event; the suspense setting subcategory is used to indicate that the story to be generated is to set unsolved mysteries, lay foreshadowing, create suspense, etc., so as to make readers have questions and expectations about the development of the plot, attract readers' continued attention and interest, and make them have questions and expectations about the subsequent development of the plot.
[0040] Among them, the value change category can specifically include five subcategories, namely, the character image reinforcement subcategory, the character image change subcategory, the character cognition change subcategory, the character relationship change subcategory, and the emotional relationship change subcategory; the character image reinforcement subcategory is used to indicate that the story to be generated is to reveal the deeper character personality, values, beliefs or spirit, making the character image more three-dimensional and full; the character image change subcategory is used to indicate that the story to be generated is to show the character's emotional change or personality change, so as to increase the character's complexity and depth, making the character image more three-dimensional and full; the character cognition change subcategory is used to indicate that the story to be generated is to show the character's inner monologue, self-reflection, and other aspects of the story. The subcategory of changes in character relationships is used to indicate that the story to be generated is to show the establishment, development, breakdown or turning point of character relationships, thereby increasing dramatic conflicts, such as from friends to enemies, from cooperative relationships to competitive relationships, from husband and wife to strangers, etc. The subcategory of changes in emotional relationships is used to indicate that the story to be generated is to show the emotional changes between characters, including emotional relationships of different dimensions such as family, friendship, and love, so as to enrich the character image and promote the development of the plot, such as from trust to distrust, from love to disgust, from forbearance to catharsis.
[0041] Among them, the dramatic conflict category can specifically include three subcategories, namely the conflict occurrence subcategory, the conflict outbreak subcategory and the conflict resolution subcategory. The conflict occurrence subcategory is used to indicate that the story to be generated is to create dramatic conflicts through contradictions, differences of opinion, conflicts of interest, etc. between characters, thereby enhancing the drama and watchability of the story and triggering readers' resonance and thinking; the conflict outbreak subcategory is used to indicate that the story to be generated is to push the conflict to a climax through fierce quarrels, physical conflicts, emotional outbursts, etc. between characters, triggering readers' emotional resonance and promoting the development of the plot; the conflict resolution subcategory is used to indicate that the story to be generated is to resolve contradictions through communication and reconciliation between characters, action strategies, external intervention, inner struggles, etc., to end the conflict, push the plot forward and reach the climax or ending of the story.
[0042] In recent years, natural language processing (NLP) technology has made significant progress. In particular, large natural language models based on deep learning (such as the GPT model and the BERT model) have demonstrated powerful capabilities in natural language generation and natural language understanding. These models are trained on large amounts of text data to understand and generate text. Therefore, in one possible implementation, the above-mentioned auxiliary information can be extracted from the basic information using a large natural language model (i.e., a large language model) known in the art, which is not limited in the embodiments of the present disclosure.
[0043] In actual applications, considering that the writing requirements set by the user may be unreasonable, for example, the writing requirements do not conform to the story development logic, the requirements are relatively extreme, etc. Therefore, in a possible implementation, the above-mentioned determination of the auxiliary information based on the basic information may include:
[0044] The first language model is used to determine whether the writing requirements are reasonable. If the first language model determines that the writing requirements are reasonable, the second language model is used to extract auxiliary information from the basic information. Reasonable writing requirements can be understood as indicating that the story direction indicated by the writing requirements is reasonable, or conforms to the normal story development logic.
[0045] It should be understood that the first large language model and the second large language model can adopt large language models of the type known in the art (such as general large language models such as qwen 2.0). Those skilled in the art can adopt model training methods known in the art and use data sets to fine-tune the pre-trained general large language model to obtain the first large language model and the second large language model that can complete different tasks. As long as the trained large language model can achieve the functions it needs to achieve, the embodiments of the present disclosure are not limited to this. For example, a supervised fine-tuning training (Supervised Fine-Tuning, SFT) method can be adopted. Supervised fine-tuning training is a machine learning training technology that uses a labeled data set of a specific task to perform further supervised fine-tuning training on a pre-trained general large language model (LLM). The trained large language model can be adapted to a specific task and improve its performance on the task. For example, the training process for the first large language model may include: constructing a data set including various sample writing requirements and sample labels (reasonable or unreasonable), and then based on the data set, inputting writing requirement samples and related instructions (such as "Please judge whether the input writing requirements are reasonable") into a pre-trained general large language model to obtain a judgment result on whether the writing requirements output by the general large language model are reasonable, and combining the sample labels of the sample writing requirements (reasonable or unreasonable) to calculate the loss, and adjusting the parameters of the general large language model based on the loss to obtain the above-mentioned first large language model. The training process for the second largest language model may include: constructing a data set including sample basic information and corresponding sample auxiliary information extracted from original story texts with storylines such as scripts and novels, and then based on the data set, inputting the sample basic information and related instructions (such as "please extract at least one auxiliary information including character emotional information, character relationship information, story writing purpose and plot ending point from the input basic information") into a pre-trained general large language model to obtain predicted auxiliary information output by the general large language model, and then calculating the loss based on the difference between the sample auxiliary information and the predicted auxiliary information, and using the loss to adjust the parameters of the general large language model to obtain the above-mentioned second largest language model.
[0046] Those skilled in the art should understand that the step of using the first language model to determine whether the writing requirement is reasonable can be omitted, that is, the second language model can be directly used to extract auxiliary information from the basic information.
[0047] In step S13, at least one story outline is generated based on the basic information and the auxiliary information, where the story outline is used to indicate an outline of the plot developed after the story background.
[0048] It can be understood that generating an outline of the story plot that develops after the story background is equivalent to continuing the story background, that is, the plot continuation is mainly for generating an outline of the story that develops after the story background. Furthermore, the outline of the story that develops after the story background can be used to generate a detailed story text later.
[0049] In practical applications, a large language model can be used to deduce the plot based on the basic information and the auxiliary information, generating a more natural story outline through deduction. Considering that plot deduction can be understood as the continuation of the subsequent plot based on the current plot, for example, after the husband and wife enter the restaurant, multiple plots may be deduced, and the model-derived plot may include deliberate events (such as the sudden appearance of a certain character) and low-probability events (such as the sudden fall of a meteorite), etc., it is possible to use the large language model to deduce dozens of deduced plots, and then use the logic of plot screening to filter out abnormal plots in the deduced plots.
[0050] Understandably, when reading novels, movies, or watching TV series, if a key character suddenly appears, the plot may feel overly contrived, or overtly contrived. This can make the story unappealing, illogical, and irrational. Therefore, given that the deduced plots generated by the large language model may contain unusual events, plot filtering can be used to filter out these unusual events, facilitating the generation of a story synopsis that aligns with the logical development of the story. Plot filtering essentially selects the plot deduction results from the previous step, selecting the most logical deductions to naturally reach the plot's conclusion. Plot deduction and plot filtering can be iterated over multiple rounds. After each round of plot deduction and screening, the next round of plot deduction begins, continuing until the deduced plot reaches the plot's conclusion. This results in a more natural story synopsis.
[0051] Therefore, in a possible implementation, generating at least one story outline based on the basic information and the auxiliary information may include:
[0052] Based on the basic information and the auxiliary information, the following processing is performed cyclically until the generated i-th target deduction plot reaches the plot ending point:
[0053] Using the third language model, based on the basic information, the auxiliary information, and the i-1th target deduction plot, a plurality of i-th target deduction plots developed after the i-1th target deduction plot are generated; wherein, i ≥ 1, the 0th target deduction plot is the story beforehand;
[0054] Using the fourth language model and the auxiliary information, filtering out abnormal plots from a plurality of i-th segment deduction plots to obtain at least one i-th segment target deduction plot;
[0055] For any i-th target deduction plot that reaches the plot ending point, the deduction plot from the 1st target deduction plot to the i-th target deduction plot is determined as the story outline; at least one i-th target deduction plot that reaches the plot ending point corresponds to at least one story outline.
[0056] For example, after obtaining the above-mentioned basic information and auxiliary information, the third language model can be used to generate multiple first-paragraph deduction plots developed after the story antecedents based on the basic information (including the story antecedents, i.e., the 0th paragraph target deduction plot) and the auxiliary information; then, the fourth language model can be used to filter out abnormal plots from the multiple first-paragraph deduction plots based on the above-mentioned auxiliary information (i.e., filter out abnormal deduction plots) to obtain at least one first-paragraph target deduction plot; for any first-paragraph target deduction plot, if the first-paragraph target deduction plot does not reach the plot landing point, the third language model is continued to be used to generate multiple second-paragraph deduction plots developed after the first-paragraph target deduction plot based on the basic information, auxiliary information and the first-paragraph target deduction plot; then, the fourth language model can be used to filter out abnormal plots from the multiple second-paragraph deduction plots based on the above-mentioned auxiliary information to obtain at least A second-stage target deduction plot; for any second-stage target deduction plot, if the second-stage target deduction plot has reached the plot ending point, the loop is ended, and the deduction plot from the first-stage target deduction plot to the second-stage target deduction plot that has reached the plot ending point is determined as the story outline; if the second-stage target deduction plot has not reached the plot ending point, the third language model is continued to be used to generate multiple third-stage deduction plots developed after the second-stage target deduction plot, and then the fourth language model is used to filter out abnormal plots from the multiple third-stage deduction plots to obtain at least one third-stage target deduction plot, and so on, until the i-th stage target deduction plot reaches the plot ending point, and then the deduction plot from the first stage target deduction plot to the i-th stage target deduction plot that has reached the plot ending point is determined as the story outline. It should be understood that the generated at least one i-th stage target deduction plot that reaches the plot ending point can correspond to the generation of at least one story outline.
[0057] It should be understood that the third and fourth language models can adopt large language models of types known in the art (such as the general large language models such as the above-mentioned qwen 2.0). Those skilled in the art can adopt model training methods known in the art, such as supervised fine-tuning training (SFT) method, to use different data sets to fine-tune the pre-trained general large language model to obtain the third and fourth language models that can complete different tasks. As long as the trained large language model can achieve the functions it needs to achieve, the embodiments of the present disclosure are not limited to this. For example, a general large language model of any structure suitable for story generation can be selected, and a dataset can be constructed including sample auxiliary information and sample basic information extracted from plot-containing texts such as scripts and novels, as well as existing plots and actual subsequent plots. Based on this dataset, the sample auxiliary information and sample basic information, the existing plot, and related instructions (such as "Please deduce the subsequent plot from the input existing plot based on the input auxiliary information and basic information") are input into a pre-trained general large language model to obtain the deduced subsequent plot output by the general large language model. The loss is calculated based on the difference between the deduced subsequent plot output by the model and the actual subsequent plot, and the parameters of the general large language model are adjusted based on the loss. This allows the general large language model to learn from plot-containing texts such as scripts and novels, and obtain a third large language model that can generate a subsequent plot based on the basic information, auxiliary information, and existing plots. A plot can include basic plot elements such as the characters involved, time, place, scene, and events. An event can be any intermediate event experienced between the beginning and the end of the story. The training process for the fourth language model may include: constructing a dataset including plot samples and corresponding labels (normal, abnormal); based on this dataset, the plot samples and related instructions (such as "Please determine whether the input plot is normal") are input into a pre-trained general language model to obtain the general language model's output prediction results (normal, abnormal); then calculating a loss based on the prediction results and the labels corresponding to the plot samples; and adjusting the parameters of the general language model based on the loss to obtain the aforementioned fourth language model. Abnormal plots may include unreasonable character relationships, unreasonable events, etc.
[0058] By generating plots in segments and screening the multiple plots generated in each segment to see if they are normal, we can ensure both the diversity and rationality of the generated story outlines.
[0059] Those skilled in the art should understand that all deduction plots that reach the plot point can also be generated directly based on the basic information and auxiliary information.
[0060] In step S14, story details are supplemented for each of the at least one story outline based on the auxiliary information to obtain multiple story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details.
[0061] The story outline contains the basic elements of the story and is a distillation and summary of the story, while the story details may include character dialogues, psychological activities, environmental descriptions and more detailed content.
[0062] In one possible implementation, the above-mentioned supplementing story details for each of the at least one story outline based on the auxiliary information to obtain multiple story texts corresponding to the at least one story outline may include: for any story outline, using the fifth language model to supplement the story outline with at least one story detail based on the auxiliary information to obtain at least one story text corresponding to the story outline; wherein the story details include at least one of the following: character's actions, expressions, dialogues, psychological state, purpose of behavior, story background, location, and environment.
[0063] The fifth language model primarily generates specific story details based on the preceding auxiliary information and story outline. This model supplements the story outline with specific plot information, including character actions, expressions, dialogue, psychological states, behavioral purposes, and story background, location, and environment. This approach enriches the generated story text and aligns with human preferences for storytelling.
[0064] Among them, the fifth language model can adopt a large language model known in the art, and those skilled in the art can use a model training method known in the art to train the fifth language model, as long as the trained fifth language model can achieve the functions it needs to achieve, and the embodiments of the present disclosure are not limited to this. For example, a supervised fine-tuning (SFT) method can be used. Supervised fine-tuning training is a machine learning training technique that uses a labeled dataset of a specific task to perform further supervised fine-tuning training on a pre-trained large language model (LLM), so that the trained LLM can be adapted to a specific task and improve its performance on the task. For example, a data set can be constructed including sample auxiliary information and sample story outlines extracted from original story texts with rich story details, such as scripts and novels. Based on the data set, the sample auxiliary information and sample story outline extracted from the original story text and related instructions (such as "Please add at least one story detail such as the character's actions, expressions, dialogues, psychological state, behavioral purpose, story background, location, and environment to the input story outline based on the input auxiliary information") are input into a pre-trained general large language model to obtain the predicted story text output by the general large language model. Then, the difference between the predicted story text output by the model and the original story text can be used to calculate the loss, and the parameters of the general large language model can be adjusted based on the loss to obtain the above-mentioned fifth large language model.
[0065] In step S15 , each of the multiple story texts is evaluated to obtain an evaluation result of each story text, wherein the evaluation result represents the quality of the story text.
[0066] In practical applications, a large language model can be used to evaluate the quality of each story text among multiple story texts. In other words, the large language model can be directly used to evaluate the quality of each story, so that the quality of each story can be used to select a better target story text.
[0067] The quality of a story can be characterized based on the story characteristics of the story text, which may include at least one of the following: the degree of story adherence to the title, the degree of story completeness, the degree of logical rigor, the degree of plot novelty, the degree of plot excitement, the degree of character development, the degree of presentation of character relationships, the degree of presentation of character emotional changes, the degree of fictionalization of character information, and the degree of dialogue description. A higher degree of story adherence to the title, a higher degree of story completeness, a higher degree of logical rigor, a higher degree of plot novelty, a higher degree of plot excitement, a higher degree of character development, a higher degree of presentation of character relationships, a higher degree of presentation of character emotional changes, a lower degree of fictionalization of character information, and a lower degree of dialogue description indicates a better story text, and vice versa.
[0068] Among them, the degree of story relevance can indicate the relevance of the story text to the story writing purpose and writing requirements, or in other words, it can indicate whether the specific plot in the story text is developed based on the story's background and around the story writing purpose and writing requirements. Specifically, it can indicate whether the main characters, character settings, story background and main plot line in the story text are consistent, whether there are any irrelevant plots that have been tampered with or expanded, whether the beginning of the story has been tampered with, whether a plot that deviates from the story writing requirements has been generated, and whether an ending not mentioned in the writing requirements has been continued. The higher the degree of story relevance to the topic, the more the specific plot of the story text is developed based on the story's background and around the story writing purpose and writing requirements. Conversely, the lower the degree of story relevance to the topic, the less the specific plot of the story text is developed based on the story's background and around the story writing purpose and writing requirements.
[0069] The degree of story completeness can be used to characterize the completeness of a story text. Specifically, it can indicate whether the story text contains the three basic pieces of information: the story's cause, process, and outcome; or whether it also contains the five dramatic elements: the main characters, their goals in the story, the conflicts and obstacles they encounter, their actions to resolve the conflicts, and the outcome. A story text with a higher degree of story completeness is more likely to contain these three basic pieces of information and / or the five dramatic elements. A story text with a lower degree of story completeness is more likely to contain incomplete three basic pieces of information and / or the five dramatic elements. In other words, the story text may be missing some basic information and / or some dramatic elements.
[0070] The degree of logical rigor can characterize the logic of each plot point in the story text. Specifically, it can indicate whether the story text is logically correct, coherent, has a natural flow, has no repeated content, and whether there are problems with time and space confusion (i.e., the content of the story plot does not match the historical context to which it belongs), incorrect character status problems (i.e., the character behavior does not match the character information specified in the basic information and the story's previous events, making the character image appear unclear), unclear character relationships (i.e., character behavior does not match the character relationship, for example: Character A and Character B, who are originally friends, behave as if they do not know each other in the story text), and plot logic confusion problems (i.e., the plot in the story text cannot correctly connect with the previous text, the designed plot is different from the audience's normal cognition, and cannot withstand scrutiny). The higher the degree of logical rigor, the more logically correct, coherent, naturally connected, without repeated content, and without the above-mentioned logical problems in the story text. The lower the degree of logical rigor, the more logically incorrect, incoherent, unnaturally connected, with repeated content, and with the above-mentioned logical problems in the story text.
[0071] The novelty of the plot can be used to characterize the innovative nature of the story text. It should be understood that a story text with a higher degree of novelty is more likely to contain interesting, novel, and unexpected content, such as character development techniques, conflict design, and how characters solve problems. This indicates that the story text is unconventional, innovative, and imaginative, potentially opening up creative thinking and inspiring users. On the other hand, a story text with a lower degree of novelty tends to contain clichéd and common plotlines, indicating that the generated story text is clichéd, uninnovative, unappealing, and unimaginative.
[0072] The degree of plot excitement can represent the excitement of the story text's content. A story text with a higher degree of plot excitement will have more ups and downs, twists and turns, and surprises, and will meet the expectations of a compact and efficient plot rhythm. A story text with a lower degree of plot excitement will have a more bland plot, failing to attract readers, with a chaotic rhythm, boring, and a random accumulation of useless plots that fail to express the purpose of the story.
[0073] The degree of character development reflects the extent to which a story's core characters are portrayed, or more precisely, whether the story can portray the characters through specific events within the plot, enhancing the audience's understanding of the characters. Stories with higher degrees of character development tend to have richer and more complete characterizations, offering a more three-dimensional and rich portrayal of the characters, and more fully fleshed out characters. Stories with lower degrees of character development tend to have thin, uninteresting, and uninspired characterizations.
[0074] The degree of character relationship presentation can indicate the extent to which character relationships are presented in a story. Common character relationships include: family and kinship, friendship and colleagues, love and partner, rivalry and competition, and social connections. The higher the degree of character relationship presentation, the clearer the relationships between characters are. The lower the degree of character relationship presentation, the more ambiguous and difficult it is to discern.
[0075] The degree of emotional expression of characters can be used to characterize the degree of emotional change in character relationships within a story (e.g., emotional progression, distancing, or confrontation). Stories with a higher degree of emotional expression tend to display more intense, extreme, unexpected, and reversible emotional changes, and the corresponding emotional changes are more aligned with the plot and character relationships. Stories with a lower degree of emotional expression tend to display more flat emotional changes, with less emotional intensity or no reversals.
[0076] The degree of fictionality of character information can represent the amount of fictitious character information in the story text. Fictional character information includes, for example, fictional character experiences, fictional occupations, fictional character relationships, fictional hobbies, preferences, and other information that is clearly not mentioned in the character information in the basic information. In other words, fictional character information is character information that differs from the character information in the basic information. The higher the degree of fictionality of the character information, the more fictional character information the story text contains that is not mentioned in the character information in the basic information. The lower the degree of fictionality of the character information, the less fictional character information the story text contains.
[0077] The degree of dialogue description can be used to characterize the amount of dialogue within a story. It should be understood that the more dialogue a story contains, the less character psychology, actions, and motivations are described. Stories with lower levels of dialogue description contain fewer dialogues, similar to narration, which more clearly explain character motivations, psychology, and actions, while focusing on the visuals. Stories with higher levels of dialogue description contain more dialogue, and the plot is more often driven by dialogue, while the description of character motivations, actions, and psychology is neglected.
[0078] Based on the various story characteristics described above, in a possible implementation, the evaluation of each of the multiple story texts to obtain the evaluation result of each story text may include:
[0079] For any story text, using the sixth language model, based on the basic information and the auxiliary information, evaluate at least one story characteristic of the story text at least once, and obtain at least one evaluation score for each of the at least one story characteristic of the story text;
[0080] An average value of at least one evaluation score of each story characteristic is used as a characteristic evaluation result of each story characteristic, and the evaluation result of the story text includes the characteristic evaluation result of at least one story characteristic of the story text.
[0081] In practical applications, the sixth language model can be used to score each story text according to the above basic information and auxiliary information according to the degree of story adherence to the topic, the degree of story completeness, the degree of logical rigor, the degree of plot novelty, the degree of plot excitement, the degree of character development, the degree of display of character relationships, the degree of display of character emotional changes, the degree of fictionality of character information, and the degree of dialogue description, so as to obtain evaluation scores for the above-mentioned story characteristics, for example, the scoring can be performed in a range of 0-10 points; among which, the higher the degree of story adherence to the topic, the higher the score of story adherence to the topic; the higher the degree of story completeness, the higher the score of story completeness; the higher the degree of logical rigor, the higher the score of logical rigor; the higher the degree of plot novelty, the higher the score of plot novelty; the higher the degree of plot excitement, the higher the score of plot excitement; the higher the degree of character development, the higher the score of character development; the higher the degree of display of character relationships, the higher the score of the degree of display of character relationships; the higher the degree of display of character emotional changes, the higher the score of the degree of display of character emotional changes; the lower the degree of fictionality of character information, the higher the score of the degree of fictionality of character information; the lower the degree of dialogue description, the higher the score of the degree of dialogue description.
[0082] In order to improve the accuracy of the evaluation scores, the sixth language model can be used to evaluate at least one story feature of the same story text multiple times to obtain multiple evaluation scores for each of the at least one story feature of the story text. The average of the multiple evaluation scores of each story feature can then be used as the feature evaluation result of each story feature. Based on the feature evaluation result of at least one story feature of the story text, the target story text with the best various story features can be screened out from multiple story texts. Among them, the sixth language model can also be obtained by fine-tuning the general large language model using the data set. For example, a data set can be constructed including sample story texts and corresponding story feature labels. Based on the data set, the sample story text and related instructions are input into the pre-trained general large language model (such as "extract at least one story feature from the input story text, including the degree of story relevance, story completeness, logical rigor, plot novelty, plot excitement, character creation, degree of display of character relationships, degree of display of character emotional changes, degree of fictionality of character information, and degree of dialogue description") to obtain the predicted story features output by the general large language model, and then calculate the loss between the predicted story features and the story feature labels, and use the loss to adjust the parameters of the general large language model to obtain the above-mentioned sixth language model.
[0083] In step S16 , a target story text is determined based on the evaluation result of each story text in the plurality of story texts.
[0084] As described above, the evaluation results of the story texts can represent the quality of the story texts. Therefore, the optimal story text can be directly selected from multiple story texts as the target story text. Considering that the story texts generated using the large language model may also contain information about fictional characters, the fictional character information in the selected story texts can be removed based on the character information in the basic information to obtain a target story text that meets the user's expectations.
[0085] As described above, the evaluation results of the story texts may include a characteristic evaluation result of at least one story characteristic of the story texts. Therefore, determining the target story text based on the evaluation results of each of the multiple story texts may include:
[0086] Based on the characteristic evaluation results of at least one story characteristic of each story text in the multiple story texts, a comprehensive evaluation result of each story text is determined; based on the comprehensive evaluation results of each story text in the multiple story texts, a target story text is determined.
[0087] The characteristic evaluation results of at least one story characteristic of each story text may be summed, weighted summed, averaged, or weighted averaged to obtain a comprehensive evaluation result for each story text, and this embodiment of the present disclosure is not limited to this. It should be understood that when weighted processing is adopted, the user can customize the weight of each story characteristic according to actual needs (such as the importance of each story characteristic) to utilize the weight of each story characteristic to perform weighted processing on the story characteristics to obtain a comprehensive evaluation result for the story text, and this embodiment of the present disclosure is not limited to this.
[0088] Optionally, the above-mentioned determination of the target story text based on the comprehensive evaluation result of each story text in the multiple story texts may include, for example, directly selecting the story text with the highest comprehensive evaluation result from the multiple story texts as the target story text.
[0089] Considering that the story text generated by the large language model may contain information about fictional characters, in one possible implementation, determining the target story text based on the comprehensive evaluation results of each of the multiple story texts may include:
[0090] According to the comprehensive evaluation results of each story text among multiple story texts, the story text with the highest comprehensive evaluation result is selected from the multiple story texts; when the degree of fictionality in the story characteristics corresponding to the selected story text indicates that there is fictional character information in the selected story text, the fictional character information in the selected story text is removed according to the character information in the basic information to obtain the target story text.
[0091] In practical applications, the seventh language model can be used to remove fictional character information from the selected story text based on the character information in the basic information. Of course, other information proofreading techniques known in the art can also be used to remove fictional character information from the selected story text, and this disclosure is not limited to this. In this way, fictional character information that does not match the character information specified in the basic information can be removed, such as removing fictional character experiences and professional relationships, so that the generated target story text conforms to the character information designed by the user. Among them, the seventh language model can also be obtained by fine-tuning the general language model using the data set. For example, a data set can be constructed including sample basic information of the original story text and sample story text with fictional character information added to the original story text. Based on the data set, the sample basic information and sample story text and related instructions (such as "Please remove the fictional character information from the input story text based on the input basic information") are input into the pre-trained general language model to obtain the predicted story text with the fictional character information removed output by the general language model. Then, the loss can be calculated using the difference between the predicted story text output by the model and the original story text, and the parameters of the general language model can be adjusted based on the loss to obtain the above-mentioned seventh language model.
[0092] In practical applications, the story generation method of the embodiment of the present disclosure can be integrated into an intelligent agent, and the various large language models used in the intelligent agent can be built using the Langgraph technology architecture (an underlying framework for building complex intelligent agents based on large language models (LLMs)); a long-term memory module can also be set in the intelligent agent to save the intermediate results generated in the above story generation process (such as the auxiliary information generated in the above step S12, the story outline generated in the above step S13, the story text generated in the above step S14, the evaluation results generated in the above step S15, etc.) for use in subsequent steps. Long-term memory can be applied to the large language model used in each step to supplement the context information and help the large language model generate corresponding results.
[0093] According to the story generation method of the embodiment of the present disclosure, by generating auxiliary information based on basic information, generating a story outline based on the basic information and the auxiliary information, then supplementing the story outline with story details, and then evaluating the quality of the story text after the details are supplemented, and then determining the target story text based on the evaluation results of the quality, it is possible to intelligently and automatically generate a target story text that is more detailed, logical, and reasonable and meets the user's creative needs.
[0094] Based on the story generation method provided by the above embodiment of the present disclosure, the present disclosure embodiment also provides Figure 2 A schematic diagram of a story generation link is shown, such as Figure 2 As shown, the process of the above story generation method can be disassembled to obtain a story generation chain composed of an NLU module, a plot continuation module, an SFT module, a post-link module, and a long-term memory module. The process of generating a target story text using the above story generation chain includes: inputting basic information such as background information and writing requirements, judging whether the writing requirements are reasonable, and if the writing requirements are unreasonable, inputting new writing requirements; if the writing requirements are reasonable, the NLU module extracts auxiliary information such as character emotion information, character relationship information, story writing purpose, and plot ending from the background information and writing requirements, and saves the character emotion information, character relationship information, story writing purpose, and plot ending as long-term memory; then, in order to achieve the generation of creative To create a meaningful and exciting target story text, the plot continuation module can be used to enumerate and deduce possible plots, generating multiple deduced plots in parallel within a limited plot, thereby selecting the better deduced plot. Specifically, the plot continuation module can loop through plot deduction and plot screening based on basic information and auxiliary information to generate at least one story outline; the SFT module adds story details to the story outline based on the auxiliary information to obtain multiple story texts; then, the post-link module screens and modifies each story text, that is, evaluates the quality of each story text and selects the story text with the best evaluation result from the multiple story texts, and removes the fictional character information from the selected story text to obtain the target story text. Among them, the rationality of the story generation method can be reflected through the plot design module, the innovation of the story generation method can be achieved through the plot continuation module and the post-link module, and the logic of the story generation method can be reflected through the post-link module.
[0095] Figure 3 A block diagram of a story generating device according to an embodiment of the present disclosure is shown as follows: Figure 3 As shown, the device includes:
[0096] An acquisition module 301 is used to acquire basic information of a story to be generated, wherein the basic information includes background information and writing requirements, and the background information includes character information and story context;
[0097] A determination module 302 determines auxiliary information based on the basic information, wherein the auxiliary information includes information that affects the development of the story after the preceding story;
[0098] A generating module 303 is configured to generate at least one story outline based on the basic information and the auxiliary information, wherein the story outline is used to indicate an outline of the plot developed after the story background;
[0099] A supplementing module 304 is configured to supplement story details for each of the at least one story outlines based on the auxiliary information to obtain a plurality of story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details;
[0100] An evaluation module 305 evaluates each of the plurality of story texts to obtain an evaluation result for each story text, wherein the evaluation result represents the quality of the story text;
[0101] The target determination module 306 is configured to determine a target story text according to the evaluation result of each story text in the plurality of story texts.
[0102] In one possible implementation, the writing requirements are used to indicate the direction of the story to be generated; the auxiliary information includes at least one of character emotional information, character relationship information, story writing purpose and plot ending point, the character emotional information is used to indicate the emotional state and changes between characters, the character relationship information is used to indicate the relationship between characters, the story writing purpose is used to indicate the type of story to be generated, and the plot ending point is used to indicate the end node of the story development.
[0103] In one possible implementation, determining the auxiliary information based on the basic information includes: using a first language model to determine whether the writing requirements are reasonable; and if the first language model determines that the writing requirements are reasonable, using a second language model to extract the auxiliary information from the basic information.
[0104] In a possible implementation, generating at least one story outline based on the basic information and the auxiliary information includes:
[0105] Based on the basic information and the auxiliary information, the following processing is performed cyclically until the generated i-th target deduction plot reaches the plot ending point:
[0106] Using the third language model, based on the basic information, the auxiliary information, and the i-1th target deduction plot, a plurality of i-th segment deduction plots developed after the i-1th target deduction plot; wherein, i ≥ 1, the 0th target deduction plot is the story's antecedent;
[0107] Using the fourth language model and the auxiliary information, filtering out abnormal plots from the plurality of i-th segment deduction plots to obtain at least one i-th segment target deduction plot;
[0108] For any i-th target deduction plot that reaches the plot ending point, the deduction plot from the 1st target deduction plot to the i-th target deduction plot is determined as the story outline; at least one i-th target deduction plot that reaches the plot ending point corresponds to at least one story outline.
[0109] In one possible implementation, the method of supplementing story details for each of the at least one story outline based on the auxiliary information to obtain multiple story texts corresponding to the at least one story outline includes: for any story outline, using the fifth language model to supplement at least one story detail for the story outline based on the auxiliary information to obtain at least one story text corresponding to the story outline; wherein the story details include at least one of the following: character's actions, expressions, dialogues, psychological states, behavioral purposes, story background, location, and environment.
[0110] In one possible implementation, the evaluating of each of the multiple story texts to obtain an evaluation result of each story text includes: for any story text, using the sixth language model to evaluate at least one story characteristic of the story text at least once based on the basic information and the auxiliary information, to obtain at least one evaluation score for each of the at least one story characteristic of the story text; taking the average of the at least one evaluation scores of each story characteristic as the characteristic evaluation result of each story characteristic, and the evaluation result of the story text includes the characteristic evaluation result of the at least one story characteristic of the story text.
[0111] In one possible implementation, the story characteristics include at least one of the following: the degree to which the story is relevant to the title, the degree to which the story is complete, the degree to which the logic is rigorous, the degree to which the plot is novel, the degree to which the plot is exciting, the degree to which the characters are portrayed, the degree to which the relationships between the characters are displayed, the degree to which the emotional changes of the characters are displayed, the degree to which the character information is fictional, and the degree to which the dialogue is described.
[0112] In one possible implementation, determining the target story text based on the evaluation results of each story text among the multiple story texts includes: determining a comprehensive evaluation result of each story text based on a characteristic evaluation result of at least one story characteristic of each story text among the multiple story texts; and determining the target story text based on the comprehensive evaluation result of each story text among the multiple story texts.
[0113] In one possible implementation, determining a target story text based on a comprehensive evaluation result of each story text among the multiple story texts includes: selecting a story text with the highest comprehensive evaluation result from the multiple story texts based on the comprehensive evaluation result of each story text among the multiple story texts; when the degree of fictionality in the story characteristics corresponding to the selected story text indicates that there is fictional character information in the selected story text, removing the fictional character information in the selected story text based on the character information in the basic information to obtain a target story text; wherein the fictional character information is character information different from the character information in the basic information.
[0114] According to the story generation device of the embodiment of the present disclosure, by generating auxiliary information based on basic information, generating a story outline based on the basic information and the auxiliary information, then supplementing the story outline with story details, and then evaluating the quality of the story text after the details are supplemented, and then determining the target story text based on the evaluation results of the quality, it is possible to intelligently and automatically generate a target story text that is more detailed, logical, and reasonable and meets the user's creative needs.
[0115] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0116] The present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions implement the above method when executed by a processor. The computer-readable storage medium may be a volatile or non-volatile computer-readable storage medium.
[0117] An embodiment of the present disclosure further proposes an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to implement the above method when executing the instructions stored in the memory.
[0118] An embodiment of the present disclosure also provides a computer program product, including computer-readable code, or a non-volatile computer-readable storage medium carrying computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.
[0119] Figure 4 FIG1 shows a block diagram of an electronic device 1900 according to an embodiment of the present disclosure. For example, the electronic device 1900 can be provided as a server or a terminal device. Figure 4The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by a memory 1932 for storing instructions executable by the processing component 1922, such as an application. The application stored in the memory 1932 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above-described method.
[0120] The electronic device 1900 may further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output interface 1958 (I / O interface). The electronic device 1900 may operate based on an operating system stored in the memory 1932, such as Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM or similar.
[0121] In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as a memory 1932 including computer program instructions that can be executed by the processing component 1922 of the electronic device 1900 to perform the above method.
[0122] The present disclosure may be a system, method and / or computer program product. The computer program product may include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.
[0123] A computer-readable storage medium can be a tangible device that can hold and store instructions for use by an instruction execution device. A computer-readable storage medium can be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination thereof. As used herein, a computer-readable storage medium is not to be construed as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., a light pulse through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
[0124] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions to be stored in the computer-readable storage medium in each computing / processing device.
[0125] The computer program instructions for performing the operations of the present disclosure may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages such as Smalltalk, C++, and conventional procedural programming languages such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., utilizing an Internet service provider to connect via the Internet). In some embodiments, an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), may be personalized by utilizing the state information of the computer-readable program instructions. The electronic circuit may execute the computer-readable program instructions, thereby realizing various aspects of the present disclosure.
[0126] Various aspects of the present disclosure are described herein with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.
[0127] These computer-readable program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processor of the computer or other programmable data processing device, a device is generated that implements the functions / actions specified in one or more blocks in the flowchart and / or block diagram. These computer-readable program instructions can also be stored in a computer-readable storage medium, where these instructions cause the computer, programmable data processing device, and / or other device to operate in a specific manner. Thus, the computer-readable medium storing the instructions comprises an article of manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0128] Computer-readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, thereby causing the instructions executed on the computer, other programmable data processing apparatus, or other device to implement the functions / actions specified in one or more blocks in the flowchart and / or block diagram.
[0129] The flow charts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and the part of the module, program segment or instruction contains one or more executable instructions for realizing the prescribed logical function. In some alternative implementations, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flow chart, and the combination of the boxes in the block diagram and / or flow chart can be implemented by a dedicated hardware-based system that performs the prescribed function or action, or can be implemented by a combination of dedicated hardware and computer instructions.
[0130] While various embodiments of the present disclosure have been described above, the foregoing description is intended to be illustrative, non-exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is selected to best explain the principles of the embodiments, their practical applications, or technological improvements in the marketplace, or to enable others skilled in the art to understand the embodiments disclosed herein.
Claims
1. A story generation method, characterized in that: include: Obtaining basic information of the story to be generated, wherein the basic information includes background information and writing requirements, and the background information includes character information and story context; Determining auxiliary information based on the basic information, the auxiliary information including information that affects the development of the story after the preceding story, the auxiliary information including at least one of character emotional information, character relationship information, story writing purpose, and plot conclusion, the story writing purpose including any one of information explanation, plot advancement, value change, and dramatic conflict; generating at least one story outline based on the basic information and the auxiliary information, wherein the story outline is used to indicate an outline of the plot developed after the story background; Supplementing story details for each of the at least one story outlines according to the auxiliary information to obtain a plurality of story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details; Evaluating each of the plurality of story texts to obtain an evaluation result for each story text, wherein the evaluation result represents the quality of the story text; A target story text is determined according to the evaluation result of each story text in the plurality of story texts.
2. The method according to claim 1, characterized in that The writing requirements are used to indicate the direction of the story to be generated; The character emotion information is used to indicate the emotional state and changes between characters, the character relationship information is used to indicate the relationship between characters, the story writing purpose is used to indicate the type of story to be generated, and the plot ending point is used to indicate the end node of the story plot development.
3. The method according to claim 1 or 2, characterized in that The determining of auxiliary information according to the basic information includes: Using the first language model to determine whether the writing requirements are reasonable; When the first language model determines that the writing requirement is reasonable, the second language model is used to extract the auxiliary information from the basic information.
4. The method according to claim 1 or 2, characterized in that Generating at least one story outline based on the basic information and the auxiliary information includes: Based on the basic information and the auxiliary information, the following processing is performed cyclically until the generated i-th target deduction plot reaches the plot ending point: Using the third language model, based on the basic information, the auxiliary information, and the i-1th target deduction plot, a plurality of i-th segment deduction plots developed after the i-1th target deduction plot; wherein, i ≥ 1, the 0th target deduction plot is the story's antecedent; Using the fourth language model and the auxiliary information, filtering out abnormal plots from the plurality of i-th segment deduction plots to obtain at least one i-th segment target deduction plot; For any i-th target deduction plot that reaches the plot ending point, the deduction plot from the 1st target deduction plot to the i-th target deduction plot is determined as the story outline; at least one i-th target deduction plot that reaches the plot ending point corresponds to at least one story outline.
5. The method according to claim 1 or 2, characterized in that The step of supplementing each of the at least one story outline with story details according to the auxiliary information to obtain a plurality of story texts corresponding to the at least one story outline includes: For any story synopsis, using the fifth language model to supplement the story synopsis with at least one story detail based on the auxiliary information to obtain at least one story text corresponding to the story synopsis; The story details include at least one of the following: character's actions, expressions, dialogues, psychological states, behavioral purposes, story background, location, and environment.
6. The method according to claim 1, characterized in that The step of evaluating each of the plurality of story texts to obtain an evaluation result of each story text includes: For any story text, using the sixth language model, based on the basic information and the auxiliary information, evaluate at least one story characteristic of the story text at least once, and obtain at least one evaluation score for each of the at least one story characteristic of the story text; An average value of at least one evaluation score of each story characteristic is used as a characteristic evaluation result of each story characteristic, and the evaluation result of the story text includes the characteristic evaluation result of at least one story characteristic of the story text.
7. The method according to claim 6, characterized in that The story characteristics include at least one of the following: the degree of story relevance to the title, the degree of story completeness, the degree of logical rigor, the degree of plot novelty, the degree of plot excitement, the degree of character development, the degree of presentation of character relationships, the degree of presentation of character emotional changes, the degree of fictionalization of character information, and the degree of dialogue description.
8. The method according to claim 6 or 7, characterized in that The step of determining a target story text according to the evaluation result of each story text among the plurality of story texts includes: determining a comprehensive evaluation result of each story text according to a characteristic evaluation result of at least one story characteristic of each story text in the plurality of story texts; A target story text is determined according to the comprehensive evaluation result of each story text in the multiple story texts.
9. The method according to claim 8, characterized in that The step of determining a target story text according to the comprehensive evaluation results of each story text in the plurality of story texts includes: According to the comprehensive evaluation result of each story text in the plurality of story texts, selecting a story text with the highest comprehensive evaluation result from the plurality of story texts; When the degree of fictionality in the story characteristics corresponding to the selected story text indicates that there is fictional character information in the selected story text, the fictional character information in the selected story text is removed based on the character information in the basic information to obtain the target story text; wherein the fictional character information is character information different from the character information in the basic information.
10. A story generating device, characterized in that: include: An acquisition module is used to acquire basic information of the story to be generated, wherein the basic information includes background information and writing requirements, and the background information includes character information and story context; a determination module, which determines auxiliary information based on the basic information, wherein the auxiliary information includes information that affects the development of the story after the preceding story, and the auxiliary information includes at least one of character emotional information, character relationship information, story writing purpose, and plot conclusion, wherein the story writing purpose includes any one of information explanation, plot advancement, value change, and dramatic conflict; A generating module, configured to generate at least one story outline based on the basic information and the auxiliary information, wherein the story outline is used to indicate an outline of the plot developed after the preceding story; a supplementing module, configured to supplement story details for each of the at least one story outlines based on the auxiliary information, to obtain a plurality of story texts corresponding to the at least one story outline, wherein each story outline corresponds to at least one story text, and different story texts corresponding to each story outline have different story details; An evaluation module evaluates each of the plurality of story texts to obtain an evaluation result for each story text, wherein the evaluation result represents the quality of the story text; The target determination module is used to determine a target story text according to the evaluation result of each story text in the multiple story texts.
11. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to implement the method according to any one of claims 1 to 9 when executing the instructions stored in the memory.
12. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Long text generation method and device
CN117743567A
Language model Chinese spelling checking method and system based on retrieval enhancement generation
CN118586384A