Text generation method and device, equipment and storage medium
By generating plot summaries through a self-attention mechanism, and combining generative pre-trained models and reinforcement learning AI technology, the problem of insufficient coherence and creative expressiveness in AI creation is solved, and high-quality text generation is achieved.
Patent Information
- Application Number
- CN202411743620.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-11-30
AI Technical Summary
Existing AI technologies suffer from a lack of coherence, insufficient generalization ability, and limited creative expressiveness in creative writing and novel creation, resulting in poor quality of generated texts.
A text summary generator employing a self-attention mechanism generates plot summary information. It combines a generative pre-trained model with a reinforcement learning plot generator, evaluates text coherence, originality, and appeal through a multi-dimensional evaluator, and utilizes a meta-learning algorithm to improve model adaptability and generation performance.
It improves the quality of AI-generated text, ensures plot coherence and innovation, enhances adaptability to different writing styles and themes, and generates rich and engaging content.
Smart Images

Figure CN119719334B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and more specifically, to a text generation method, apparatus, device, and storage medium. Background Technology
[0002] With the development of technologies such as big data, neural networks, and deep learning, artificial intelligence (AI) has made significant progress in the fields of natural language processing and text generation. From financial and sports news articles to automotive marketing copy, and even literary creation such as poetry and novels, AI technology has been widely applied. However, AI technology still faces some challenges in creative writing and novel creation. For example, novels created using AI technology are of poor quality, lacking coherence or appeal, which negatively impacts the reader experience. Summary of the Invention
[0003] This application aims to provide a text generation method, apparatus, device, and storage medium to improve the quality of AI-generated content. The following solutions are adopted in this application:
[0004] Firstly, embodiments of this application provide a text generation method. This text generation method includes: generating plot summary information based on content creation instructions input by a user; processing the plot summary information using a plot generator to generate detailed plot content corresponding to the plot summary information, and organizing the detailed plot content according to the logic indicated by the plot summary information to obtain target text; evaluating the target text from preset dimensions using a multi-dimensional evaluator, the preset dimensions including at least one of the following: coherence, innovativeness, or attractiveness among the detailed plot content; and outputting the target text if it passes the evaluation.
[0005] In one possible embodiment, the multi-dimensional evaluator includes a text preprocessing module, a feature extraction module, and a dimension scoring module. Accordingly, evaluating the target text from preset dimensions based on the multi-dimensional evaluator includes: preprocessing the target text using the text preprocessing module, the preprocessing including at least one of the following: word segmentation, stop word removal, part-of-speech tagging, and syntactic analysis; extracting at least one feature from the preprocessed target text using the feature extraction module, the at least one feature including at least one of the following: semantic vector features, frequency of occurrence of the same word, logical transition words and their corresponding positions; and evaluating the target text from preset dimensions based on the extracted at least one feature using the dimension scoring module.
[0006] In one possible embodiment, the text generation method provided in this application further includes: constructing a text training set, which includes text fragments of various types and / or styles; and training a plot generator based on the text training set in conjunction with a meta-learning algorithm.
[0007] In one possible embodiment, the plot generator includes a target model. Accordingly, training the plot generator based on a text training set and incorporating a meta-learning algorithm includes: training a basic target model based on the text training set; generating multiple style-specific models corresponding to each style based on sample text fragments of multiple styles; determining the parameter differences between the multiple style-specific models and the basic target model; and updating the basic target model based on the parameter differences.
[0008] In one possible embodiment, the plot generator employs a generative pre-trained model; alternatively, the plot generator employs a reinforcement learning-based model.
[0009] Secondly, embodiments of this application also provide a text generation apparatus, comprising: a plot summary module, configured to generate plot summary information based on content creation instruction information input by a user; a plot generation module, configured to process the plot summary information based on a plot generator, generate detailed plot content corresponding to the plot summary information, and organize the detailed plot content according to the logic indicated by the plot summary information to obtain target text; an evaluation module, configured to evaluate the target text from preset dimensions based on a multi-dimensional evaluator, the preset dimensions including at least one of the following: coherence, innovativeness, or attractiveness among the detailed plot content; and an output module, configured to output the target text if the target text passes the evaluation.
[0010] Thirdly, embodiments of this application also provide an electronic device, including: a processor and a memory communicatively connected to the processor; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method in any possible implementation of the first aspect.
[0011] Fourthly, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method in any possible implementation of the first aspect described above.
[0012] The text generation method, apparatus, device, and storage medium provided in this application first generate plot summary information based on user-input content creation instructions; then, based on a plot generator, the plot summary information is processed to generate detailed plot content corresponding to each plot summary information, and the multiple detailed plot contents are logically organized according to the plot summary information to obtain the target text; subsequently, based on a multi-dimensional evaluator, the target text is evaluated from dimensions such as the coherence or originality of the multiple detailed plot contents. Finally, if the target text passes the evaluation, the target text is output. Thus, the method provided in this application can create text using a plot generator and evaluate the text content created using the plot generator from multiple dimensions, thereby improving the quality of the created text. Attached Figure Description
[0013] Figure 1 This is a schematic diagram illustrating an application scenario of a text generation method according to this application;
[0014] Figure 2 A flowchart of a text generation method provided in this application embodiment;
[0015] Figure 3 This is a schematic diagram of the module structure of a text generation device provided in an embodiment of this application;
[0016] Figure 4 This is a hardware structure diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] In the embodiments of this application, the terms "first" and "second" are used to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, nor do they necessarily imply difference. It should be noted that words such as "exemplary" or "for example" are used to indicate that something is being used as an example, illustration, or description. Any embodiment or design scheme described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner. In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more.
[0018] Currently, AI technology has made significant progress in the fields of natural language processing and text generation. In the field of text creation, some researchers have attempted to apply deep learning techniques to the novel writing process. For example, recurrent neural networks (RNNs) or Transformer models are used to generate continuous text paragraphs, and reinforcement learning is used to optimize the quality of the generated plot. However, the text generated using existing methods is of poor quality, specifically suffering from the following problems: First, a lack of grasp of the overall structure of the novel: existing methods often focus on the generation of local texts, making it difficult to guarantee the coherence and integrity of the entire novel's plot. Second, insufficient generalization ability: these models usually require extensive training on specific types of novels and struggle to quickly adapt to new writing styles or themes. Third, limited creative expressiveness: current solutions often fail to generate truly innovative and unique plots, easily producing stereotypical or repetitive content.
[0019] To address the aforementioned issues, this application provides a text generation method. Figure 1 This is a schematic diagram illustrating an application scenario of a text generation method according to this application. The application scenario includes a terminal 101 and a server 103. The terminal 101 can be any electronic device such as a computer or mobile phone. In some embodiments, the terminal 101 has human-computer interaction capabilities and can interact with the user. The terminal 101 can be an electronic device equipped with input / output modules such as a display screen and a keyboard. The user can input creative instruction information through the terminal 101, such as the theme of the text, plot summary information, etc. In some embodiments, the server 103 can generate text that meets the user's requirements based on the user-input creative instruction information; this text can be, for example, a novel or a script.
[0020] The text generation method provided in this application can be applied to various types of text creation processes that require plot generation, such as novel writing, scriptwriting, and game scriptwriting.
[0021] Figure 2 This is a flowchart illustrating a text generation method provided in an embodiment of this application. Figure 2 As shown, the text generation method is applied to Figure 1 The server shown is 103. The method specifically includes:
[0022] S210. Generate plot summary information based on the content creation instructions input by the user.
[0023] In some embodiments, content creation instructions input by the user, such as the topic or name of the text, can be received. Then, based on a text summary generator employing a self-attention mechanism, the user-input content creation instructions are processed to generate a plot summary. In this application, the text summary generator can be a machine learning model, which can employ a self-attention mechanism, such as a transformer architecture model.
[0024] In some embodiments, the architecture of the text summary generator may include a topic expansion module, a structuring processing module, and a content generation module. The topic or name of the text provided by the user is used as input to the text summary generator. After processing by the topic expansion module, a list of relevant topics is generated. This list is then processed by the structuring processing module to generate a structured outline (also referred to as structured initial summary information in this embodiment). Finally, the structured outline is processed by the content generation module to generate a detailed story summary (i.e., plot summary information). In this way, through the processing of the text summary generator, accurate and logically complete plot summary information can be generated, improving the grasp of the overall structure of the novel and providing an overall framework for subsequent detailed plot generation to ensure the integrity of the text structure.
[0025] Here is a specific example: 1. User inputs the topic: "Space Exploration". 2. After processing by the topic expansion module, a list of related topics is output: 2.1-Aerospace Technology 2.2-Astronauts 2.3-Space Station 2.4-Planetary Exploration 2.5-Extraterrestrial Life. 3. After processing by the structuring module, the list of related topics is transformed into a structured outline: I. Overview of Space Exploration II. Development of Aerospace Technology III. Astronaut Training and Life IV. International Space Station V. Planetary Exploration Missions VI. Search for Extraterrestrial Life. 4. After processing by the content generation module, the structured outline is expanded into a detailed story summary (i.e., the final generated plot summary information):
[0026] 4.1 Overview of Space Exploration 4.1.1 Humanity's Curiosity and Desire to Explore the Universe 4.1.2 Historical Milestones in Space Exploration; 4.2 Development of Space Technology 4.2.1 Evolution of Rocket Technology 4.2.2 Spacecraft Design and Manufacturing 4.2.3 Innovation in Propulsion Systems; 4.3 Astronaut Training and Life 4.3.1 Rigorous Selection Process 4.3.2 Physical and Psychological Training 4.3.3 Daily Life in Space; 4.4 International Space Station 4.4.1 Structure and Functions of the Space Station 4.4.2 Scientific Experiments and Research 4.4.3 The Importance of International Cooperation; 4.5 Planetary Exploration Missions 4.5.1 Mars Rover Missions 4.5.2 Exploration of Jupiter and Saturn's Moons 4.5.3 Future Deep Space Exploration Programs; 4.6 Search for Extraterrestrial Life 4.6.1 Discovery of Exoplanets 4.6.2 Habitable Zone Theory 4.6.3 SETI Project and Other Efforts to Search for Extraterrestrial Intelligence.
[0027] In some embodiments, the content creation instructions input by the user are the plot summary information. In some embodiments, the content creation instructions input by the user are initial plot summary information, which can be extracted and summarized to generate the final plot summary information. For example, some initially set information (e.g., character information, background information, etc.) and key plot information input by the user through the user interface of terminal 101 can be received, and then the information input by the user can be sorted and processed to obtain the final plot summary information. In this application, the plot summary information input by the user is referred to as the first plot summary information, and the plot summary information after processing the first plot summary information is referred to as the second plot summary information. Subsequently, detailed plot content can be generated based on the second plot summary information.
[0028] S220. Based on the plot generator, after processing the plot overview information, generate detailed plot content corresponding to the plot overview information, and organize the detailed plot content according to the logic indicated by the plot overview information to obtain the target text.
[0029] In this embodiment, the plot generator is able to understand the context of long texts and generate coherent content. In some embodiments, a generative pre-trained transformer (GPT) model can be used. For example, the plot generator can be a GPT-based sequence generator. The plot generator can generate detailed plot content based on the plot overview information generated in step S220.
[0030] In some embodiments, the plot generator can employ a reinforcement learning-based model. For example, the novel-writing process can be modeled as a Markov decision process. Deep reinforcement learning algorithms, such as proximal policy optimization or the A3C (asynchronous advantage actor-critic) algorithm, can be used to train the plot generator. In some embodiments, appropriate reward functions, such as reader engagement and plot coherence, can be designed for the plot generator.
[0031] After generating detailed plot content based on a plot generator, multiple detailed plot contents can be integrated into a coherent text using techniques such as text summarization. This method can automatically generate text works with rich content and diverse plots.
[0032] In some embodiments, the plot generator can employ a multi-agent collaborative system. For example, multiple specialized agents (which can also be understood as multiple intelligent modules or intelligent subsystems) can be designed to be responsible for character development, plot progression, environmental description, etc. Furthermore, communication and collaboration mechanisms between agents can be implemented, and joint optimization algorithms can be used to coordinate the behavior of multiple agents, thereby ensuring the consistency of the generated detailed plot content.
[0033] In some embodiments, the plot generator can be based on plot reasoning using a knowledge graph. In some embodiments, the plot generator can construct a large-scale knowledge graph containing character relationships and event causality. For example, the plot generator can utilize graph neural networks for plot reasoning and generation to enhance the plausibility and coherence of the generated detailed plot content. In some embodiments, the plot generator can employ a hybrid generation-retrieval model. For example, the plot generator can combine the advantages of generation and retrieval models. A retrieval model is used to retrieve relevant fragments from existing literary works, and then a generation model is used to rewrite and expand the retrieved content.
[0034] In some embodiments, a plot generator can be deployed in the cloud to support large-scale parallel processing of multiple plot summary information and real-time generation of detailed plot content. For example, for the two plot summary information items mentioned above, "the protagonist obtains a precognitive treasure" and "the treasure's abilities are initially tested," the plot generator can process these two pieces of information in parallel and generate corresponding detailed plot content in real time.
[0035] In some embodiments, the number of plot generators can be one or more. When there are multiple plot generators, they can process plot summary information in parallel to generate detailed plot content corresponding to different plot summary information. In this case, the detailed plot content corresponding to multiple plot summary information needs to be logically synthesized according to the plot summary information to obtain the target text.
[0036] In some embodiments, a text training set can be constructed. This text training set may include text fragments of various types and / or styles. Then, based on this constructed text training set, a plot generator is trained using a meta-learning algorithm.
[0037] In some embodiments, the plot generator can be trained using the following method: First, a diverse plot dataset can be constructed as a text training set. This text training set can include text fragments of different types and styles (e.g., fragments from novels or scripts). In some embodiments, further processing can be performed on the text in the text training set, i.e., the second step described below can be executed. Second, a task generator can be designed to randomly extract text fragments from the text training set and process these fragments before using them as input to the subsequent target model or algorithm.
[0038] In some embodiments, the task generator includes the following five modules: 1. Data preprocessing module: This module can receive randomly selected text as input. Further, it can segment the text into fragments of appropriate length and add basic metadata (such as source) to the fragments. 2. Storage module: This module can store the preprocessed text fragments using a simple database or file system. Additionally, the storage module can maintain a basic index for retrieval. 3. Random sampling module: This module can implement a basic random sampling algorithm. Further, it can allow setting simple sampling conditions (such as quantity, length range). 4. Output formatting module: This module can convert the extracted fragments into a format acceptable to the target model (mentioned later). For example, this module supports basic text cleaning (such as removing special characters). 5. Interface module: This module can provide a simple API or command-line interface. Through this API or command-line interface, the user can initiate the extraction process, whereby the random sampling module randomly selects text fragments, and the data preprocessing module processes the randomly selected text. The storage module can store the preprocessed text fragments. The output formatting module can convert the preprocessed fragments into text fragments in a format acceptable to the target model. On the other hand, the interface module can display the text fragments processed by the output formatting module to the user. These text fragments can then be used as input for the next processing step.
[0039] The third step involves using the text fragments extracted and processed by the task generator to implement a fast adaptation algorithm based on MAML (model-agnostic meta-learning), enabling the target model (which is included in the plot generator) to quickly learn new writing styles on a small number of samples.
[0040] Understandably, as mentioned earlier, the target model can employ GPT. For example, the target model can be a GPT-based sequence generator. Alternatively, the target model can be a reinforcement learning-based model.
[0041] In some embodiments, this step includes the following processes: 1. Pre-training stage: Collect text fragments extracted and processed by the task generator to obtain text datasets with various writing styles; train a basic target model using these datasets. In some embodiments, a small number of samples can be used to learn each writing style separately, resulting in multiple models for different specific styles. Then, the parameter differences between these models for different specific styles and the basic target model can be calculated. Further, the parameters of the basic target model can be optimized so that it can quickly adapt to various styles through a small number of gradient updates. Further, to enhance the performance of the basic target model, the following stage can be added: 2. Rapid adaptation stage: Given a small number of sample texts of a new writing style; use these samples to perform a small number of gradient updates on the pre-trained basic target model; obtain an optimized target model that can adapt to the new style. 3. Generation stage: Use the adapted target model to generate text that conforms to the new style. 4. Continuous learning: Collect user feedback, regularly update the target model with new data, and continuously improve the target model's ability to quickly adapt to new styles. In some embodiments, to further optimize the performance of the target model, reduce the number of repeated texts generated by the target model, and improve the performance of the target model in generating new text, the following steps can be further performed:
[0042] The fourth step is to use a meta-optimizer to train the target model and minimize the generalization error on various tasks.
[0043] The process of training a model with a meta-optimizer may include the following steps: 1. Initialization: Define a meta-optimizer; define a target model; define a task distribution. 2. Outer loop: Sample a batch of tasks from the task distribution. For each task, perform the following steps: Copy the parameters of the target model as the initial parameters; perform inner-loop training (see below); calculate the average meta-loss over all tasks; update the meta-optimizer using the meta-loss. In this embodiment, the task is a text generation task. There can be multiple tasks. For example, for texts of different styles, there is a corresponding task. The task distribution can correspond to a text training set. A task sampled from the task distribution can be understood as a sampled known text. 3. Inner loop: Train the target model using the update rule generated by the meta-optimizer; quickly adapt to the current task in a small number of steps; record the state and gradient information during the training process. 4. Meta-loss calculation: After the inner loop ends, evaluate the model performance on the validation set; use the validation set performance as the meta-loss feedback to the meta-optimizer. 5. Iterative optimization: Repeat the outer loop and the inner loop to continuously optimize the meta-optimizer; the meta-optimizer gradually learns how to better initialize and update the target model. 6. Testing: Test the trained meta-optimizer on new unseen tasks; evaluate whether the generated update rule can enable the target model to quickly adapt to new tasks.
[0044] For example, the target model needs to learn the writing styles and plot development patterns of different types of Chinese novels. For instance, the target model analyzes 1,000 wuxia novels, 1,000 modern urban novels, and 1,000 historical romances. For wuxia novels, the target model learns how to describe elements such as martial arts moves and martial arts grudges. For modern urban novels, the target model masters how to depict workplace competition and urban love. For historical romances, the target model understands how to blend historical facts and fictional plots.
[0045] In this way, by using the meta-learning algorithm, the generalization ability of the model can be improved, enabling the model to quickly adapt to new writing styles or themes. And by minimizing the generalization error on various tasks, the innovation and uniqueness of the generated plots can be increased.
[0046] S230. Based on a multi-dimensional evaluator, evaluate the target text from preset dimensions.
[0047] In some embodiments, the preset dimensions include at least one of the following: coherence, innovation, or attractiveness between detailed plot contents.
[0048] In some embodiments, the multi-dimensional evaluator includes the following four modules: 1. Text preprocessing module. This module performs preliminary processing on the input text. This preliminary processing includes: word segmentation, stop word removal, part-of-speech tagging, and syntactic analysis. 2. Feature extraction module. This module extracts various features from the text preprocessed by the text preprocessing module, including: word frequency statistics, TF-IDF calculation, semantic vector extraction using, for example, BERT or Word2Vec, and extraction of syntactic structure features. These features will be used for subsequent dimensional scoring. 3. Dimension scoring module. This module may include multiple sub-modules. Each sub-module is responsible for evaluating a specific dimension. Taking coherence and originality as examples, the coherence evaluation sub-module can use the semantic similarity between sentences to analyze topic coherence and check the use of logical transition words. For example, it uses pre-trained language models such as BERT to calculate the semantic similarity between adjacent sentences to ensure a smooth semantic transition between sentences. Alternatively, it uses topic models (such as LDA) to extract the topic distribution of the text and analyze whether the changes in topics as the text progresses are natural and reasonable. For example, the frequency and placement of logical transition words such as "therefore," "however," and "but" can be statistically analyzed to determine their appropriateness. Furthermore, the coherence assessment submodule can analyze referential relationships, such as checking the accuracy of the use of personal pronouns and demonstrative pronouns to ensure clear referential relationships. The coherence assessment submodule can also check timeline consistency, such as analyzing time expressions in the text to ensure the logical order of events. Furthermore, causal relationship assessment can be performed, such as using causal reasoning models to analyze the reasonableness of causal relationships between events.
[0049] The innovative evaluation submodule can analyze the use of novel words or expressions by calculating the degree of difference between the text and known corpora, thereby assessing the uniqueness of ideas or viewpoints. Through these techniques and evaluation methods, this application can maintain control over the overall structure during the generation process and comprehensively check the coherence of the text during the evaluation stage, thus solving the problem of the lack of grasp of the overall structure of the novel in existing technologies.
[0050] 4. Comprehensive Evaluation Module. This module summarizes the scores obtained from each dimension through the dimension scoring module. During the summarization process, weights can be set for different dimensions, and then the final score is calculated using these weights, ultimately generating an evaluation report.
[0051] For example, suppose we have the following text: Artificial intelligence is important. It can do many things. But it also has problems. We should use it with caution. The weather is nice today. I like to eat apples. The evaluation results might be as follows: Coherence: 3 / 10 (topic jumps, lack of logical connection). Originality: 2 / 10 (bland content, lack of originality).
[0052] Such multi-dimensional evaluation allows for a comprehensive and objective analysis of text quality, providing a basis for further text optimization.
[0053] S240. If the target text passes the evaluation, output the target text.
[0054] In some embodiments, reading feedback information on the target text can also be obtained; then, based on the reading feedback information, at least one parameter of the text summary generator and / or plot generator can be adjusted to adjust the generated target text. For example, a feedback collector can be constructed to collect readers' evaluations and suggestions on the generated plot. An adaptive adjuster can be developed to dynamically adjust the plot generation strategy and parameters based on the collected feedback. Furthermore, meta-learning techniques can be used to continuously optimize the model's performance on different types of novels.
[0055] For example, readers have commented that "the protagonist's inner struggles are not deep enough." Using the method provided in this application's embodiments, the protagonist's monologue poems can be added to each chapter to express their inner conflicts.
[0056] In some embodiments, copyright protection mechanisms may be integrated to ensure that the generated content does not infringe on the intellectual property rights of existing works.
[0057] The text generation method provided in this application first generates plot summary information based on user-input content creation instructions; then, based on a plot generator, it processes the plot summary information to generate detailed plot content corresponding to each plot summary, and organizes multiple detailed plot contents according to the logic between the plot summary information to obtain the target text; subsequently, based on a multi-dimensional evaluator, the target text is evaluated from dimensions such as the coherence, originality, or attractiveness among the multiple detailed plot contents. Finally, if the target text passes the evaluation, it is output. Thus, the method provided in this application can create text using a plot generator and evaluate the text content created using the plot generator from multiple dimensions, thereby improving the quality of the created text.
[0058] Based on the same inventive concept, embodiments of this application also provide a text generation apparatus. For example... Figure 3 As shown, this is a structural schematic diagram of a text generation device 300, which may include the following modules:
[0059] The plot summary module 310 is used to generate plot summary information based on content creation instructions input by the user. The plot generation module 320, based on a plot generator, processes the plot summary information generated by the plot summary module 310 to generate detailed plot content corresponding to the plot summary information, and then organizes the generated detailed plot content according to the logic indicated by the plot summary information to obtain the target text. The evaluation module 330 is used to evaluate the target text generated by the plot generation module 320 from preset dimensions using a multi-dimensional evaluator. In this embodiment, the preset dimensions include at least one of the following: the coherence, innovativeness, or attractiveness among the detailed plot content. The output module 340 is used to output the target text if the target text passes the evaluation.
[0060] In some embodiments, the text generation apparatus 300 further includes an acquisition module for acquiring reading feedback information for the target text and adjusting at least one parameter of the plot generator based on the acquired reading feedback information.
[0061] In some embodiments, the evaluation module includes a text preprocessing submodule, a feature extraction submodule, and a dimension scoring submodule; the evaluation module is further configured to: preprocess the target text using the text preprocessing submodule, the preprocessing including at least one of the following: word segmentation, stop word removal, part-of-speech tagging, and syntactic analysis; extract at least one feature from the preprocessed target text using the feature extraction submodule, the at least one feature including at least one of the following: semantic vector features, frequency of occurrence of the same word, logical transformation words and their corresponding positions; and evaluate the target text from a preset dimension based on the extracted at least one feature using the dimension scoring submodule.
[0062] In some embodiments, the plot summary module is further configured to generate at least one theme based on content creation instruction information; generate structured initial summary information based on at least one theme; and generate plot summary information based on the structured initial summary information.
[0063] In some embodiments, the text generation apparatus further includes a training module for constructing a text training set, which includes text fragments of various types and / or styles; and for training a plot generator based on the text training set in conjunction with a meta-learning algorithm.
[0064] In some embodiments, the plot generator includes a target model, and the training module is further configured to train a basic target model based on a text training set; generate multiple style-specific models corresponding to each style based on sample text fragments of multiple styles; determine the parameter differences between the multiple style-specific models and the basic target model; and update the basic target model based on the parameter differences.
[0065] In some embodiments, the plot generator employs a generative pre-trained model; or, the plot generator employs a reinforcement learning-based model.
[0066] The text generation apparatus provided in this application can generate plot summary information based on content creation instructions input by a user; after processing the plot summary information, detailed plot content corresponding to each plot summary information is generated; and the multiple detailed plot contents are logically organized according to the plot summary information to obtain the target text; then, the target text is evaluated from dimensions such as the coherence, innovativeness, or attractiveness among the multiple detailed plot contents. Finally, if the target text passes the evaluation, the target text is output. In this way, the method provided in this application can generate text with coherence and completeness, and evaluate the generated text content from multiple dimensions, thereby improving the quality of the created text.
[0067] Figure 4 The electronic device shown also includes a communication interface 403 and a communication bus 404, wherein the processor 401, the memory 402 and the communication interface 403 communicate with each other through the communication bus 404.
[0068] The memory 402 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. The communication bus 404 can be an ISA bus, PCI bus, or EISA bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of representation, only a single bidirectional arrow is used in the diagram, but this does not imply that there is only one bus or one type of communication bus.
[0069] The communication interface 403 is used to connect to at least one user terminal and other network units through the network interface, and to send the encapsulated message to the user terminal through the network interface.
[0070] Processor 401 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 401 or by instructions in software form. Processor 401 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this disclosure can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory 402. Processor 401 reads the information in memory 402 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiment.
[0071] This application also provides a computer storage medium storing computer-executable instructions. When executed by a processor, these instructions are used to implement the text generation method described in any of the preceding embodiments; therefore, they will not be repeated here. Furthermore, the beneficial effects of using the same method will also not be repeated. For technical details not disclosed in the embodiments of the computer storage medium involved in this invention, please refer to the description of the method embodiments of this invention.
[0072] This application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it is used to implement the text generation method described in any of the preceding embodiments. Therefore, it will not be described again here.
[0073] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0074] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A text generation method, characterized in that, The method includes: Generate a plot summary based on the content creation instructions input by the user; Based on the plot generator, after processing the plot overview information, detailed plot content corresponding to the plot overview information is generated, and the detailed plot content is organized according to the logic indicated by the plot overview information to obtain the target text; Based on a multi-dimensional evaluator, the target text is evaluated from preset dimensions, which include at least one of the following: the coherence, originality, or appeal of the detailed plot content; and If the target text passes the evaluation, then the target text is output; The plot generator includes a target model; the training process of the target model includes: Step 1: Define the meta-optimizer, the target model, and the task distribution, wherein the task distribution corresponds to the text training set, and the text training set includes text fragments of various types and / or styles; Step 2: Sample multiple tasks from the task distribution, where the text fragments in the text training set correspond to the tasks; Step 3: For each task, copy the parameters of the target model as initial parameters and perform an inner loop. The inner loop includes: training the target model using the update rules generated by the meta-optimizer, and recording the state and gradient information during the training process. Step 4: Calculate the average meta-loss over all the tasks, which is obtained by evaluating the performance of the target model on the validation set; Step 5: Update the meta-optimizer using the meta-loss; Repeat steps 2 through 5 above to optimize the meta-optimizer; The updated meta-optimizer is tested with a new task to evaluate whether the update rules generated by the meta-optimizer can enable the target model to adapt to the new task.
2. The method according to claim 1, characterized in that, The method further includes: Obtain reading feedback information for the target text; and Based on the reading feedback information, adjust at least one parameter of the plot generator.
3. The method according to claim 1, characterized in that, The multi-dimensional evaluator includes a text preprocessing module, a feature extraction module, and a dimension scoring module; the evaluation of the target text from preset dimensions based on the multi-dimensional evaluator includes: The target text is preprocessed using the text preprocessing module, and the preprocessing includes at least one of the following: word segmentation, stop word removal, part-of-speech tagging, and syntax analysis; The feature extraction module extracts at least one feature from the preprocessed target text, wherein the at least one feature includes at least one of the following: semantic vector features, frequency of occurrence of the same word, logical transformation words and their corresponding positions; and Using the dimension scoring module, the target text is evaluated from the preset dimension based on the extracted at least one feature.
4. The method according to claim 1, characterized in that, The step of generating the plot summary information based on the content creation instructions input by the user includes: Based on the content creation instructions, generate at least one theme; Based on the at least one topic, generate structured initial summary information; and The plot summary information is generated based on the structured initial summary information.
5. The method according to any one of claims 1-4, characterized in that, The plot generator employs a generative pre-trained model; or, the plot generator employs a reinforcement learning-based model.
6. A text generation device, characterized in that, include: The plot summary module is used to generate plot summary information based on the content creation instructions input by the user; The plot generation module is used to process the plot overview information based on the plot generator, generate detailed plot content corresponding to the plot overview information, and organize the detailed plot content according to the logic indicated by the plot overview information to obtain the target text. An evaluation module is used to evaluate the target text from preset dimensions based on a multi-dimensional evaluator. The preset dimensions include at least one of the following: coherence, originality, or attractiveness among the detailed plot content. as well as An output module is configured to output the target text if the target text passes the evaluation. The plot generator includes a target model; the plot generation module is also used to train the target model, and the training process of the target model includes: Step 1: Define the meta-optimizer, the target model, and the task distribution, wherein the task distribution corresponds to the text training set, and the text training set includes text fragments of various types and / or styles; Step 2: Sample multiple tasks from the task distribution, where the text fragments in the text training set correspond to the tasks; Step 3: For each task, copy the parameters of the target model as initial parameters and perform an inner loop. The inner loop includes: training the target model using the update rules generated by the meta-optimizer, and recording the state and gradient information during the training process. Step 4: Calculate the average meta-loss over all the tasks, which is obtained by evaluating the performance of the target model on the validation set; Step 5: Update the meta-optimizer using the meta-loss; Repeat steps 2 through 5 above to optimize the meta-optimizer; The updated meta-optimizer is tested with a new task to evaluate whether the update rules generated by the meta-optimizer can enable the target model to adapt to the new task.
7. An electronic device, comprising: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Text content authenticity evaluation method and device based on writing style
CN116522895A
Long text generation method and device
CN117743567A