Text generation method and device, equipment and storage medium
By generating plot overview information and detailed plot content and performing multi-dimensional evaluation, the problem of plot coherence and insufficient creative expression in AI creation is solved, and the text quality is improved.
Patent Information
- Application Number
- CN202411743620.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-30
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-30
AI Technical Summary
When creating novels, existing AI technology is difficult to ensure plot consistency and completeness, lack of generalization ability, and limited creative expression, resulting in poor quality of generated texts.
A text generation method is adopted to generate plot overview information through the content entered by the user, and a plot generator is used to generate detailed plot content, and to evaluate text quality from dimensions such as coherence, innovation and attractiveness based on a multi-dimensional evaluator.
Improve the text quality of AI creation, ensure the consistency and integrity of the generated text, and enhance creative expression.
Smart Images

Figure CN119719334A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and more specifically, to a text generation method, apparatus, device and storage medium. Background Art
[0002] With the development of technologies such as big data, neural networks, and deep learning, artificial intelligence (AI) has made great progress in the fields of natural language processing and text generation. From financial and sports news articles to automobile marketing soft articles, to literary creations such as poetry and novels, AI technology has been widely used. However, in creative writing and novel creation, AI technology still faces some challenges. For example, novels created using AI technology are of poor quality, lack of coherence or lack of appeal, which affects the reader experience. Summary of the invention
[0003] This application aims to provide a text generation method, device, equipment and storage medium, aiming to improve the quality of AI creation. This application adopts the following scheme:
[0004] In the first aspect, the embodiment of the present application provides a text generation method. The text generation method includes: generating plot summary information according to content creation instruction information input by a user; based on a plot generator, after processing the plot summary information, generating 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 a target text; based on a multi-dimensional evaluator, evaluating the target text from a preset dimension, the preset dimension includes at least one of the following: coherence, innovation or attractiveness between the detailed plot content; if the target text passes the evaluation, outputting the target text.
[0005] In a possible embodiment, the multidimensional evaluator includes a text preprocessing module, a feature extraction module and a dimension scoring module. Accordingly, based on the multidimensional evaluator, evaluating the target text from a preset dimension includes: using the text preprocessing module to preprocess the target text, the preprocessing includes at least one of the following: word segmentation, stop word removal, part of speech tagging and syntax analysis; using the feature extraction module to extract at least one feature from the preprocessed target text, the at least one feature includes at least one of the following: semantic vector features, the frequency of occurrence of the same word, logical conversion words and corresponding positions; and using the dimension scoring module to evaluate the target text from a preset dimension based on the extracted at least one feature.
[0006] In a possible embodiment, the text generation method provided by the present application also 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 combination with a meta-learning algorithm.
[0007] In a possible embodiment, the plot generator includes a target model. Accordingly, training the plot generator based on the text training set in combination with a meta-learning algorithm includes: training a basic target model based on the text training set; generating a plurality of specific style models corresponding to each style based on sample text fragments of multiple styles; determining parameter differences between the plurality of specific style models and the basic target model; and updating the basic target model based on the parameter differences.
[0008] In a possible embodiment, the plot generator adopts a generative pre-training model; or, the plot generator adopts a reinforcement learning-based model.
[0009] In a second aspect, an embodiment of the present application further provides a text generation device, comprising: a plot summary module, for generating plot summary information according to content creation instruction information input by a user; a plot generation module, for generating detailed plot content corresponding to the plot summary information after processing the plot summary information based on a plot generator, and obtaining a target text after organizing the detailed plot content according to the logic indicated by the plot summary information; an evaluation module, for evaluating the target text from preset dimensions based on a multi-dimensional evaluator, the preset dimensions including at least one of the following: coherence, innovation or attractiveness between the detailed plot contents; and an output module, for outputting the target text if the target text passes the evaluation.
[0010] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: 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] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method in any possible implementation of the first aspect mentioned above.
[0012] The text generation method, device, equipment and storage medium provided by the present application first generate plot summary information according to the content creation instruction information input by the user; then based on the plot generator, after processing the plot summary information, generate detailed plot content corresponding to each plot summary information respectively, and obtain the target text after organizing multiple detailed plot contents according to the logic between the plot summary information; then, based on the multi-dimensional evaluator, evaluate the target text from dimensions such as coherence or innovation between multiple detailed plot contents. Finally, if the target text passes the evaluation, the target text is output. In this way, the method provided by the present application can create text using the plot generator, and evaluate the text content created using the plot generator from multiple dimensions, thereby improving the quality of the created text. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 A schematic diagram of an application scenario of a text generation method of this application;
[0014] Figure 2 A flow chart of a text generation method provided in an embodiment of the present application;
[0015] Figure 3 A schematic diagram of the module structure of a text generation device provided in an embodiment of the present application;
[0016] Figure 4 A hardware structure diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0017] In the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit the difference. It should be noted that words such as "exemplary" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" or "for example" in this application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way. In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more.
[0018] At present, AI technology has made great progress in the fields of natural language processing and text generation. In the field of text creation, some researchers have tried to apply deep learning technology to the process of novel creation. For example, a recurrent neural network (RNN) or Transformer model is used to generate continuous text paragraphs, and reinforcement learning is used to optimize the quality of the generated plot. However, the quality of text generated by existing methods is poor. Specifically, there are the following problems: First, there is a lack of grasp of the overall structure of the novel: existing methods often focus on local text generation, and it is difficult to ensure the coherence and integrity of the plot of the entire novel. Second, the generalization ability is insufficient: these models usually require a lot of training on specific types of novels, and it is difficult to quickly adapt to new writing styles or themes. Third, the creative expression is limited: current schemes often find it difficult to generate truly innovative and unique plots, and are prone to stereotyped or repetitive content.
[0019] In order to solve the above problems, an embodiment of the present application provides a text generation method. Figure 1 This is a schematic diagram of an application scenario of a text generation method of the present application. The application scenario includes a terminal 101 and a server 103, wherein the terminal 101 can be any electronic device such as a computer or a mobile phone. In some embodiments, the terminal 101 has a human-computer interaction function and can interact with the user. The terminal 101 can be an electronic device with input and output modules such as a display screen and a keyboard. The user can input creation 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 a text that meets the user's requirements based on the creation instruction information input by the user, and the text can be, for example, a novel, a script, etc.
[0020] The text generation method provided in the embodiment of the present application can be applied to various types of text creation processes with plot generation requirements, such as novel creation, screenplay creation, and game script creation.
[0021] Figure 2 A flow chart of a text generation method provided in an embodiment of the present application. Figure 2 As shown, the text generation method is applied to Figure 1 The server 103 is shown. The method specifically comprises:
[0022] S210. Generate plot summary information based on content creation instruction information input by the user.
[0023] In some embodiments, content creation instruction information input by a user, such as a subject or name of a text, may be received; then, based on a text summary generator that uses a self-attention mechanism, the content creation instruction information input by the user is processed to generate plot summary information. In the present application, the text summary generator may be a machine learning model that may use a self-attention mechanism, such as a model of a transformer architecture.
[0024] In some embodiments, the framework of the text summary generator may include a theme extension module, a structured processing module and a content generation module. The theme or name of the text provided by the user is used as the input of the text summary generator, and after being processed by the theme extension module of the text summary generator, a list of related topics is generated; the list of related topics is processed by the structured processing module to generate a structured outline (which may also be referred to as structured initial summary information in this embodiment); 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, the grasp of the overall structure of the novel is improved, and an overall framework is provided for subsequent detailed plot generation to ensure the integrity of the text structure.
[0025] The following is a specific example: 1. The user inputs the topic: "space exploration". 2. After being processed by the topic expansion module, a list of related topics is output: 2.1-Space technology 2.2-Astronauts 2.3-Space station 2.4-Planetary exploration 2.5-Extraterrestrial life. 3. After being processed by the structured processing module, the list of related topics is converted into a structured outline: I. Overview of space exploration II. Development of space technology III. Astronaut training and life IV. International space station V. Planetary exploration mission VI. Search for extraterrestrial life. 4. After being processed by the content generation module, the structured outline is expanded into a detailed story summary (that is, the plot overview information finally generated):
[0026] 4.1 Overview of space exploration 4.1.1- Human curiosity and desire to explore the universe 4.1.2- Historical milestones of 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 of propulsion system; 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 function of the space station 4.4.2- Scientific experiments and research 4.4.3- Importance of international cooperation; 4.5 Planetary exploration missions 4.5.1- Mars rover mission 4.5.2- Exploration of Jupiter and Saturn's satellites 4.5.3- Future deep space exploration plans; 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 instruction information input by the user is the plot summary information. In some embodiments, the content creation instruction information input by the user is the initial plot summary information, and the initial plot summary information can be extracted and summarized to generate the final plot summary information. For example, some initial set information (for example, character information, background information, etc.) and key plot information input by the user through the user interaction interface of terminal 101 can be received, and then the information input by the user is sorted out 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 the first plot summary information is processed 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 summary information, 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 the target text.
[0029] In an embodiment of the present application, the plot generator can understand the context of the long text 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 sequence generator based on GPT. 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 adopt a model based on reinforcement learning. For example, the novel creation process can be modeled as a Markov decision process. A deep reinforcement learning algorithm, such as proximal policy optimization or A3C (asynchronous advantage actor critic) algorithm, is used to train the plot generator. In some embodiments, an appropriate reward function can be designed for the plot generator, such as reader engagement, plot coherence, etc.
[0031] After generating detailed plot content based on the plot generator, multiple detailed plot contents can be integrated into a coherent text through 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 may adopt a multi-agent collaborative system. For example, multiple specialized agents (which can also be understood as multiple intelligent modules or intelligent subsystems) may be designed to be responsible for character creation, plot development, environmental description, etc. Furthermore, a communication and collaboration mechanism between agents may be implemented, and a joint optimization algorithm may be used to coordinate the behaviors 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 of the knowledge graph. In some embodiments, the plot generator can build a large-scale knowledge graph containing character relationships and event causality. For example, the plot generator can use a graph neural network to perform plot reasoning and generation to enhance the rationality and coherence of the generated detailed plot content. In some embodiments, the plot generator can adopt a hybrid generation-retrieval model. For example, the plot generator can combine the advantages of the generation model and the retrieval model. Use the retrieval model to obtain relevant fragments from existing literary works, and then use the generation model 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 plot details. For example, for the two plot summary information "the protagonist obtains the foreseeable treasure" and "preliminary test of the treasure's ability" mentioned above, the plot generator can process the two pieces of information in parallel and generate corresponding detailed plot content in real time.
[0035] In some embodiments, the number of plot generators may be one or more. In the case where the number of plot generators is multiple, multiple plot generators may process the plot summary information in parallel to generate detailed plot contents corresponding to different plot summary information. In this case, the detailed plot contents corresponding to the multiple plot summary information need to be synthesized according to the logic of the plot summary information to obtain the target text.
[0036] In some embodiments, a text training set may be constructed. The constructed text training set may include text segments of various types and / or styles. Based on the constructed text training set, the plot generator is trained in combination with a meta-learning algorithm.
[0037] In some embodiments, the following method can be used to train the plot generator: In the first step, a diversified plot data set can be constructed as a text training set. The text training set can include text fragments of different types and styles (for example, fragments of novels, fragments of scripts). In some embodiments, further processing can be performed based on the text in the text training set, that is, the following second step is performed. In the second step, a task generator can be designed to randomly extract text fragments from the text training set, and the processed text fragments are used as inputs for subsequent target models or algorithms.
[0038] In some embodiments, the task generator includes the following five modules: 1. Data preprocessing module: This module can receive randomly extracted text as input. Further, the text can be segmented into segments of appropriate length and basic metadata (such as source) can be added to the segments. 2. Storage module: This module can use a simple database or file system to store preprocessed text segments. In addition, the storage module can maintain basic indexes for retrieval. 3. Random extraction module: This module can implement a basic random extraction algorithm. Further, it can allow simple extraction conditions (such as quantity, length range) to be set. 4. Output formatting module: This module can convert the extracted segments 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 the API or command line interface, on the one hand, the user can start the extraction process, so that the random extraction module will randomly extract text segments, and the data preprocessing module will process the randomly extracted text. The storage module can store the preprocessed text segments. The output formatting module can convert the preprocessed fragment into a format that can be accepted by the target model. On the other hand, the interface module can display the text fragment processed by the output formatting module to the user. The text fragment can be used as input for the next step of processing.
[0039] In the third step, based on the text fragments extracted and processed by the task generator, a fast adaptation algorithm based on MAML (model-agnostic meta-Learning) can be implemented, so that the target model (the plot generator includes this target model) can quickly learn a new writing style based on a small number of samples.
[0040] It is understandable that, as mentioned above, the target model can adopt GPT. For example, the target model can be a sequence generator based on GPT. The target model can also adopt a model based on reinforcement learning.
[0041] In some embodiments, this step includes the following processes: 1. Pre-training stage: collect text fragments extracted and processed based on the task generator to obtain text data sets of multiple different writing styles; use these data sets to train a basic target model. In some embodiments, a small number of samples can be learned for each writing style to obtain 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, in order to enhance the performance of the basic target model, the following stages can be added: 2. Rapid adaptation stage: a small number of sample texts of a new writing style are given; a small number of gradient updates are performed on the pre-trained basic target model using these samples; an optimized target model that can adapt to the new style is obtained. 3. Generation stage: use the adapted target model to generate text that conforms to the new style. 4. Continuous learning: collect user feedback, regularly use new data to update the target model, and continuously improve the target model's ability to quickly adapt to new styles. In some embodiments, in order to further optimize the performance of the target model, reduce the target model from generating repeated texts, and improve the performance of the target model in generating new texts. The following steps can be further performed:
[0042] In the fourth step, a meta-optimizer can be used to train the target model to 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 initial parameters; perform inner loop training (see below); calculate the average meta-loss on all tasks; and update the meta-optimizer using the meta-loss. In this embodiment, the task is a text generation task. There may be multiple tasks, for example, one task for each text of different styles. The task distribution may correspond to a text training set, and the tasks sampled from the task distribution may be understood as sampled known texts. 3. Inner loop: train the target model using the update rules generated by the meta-optimizer; quickly adapt to the current task in a small number of steps; and 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; and feed back the validation set performance to the meta-optimizer as the meta-loss. 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 update rules it generates 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 example, the target model analyzed 1,000 martial arts novels, 1,000 modern urban novels, and 1,000 historical novels. For martial arts novels, the target model learned how to describe elements such as martial arts moves and grudges. For modern urban novels, the target model mastered how to portray workplace competition and urban love. For historical novels, the target model understood how to integrate historical facts and fictional plots.
[0045] In this way, using the meta-learning algorithm, the generalization ability of the model can be improved, so that the model can quickly adapt to new writing styles or topics. And by minimizing the generalization error on various tasks, the innovation and uniqueness of the generated plots can be increased.
[0046] S230: Evaluate the target text from preset dimensions based on a multi-dimensional evaluator.
[0047] In some embodiments, the preset dimension includes at least one of the following: coherence, innovation or attractiveness between detailed plot contents.
[0048] In some embodiments, the multidimensional evaluator includes the following four modules: 1. Text preprocessing module. This module is used to perform preliminary processing on the input text. The preliminary processing here includes: word segmentation, removal of stop words, part-of-speech tagging, and syntactic analysis. 2. Feature extraction module. This module is used to extract various features from the text preprocessed by the text preprocessing module, including: word frequency statistics, TF-IDF calculation, extraction of semantic vectors using, for example, BERT or Word2Vec, and extraction of syntactic structure features. These features will be used for subsequent dimension scoring. 3. Dimension scoring module. This module may include multiple submodules. Each submodule is responsible for evaluating a specific dimension. Taking coherence and innovation as an example, the coherence evaluation submodule can use the semantic similarity between sentences to analyze the topic coherence and check the use of logical conversion words. For example, a pre-trained language model such as BERT is used to calculate the semantic similarity between adjacent sentences to ensure a smooth transition of semantics between sentences. For another example, a topic model (such as LDA) is used to extract the topic distribution of the text to analyze whether the changes in the topic as the text progresses are natural and reasonable. For example, the frequency and position of logical conversion words such as "therefore", "however" and "but" can be counted and analyzed to see whether they are appropriate. Furthermore, the coherence assessment submodule can also analyze the reference relationship, such as checking whether the use of personal pronouns, demonstrative pronouns, etc. is accurate to ensure that the reference relationship is clear. The coherence assessment submodule can also check the consistency of the timeline, such as analyzing the time expression in the text to ensure that the order of events is reasonable. Furthermore, causal relationship evaluation can also be performed, such as using a causal reasoning model to analyze whether the causal relationship between events is reasonable.
[0049] The innovation evaluation submodule can analyze the use of novel words or expressions by calculating the difference between the text and the known corpus, and then evaluate the uniqueness of ideas or opinions. Through these technologies and evaluation methods, the application can maintain control of 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 the prior art.
[0050] 4. Comprehensive evaluation module. This module is used to summarize the scores of each dimension obtained through the dimension scoring module. In the process of summarizing, the weights corresponding to different dimensions can be set respectively, and then the weights are applied to calculate the final score, and finally generate an evaluation report.
[0051] For example, suppose there is the following text: Artificial intelligence is important. It can do many things. But there are also problems. We should use it with caution. The weather is good today. I like to eat apples. The evaluation results may be as follows: Coherence: 3 / 10 (topic jumps, lack of logical connection). Innovation: 2 / 10 (content is bland, lack of novelty).
[0052] Through such multi-dimensional evaluation, the quality of the text can be analyzed comprehensively and objectively, providing a basis for further text optimization.
[0053] S240: If the target text passes the evaluation, the target text is output.
[0054] In some embodiments, reading feedback information for 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 the 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 is developed to dynamically adjust the plot generation strategy and parameters based on the collected feedback. Furthermore, meta-learning technology can be used to continuously optimize the performance of the model on different types of novels.
[0055] For example, readers gave feedback that "the protagonist's inner struggle is not deep enough". Using the method provided in the embodiment of the present application, the protagonist's monologue can be added to each chapter to express his inner conflict.
[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 by the present application first generates plot summary information according to the content creation instruction information input by the user; then, based on the plot generator, after processing the plot summary information, detailed plot contents corresponding to each plot summary information are generated, and multiple detailed plot contents are logically organized according to the plot summary information to obtain the target text; then, based on the multi-dimensional evaluator, the target text is evaluated from dimensions such as coherence, innovation or attractiveness between multiple detailed plot contents. Finally, if the target text passes the evaluation, the target text is output. In this way, the method provided by the present application can create text using the 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, the present application embodiment also provides a text generation device. Figure 3 As shown, it is a schematic diagram of the structure of the text generation device 300, which may include the following modules:
[0059] The plot summary module 310 is used to generate plot summary information according to the content creation instruction information input by the user. The plot generation module 320 is used to generate detailed plot content corresponding to the plot summary information after processing the plot summary information generated by the plot summary module 310 based on the plot generator, and obtain the target text after organizing the generated detailed plot content according to the logic indicated by the plot summary information. The evaluation module 330 is used to evaluate the target text generated by the plot generation module 320 from preset dimensions based on a multi-dimensional evaluator. In the embodiment of the present application, the preset dimension includes at least one of the following: coherence, innovation or attractiveness between the detailed plot contents. 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 device 300 further includes an acquisition module, which is used to acquire reading feedback information for the target text; and adjust at least one parameter of the plot generator according to 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 also used to: use the text preprocessing submodule to preprocess the target text, the preprocessing includes at least one of the following: word segmentation, stop word removal, part of speech marking and syntax analysis; use the feature extraction submodule to extract at least one feature from the preprocessed target text, the at least one feature includes at least one of the following: semantic vector features, frequency of occurrence of the same word, logical conversion words and corresponding positions; and use the dimension scoring submodule to evaluate the target text from a preset dimension based on the extracted at least one feature.
[0062] In some embodiments, the plot summary module is further used to generate at least one theme according to the content creation instruction information; generate structured initial summary information according to the at least one theme; and generate plot summary information according to the structured initial summary information.
[0063] In some embodiments, the text generation device also includes a training module for constructing a text training set, which includes text fragments of various types and / or styles; and training the plot generator based on the text training set in combination with a meta-learning algorithm.
[0064] In some embodiments, the plot generator includes a target model, and the training module is further used to train a basic target model based on a text training set; generate multiple specific style models corresponding to each style based on sample text fragments of multiple styles; determine the parameter differences between the multiple specific style models and the basic target model; and update the basic target model based on the parameter differences.
[0065] In some embodiments, the plot generator adopts a generative pre-trained model; alternatively, the plot generator adopts a reinforcement learning-based model.
[0066] The text generation device provided by the present application can generate plot summary information according to the content creation instruction information input by the user; after processing the plot summary information, detailed plot contents corresponding to each plot summary information are generated, and 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, innovation or attractiveness between the multiple detailed plot contents. Finally, if the target text passes the evaluation, the target text is output. In this way, the method provided by the present application can generate a 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 further 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 via the communication bus 404 .
[0068] The memory 402 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication bus 404 may be an ISA bus, a PCI bus, or an EISA bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one bidirectional arrow is used in the figure, but it does not mean 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 a network interface, and send the encapsulated message to the user terminal through the network interface.
[0070] The processor 401 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 401. The above 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 gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 402 , and the processor 401 reads the information in the memory 402 and completes the steps of the method of the above embodiment in combination with its hardware.
[0071] The present application embodiment also provides a computer storage medium, in which a computer-readable storage medium stores computer-executable instructions, which are used to implement the text generation method described in any of the above embodiments when executed by a processor, and therefore, will not be described in detail here. In addition, the description of the beneficial effects of the same method will not be described in detail. For technical details not disclosed in the computer storage medium embodiment of the present invention, please refer to the description of the method embodiment of the present invention.
[0072] An embodiment of the present 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 above embodiments. Therefore, it will not be described in detail here.
[0073] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0074] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A text generation method, characterized in that: The method comprises: Generate plot summary information based on content creation instruction information input by the user; Based on the plot generator, after processing the plot summary information, generate detailed plot content corresponding to the plot summary information, and obtain the target text after organizing the detailed plot content according to the logic indicated by the plot summary information; Based on a multi-dimensional evaluator, the target text is evaluated from a preset dimension, wherein the preset dimension includes at least one of the following: coherence, innovation or attractiveness of the detailed plot content; and If the target text passes the evaluation, the target text is output.
2. The method according to claim 1, characterized in that The method further comprises: Obtaining reading feedback information for the target text; and At least one parameter of the plot generator is adjusted according to the reading feedback information.
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 multi-dimensional evaluator is used to evaluate the target text from the preset dimensions, including: Preprocessing the target text using the text preprocessing module, wherein the preprocessing includes at least one of the following: word segmentation, stop word removal, part of speech marking, and syntax analysis; Extracting at least one feature from the preprocessed target text using the feature extraction module, wherein the at least one feature includes at least one of the following: a semantic vector feature, a frequency of occurrence of a same word, a logical conversion word and a corresponding position; and The dimension scoring module is used to evaluate the target text 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 according to the content creation instruction information input by the user includes: Generate at least one theme according to the content creation instruction information; generating structured initial summary information according to the at least one topic; and The plot summary information is generated according to the structured initial summary information.
5. The method according to claim 1, characterized in that The method further comprises: Constructing a text training set, wherein the text training set includes text segments of various types and / or styles; and Based on the text training set, the plot generator is trained in combination with a meta-learning algorithm.
6. The method according to claim 5, characterized in that The plot generator includes a target model, and the training of the plot generator based on the text training set and in combination with a meta-learning algorithm includes: Based on the text training set, training to obtain the basic target model; Based on sample text fragments of multiple styles, generate multiple specific style models corresponding to each style respectively; Determining parameter differences between the multiple specific style models and the basic target model; and Based on the parameter difference, the underlying target model is updated.
7. The method according to any one of claims 1 to 6, characterized in that: The plot generator adopts a generative pre-trained model; or, the plot generator adopts a model based on reinforcement learning.
8. A text generation device, characterized in that: include: A plot summary module, used to generate plot summary information according to content creation instruction information input by a user; A plot generation module, configured to generate detailed plot content corresponding to the plot summary information after processing the plot summary information based on a plot generator, and obtain a target text after organizing the detailed plot content according to the logic indicated by the plot summary information; An evaluation module, for evaluating the target text from a preset dimension based on a multi-dimensional evaluator, wherein the preset dimension includes at least one of the following: coherence, innovation or attractiveness of the detailed plot content; as well as The output module is used to output the target text if the target text passes the evaluation.
9. An electronic device, comprising: 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 according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Text content authenticity evaluation method and device based on writing style
CN116522895A
Long text generation method and device
CN117743567A
Scenario generation method and device based on affair graph, equipment and storage medium
CN117993493A
Video copywriting generation method and device and electronic equipment
CN119003721A
Cited By
RAG-based memory enhanced script generation agent system
CN120337981A
A memory-enhanced script generation agent system based on RAG
CN120337981B