Text generation method, device, equipment and storage medium

By adopting a preset algorithm set and conditional control mechanism in the text generation process, rich and natural text content is generated, which solves the problem of poor text quality in the existing technology and realizes high-quality and diversified text generation.

CN119719355BActive Publication Date: 2025-09-05BEIJING BESTV VIDEO CULTURE MEDIA CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411743652.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-30
Publication Date
2025-09-05
Estimated Expiration
2044-11-30

AI Technical Summary

Technical Problem

The text generated by existing text generation technology is of poor quality and has the problem of not having rich and natural plots.

Method used

A preset algorithm set is used to determine the sub-text of the branch node from the original text, and a detailed plot is generated based on the conditional control mechanism and plot embedding mechanism. The semantic representation model, part-of-speech recognition model, attention mechanism, long short-term memory network and other technologies are used in combination with user interaction to generate diversified text content.

Benefits of technology

The quality and diversity of text generation are improved. The generated text has rich and natural plots, can adapt to user needs, and realize the automatic generation of multiple plot content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119719355B_ABST
    Figure CN119719355B_ABST
Patent Text Reader

Abstract

This application provides a text generation method, apparatus, device, and storage medium. In one embodiment, the method comprises: obtaining original text; employing a preset algorithm set to determine subtexts from the original text as branch nodes; determining multiple branch options based on the subtexts; and, for any branch option, generating a detailed plot corresponding to the branch option based on a conditional control mechanism. The method provided in this application can automatically generate plot content for multiple branches, improving the content richness and diversity of the generated text.
Need to check novelty before this filing date? Find Prior Art

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 rapid development of the online entertainment content market, the demand for fast, diverse, and high-quality novels is growing. Furthermore, with the advancement of technologies such as big data, neural networks, and deep learning, artificial intelligence (AI) has made tremendous progress in natural language processing and text generation. However, the quality of text generated using existing text generation technologies is poor, with problems such as insufficiently rich and natural plots. Summary of the Invention

[0003] This application aims to provide a text generation method, apparatus, device, and storage medium to improve the efficiency and diversity of AI creation. This application adopts the following solutions:

[0004] In a first aspect, embodiments of the present application provide a text generation method. The text generation method comprises: obtaining original text; using a preset algorithm set to determine subtexts from the original text as branch nodes; determining multiple branch options based on the subtexts; and, for any branch option, generating a detailed plot corresponding to the branch option based on a conditional control mechanism and a plot embedding mechanism.

[0005] In one possible embodiment, the preset algorithm set includes a semantic representation model and a part-of-speech recognition model. Accordingly, using the preset algorithm set to determine a subtext as a branch node from the original text includes: determining at least one first subtext as a potential branch node from the original text based on the semantic representation model combined with the part-of-speech recognition model; using a sequence labeling algorithm based on an attention mechanism to determine a score corresponding to each first subtext, the score being used to indicate the importance of the corresponding first subtext as a potential branch node; and determining, within the at least one first subtext, a second subtext whose corresponding score meets a preset condition as a subtext serving as a branch node.

[0006] In a possible embodiment, for any branch option, generating a detailed plot corresponding to the branch option based on a conditional control mechanism includes: for the first branch option, controlling the style attributes of the detailed plot corresponding to the first branch option based on the conditional control mechanism.

[0007] In a possible embodiment, the method provided in the embodiment of the present application also includes: determining the correlation between the detailed plot corresponding to each branch option and the overall generated text for each branch option; and based on the correlation, using the detailed plot of the target branch option as the content of the text to be generated.

[0008] In a possible embodiment, based on the degree of association, using the detailed plot of the target branch option as the content of the text to be generated includes: determining the score corresponding to each branch option based on the degree of association between the detailed plot corresponding to each branch option and the overall generated text; and using the detailed plot corresponding to the branch option with the highest score as the content of the text to be generated.

[0009] In a possible embodiment, the method provided by the embodiment of the present application also includes: in the process of generating detailed plot content, based on a model adopting a long short-term memory network LSTM architecture, recording the prior state information of the prior plot content; and based on the prior state information associated with the prior plot content, generating the subsequent plot content, wherein the subsequent plot content includes content associated with the prior state information.

[0010] In some embodiments, the method provided by the embodiments of the present application also includes: analyzing the user's interest level in the current text content based on the user's operations during reading the generated text content and the user's stay time on the current text content; and adjusting the content of the text to be generated according to the said interest level.

[0011] In a second aspect, an embodiment of the present application also provides a text generation device, comprising: an acquisition module for acquiring original text; a first determination module for determining a sub-text as a branch node from the original text using a preset algorithm set; a second determination module for determining a plurality of branch options based on the sub-text; and a generation module for generating, for any branch option, a detailed plot corresponding to the branch option based on a conditional control mechanism.

[0012] 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; and the processor executes the computer-executable instructions stored in the memory to implement the method in any possible implementation of the first aspect.

[0013] 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.

[0014] The text generation method, apparatus, device, and storage medium provided by this application first obtains the original text; then, using a preset algorithm set, determines subtexts from the original text that serve as branch nodes; then, based on the subtexts, determines multiple branch options; and for any branch option, generates the detailed plot corresponding to the branch option based on a conditional control mechanism. Thus, for text with multiple possible branches, the method provided by this application can automatically generate multiple plot contents, improving the content richness and diversity of the generated text. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] Figure 1 A schematic diagram of an application scenario of a text generation method for this application;

[0016] Figure 2 A flow chart of a text generation method provided in an embodiment of the present application;

[0017] Figure 3 A flowchart of another text generation method provided in an embodiment of the present application;

[0018] Figure 4 A schematic diagram of the module structure of a text generation device provided in an embodiment of the present application;

[0019] Figure 5 A hardware structure diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0020] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.

[0021] 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 differences. 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 advantageous than other embodiments or design schemes. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a concrete way. In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more.

[0022] It should be noted that the "at..." in the embodiments of the present application can be the instant when a certain situation occurs, or it can be a period of time after the situation occurs, and the embodiments of the present application do not specifically limit this. In addition, the text generation method provided in the embodiments of the present application is only an example, and the text generation method can also include more or less content.

[0023] AI has made significant progress in natural language processing and text generation. In the field of text creation, some researchers have attempted to apply deep learning techniques to the process of novel creation. However, the quality of text generated using existing methods is poor, and the content of the generated text is relatively monotonous.

[0024] In order to solve the above problems, an embodiment of the present application provides a text generation method, through which high-quality text with rich and natural plots can be generated.

[0025] Figure 1 Schematic diagram of an application scenario of the text generation method provided in this application. The application scenario includes a terminal 101 and a server 102. 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 original text through the terminal 101, such as the text's introduction, background, characters, or story outline. In some embodiments, the server 102 can generate a text containing detailed plot content based on the original text input by the user. The generated text can be, for example, a novel, a screenplay, a game script, etc.

[0026] In some embodiments, the text generation method provided in the embodiments of the present application is applied in an interactive text creation process. That is, the user can participate in the text creation process through terminal 101 and perform some interactive operations. For example, the user can input the outline, theme, or central idea of ​​the text to be generated through terminal 101, so that terminal 101 automatically generates the text based on the theme or central idea input by the user. For another example, during the text generation process, terminal 101 provides the user with some prompts or some options for the user to select, so as to generate subsequent text content based on the user's selection.

[0027] Figure 2 This is a flow chart of a text generation method provided in an embodiment of the present application. Figure 2 As shown in Figure 1 The method is implemented on the server 102 shown. The method specifically includes:

[0028] S210: Obtain original text.

[0029] In some embodiments, the user may input a story outline, theme, central idea, or introductory phrase as the original text. For example, the original text input by the user may be "Xiao Li stood at a fork in the forest. On the left was a dark path, and on the right was a sunny avenue."

[0030] In some embodiments, users can also enter keywords as raw text, and a central idea or theme is generated based on the raw text entered by the user. For example, a user may enter keywords such as "Xiao Li" or "Forest Fork." Based on these keywords, one or more story synopses are generated and provided to the user. The user can then select a story synopsis from which subsequent text content is generated.

[0031] In some embodiments, multiple branch options may be generated during the text creation process, and different branch options may correspond to different storylines. In the embodiment of the present application, the following method can be used to identify branch options to further generate subsequent plots.

[0032] S220: Using a preset algorithm set, determine a subtext as a branch node from the original text.

[0033] In some embodiments, the preset algorithm set includes some specific machine learning models or algorithms.

[0034] In some embodiments, the preset algorithm set includes a semantic recognition model and a part-of-speech recognition model. In this way, based on the semantic recognition model combined with the part-of-speech recognition model, at least one first sub-text that can serve as a potential branch node can be determined from the original text obtained in step S210. For example, the semantic representation model can be a bidirectional encoding conversion BERT model, or other models that can represent semantics; the part-of-speech recognition model includes a conditional random field (CRF) model, an LSTM-based sequence labeling model, etc., and can also be other models that can recognize the part of speech of words or phrases in the text.

[0035] In some embodiments, the original text can first be subjected to word segmentation, stop word removal and other processing operations to convert the processed text into an input format acceptable to the BERT model. The pre-trained BERT model is then used to perform bidirectional encoding on the pre-processed text to obtain a context-related vector representation of each word. That is, the BERT model can be used to vectorize the words in the original text. Furthermore, a part-of-speech recognition model (such as an LSTM-based sequence labeling model) can be used to perform part-of-speech tagging on the text to identify nouns, verbs, and adjectives. Finally, the word vector obtained by BERT encoding can be combined with the part-of-speech tag. For example, a simple splicing or a more complex fusion method can be used. In this way, based on the features after the word vector and the part-of-speech tag are combined, considering the semantic importance, syntactic structure, part of speech, contextual situation and other factors of the word, at least one text that can serve as a potential branch node is identified from the original text. For example, a text containing the semantics of "fork" that may produce branch options can usually be used as a potential branch node.

[0036] Next, a sequence labeling algorithm based on an attention mechanism can be used to determine the score corresponding to each first subtext. The score is used to indicate the importance of the corresponding first subtext as a potential branch node.

[0037] In some embodiments, a pre-trained word embedding model (such as a Word2Vec model, or a transformer model (such as BERT) can be used to encode each sub-text to obtain a vector representation of each sub-text. Then, an attention mechanism can be used to calculate the relevance of each first sub-text to the entire text to obtain an attention weight; finally, an importance score can be assigned to each first sub-text based on the attention weight. For example, a query vector (query vector) can be calculated: the average vector of the entire text or a special [CLS] tag can be used. The similarity score between each sub-text vector and the query vector is calculated. In some embodiments, the score can be further adjusted or standardized according to specific task requirements. The similarity score is normalized using a softmax function to obtain an attention weight. Finally, the attention weight can be used as the importance score of each first sub-text. Further, each first sub-text can be labeled according to the calculated importance score of each first sub-text. Finally, a threshold can be set to mark the second sub-text in the first sub-text whose corresponding score is higher than the threshold as the sub-text of the branch node.

[0038] S230: Determine multiple branch options based on the subtext.

[0039] Still referring to the above example, based on the subtext of "fork in the road", we can get two branch options: "left" and "right".

[0040] S240: For any branch option, generate a detailed plot corresponding to the branch option based on the conditional control mechanism.

[0041] In some embodiments, a machine learning model embedded with a conditional control mechanism and / or a plot embedding mechanism may be used to generate a detailed plot. The machine model may be any model capable of implementing text creation.

[0042] In some embodiments, taking any branch as an example, for the branch (in the embodiments of the present application, the any branch referred to here is referred to as the first branch option), the style attributes of the detailed plot corresponding to the first branch option can be controlled based on a conditional control mechanism. In the embodiments of the present application, the conditional control mechanism refers to setting a specific mechanism, which will be triggered when certain conditions are met. For example, if the text style required by the user is a sad style, in the process of generating text using a machine learning model, if content that is significantly different from the style appears continuously, the corresponding conditional control mechanism is triggered to generate more sad-style content.

[0043] In some embodiments, in order to make the generated text more natural, during the interaction with the user, it is also possible to determine whether to trigger a conditional control mechanism based on the user's operations during the reading of the text and the user's stay time on the current text.

[0044] For example, during the text generation process, users may be presented with multiple options. If the user frequently selects safe options, the conditional control mechanism is triggered, gradually increasing the frequency of dangerous elements. Alternatively, if the user consistently selects a forward branching strategy, the conditional control mechanism may be triggered, automatically increasing the proportion of reverse branching strategies in subsequent options.

[0045] In some embodiments, the user's interest in the current text can also be analyzed based on the user's interactive operations during the text reading process and the user's stay time on the current text; and the content of the text to be generated can be adjusted according to the interest level.

[0046] For example, if the reader stays at a branch point for a longer time, the machine learning model will generate more relevant clues or explanations later.

[0047] In some embodiments, a plot embedding mechanism can also be employed, encoding plot content as vectors. This allows subsequent generation of similar plot content to be compared based on the vector corresponding to the current text content and the vector corresponding to the previously generated plot content. If the similarity is high, the plot embedding mechanism is triggered, and the generated associated plot content can be directly invoked and fine-tuned to suit the current text.

[0048] For example, for the identified branch "Choose the left path," the method provided in step S240 can be used to generate a corresponding plot development: "Xiao Li took a deep breath and chose the left path. As she went deeper, the surrounding trees grew denser, blocking out most of the sunlight. Suddenly, she heard a mysterious sound coming from afar..." Optionally, the method provided in step S240 can be used to generate another branch plot for "Choose the right path."

[0049] like Figure 3 As shown, in some embodiments of the present application, the method provided in the embodiment of the present application further includes the following steps:

[0050] S310 : For each branch option corresponding to a detailed plot, determine the relevance between the detailed plot corresponding to each branch option and the generated text as a whole.

[0051] S320: Based on the correlation, the detailed plot of the target branch option is used as the content of the text to be generated.

[0052] In some embodiments, the score corresponding to each branch option can be determined based on the correlation between the detailed plot corresponding to each branch option and the overall generated text; and the detailed plot corresponding to the target branch option with the highest score is used as the content of the text to be generated.

[0053] For example, for any branch option, a sequence labeling algorithm based on the attention mechanism can be used to determine the score of the detailed plot corresponding to the branch option. This score is used to indicate the importance of the corresponding branch option.

[0054] For example, for any branch option, the generated detailed plot can be split into multiple sub-texts, and then each sub-text can be encoded using a pre-trained word embedding model (such as the Word2Vec model, or a transformer model (such as BERT)) to obtain a vector representation of each sub-text. Then, the attention mechanism can be used to calculate the relevance of each sub-text to the overall text to obtain the attention weight; finally, an importance score can be assigned to each sub-text based on the attention weight. For example, the query vector (query vector): the average vector of the entire text or a special [CLS] marker is used. The similarity score between each sub-text vector and the query vector is calculated. In some embodiments, the score can be further adjusted or standardized according to the specific task requirements. The similarity score is normalized using the softmax function to obtain the attention weight. Finally, the attention weight can be used as the importance score of each branch option. Furthermore, each branch option can be labeled according to the calculated importance score of each branch option. In some embodiments, a threshold can be set to automatically select the branch option with the highest score among multiple branch options as the final branch option, and continue to generate subsequent plot content. In some embodiments, the plot contents corresponding to these branch options can also be displayed to the user separately, and the user can select the final branch option. The user's choice and the importance score of each branch option can be recorded to facilitate the subsequent training of the machine learning model.

[0055] In some embodiments, a plot structure analysis model can be used to determine the impact of each branch option on the complete plot to be generated to determine which branch to select as the final plot content. In one possible embodiment, the plot structure analysis model can be a model based on a graph neural network (GNN).

[0056] For example, consider the following raw text: "Xiao Li stood at a fork in the forest. To his left was a dark path, and to his right was a sunny avenue." Using the method of this embodiment, the text "fork in the road" can be automatically identified as a potential branch node, and two branch options corresponding to "left" and "right" are generated. A GNN is then used to analyze the potential impact of these two branches on the overall plot development and determine whether they should be considered as actual branches.

[0057] In some embodiments, adversarial training methods can also be used to improve the quality of the detailed plot content through a discriminator network. Adversarial training is a generative adversarial network (GAN), which includes a generator network and a discriminator network. The generator network is used to generate detailed plot content, and the discriminator network is used to judge the authenticity and quality of the content. The generator continuously improves based on the feedback from the discriminator. Through this adversarial process, the discriminator becomes increasingly adept at identifying low-quality content, forcing the generator to continuously improve the quality of the generated content. Ultimately, the generator is able to produce high-quality detailed plot content.

[0058] In some embodiments, during the generation of detailed plot content, prior state information of the prior plot content may be recorded based on a model employing a long short-term memory (LSTM) architecture. Subsequent plot content may also be generated based on the prior state information associated with the prior plot content. This ensures that the generated subsequent plot content includes content associated with the prior state information.

[0059] For example, we can record the state changes after Xiao Li chooses the left path, such as the items he carries and the description of the environment. In subsequent generation, the system will take this state information into account to ensure the coherence of the plot. For example, if Xiao Li picks up a flashlight on this path, the system will automatically consider the possibility of using the flashlight in subsequent dark scenes.

[0060] In some embodiments, a "dynamic knowledge graph" is implemented to update and maintain character relationships, plot development, and environmental status in real time.

[0061] In some embodiments, a reinforcement learning algorithm is used to optimize the long-term consistency maintenance strategy to ensure output consistency under the same strategy.

[0062] In some embodiments, deep reinforcement learning methods, particularly policy gradient-based algorithms, can be used to dynamically adjust the difficulty and complexity of the story.

[0063] The text generation method provided in the embodiments of the present application obtains the original text and then determines the subtexts and multiple branch options as branch nodes from the original text, thereby generating a detailed plot. This method can achieve the generation of high-quality text with rich and natural plots in scenarios with branch nodes.

[0064] Based on the same inventive concept, the present application embodiment also provides a text generation device. Figure 4As shown, it is a structural diagram of the text generation device 400, which may include: an acquisition module 401, used to acquire the original text; a first determination module 402, used to use a preset algorithm set to determine the sub-text as a branch node from the original text acquired by the acquisition module 401; a second determination module 403, used to determine multiple branch options based on the sub-text determined by the first determination module 402; and a generation module 404, used to generate a detailed plot corresponding to any branch option based on a conditional control mechanism.

[0065] In some embodiments, the preset algorithm set includes a semantic representation model and a part-of-speech recognition model. The first determination module 402 is further configured to determine at least one first subtext from the original text as a potential branch node based on the semantic representation model in combination with the part-of-speech recognition model; determine a score corresponding to each first subtext using an attention-based sequence labeling algorithm, where the score indicates the importance of the corresponding first subtext as a potential branch node; and determine, within the at least one first subtext, a second subtext whose score satisfies a preset condition as a subtext serving as a branch node.

[0066] In some embodiments, the generation module 404 is further configured to control, for the first branch option, the style attribute of the detailed plot corresponding to the first branch option based on a conditional control mechanism.

[0067] In some embodiments, the text generation device 400 also includes a third determination module, which is used to: determine the correlation between the detailed plot corresponding to each branch option and the generated text as a whole; and based on the correlation, use the detailed plot of the target branch option as the content of the text to be generated.

[0068] In some embodiments, the third determination module is further used to determine the score corresponding to each branch option based on the correlation between the detailed plot corresponding to each branch option and the overall generated text; and to use the detailed plot corresponding to the branch option with the highest score as the content of the text to be generated.

[0069] In some embodiments, generation module 404 is further configured to, in the process of generating detailed plot content, record prior state information of prior plot content based on a model employing a long short-term memory network (LSTM) architecture; and generate subsequent plot content based on the prior state information associated with the prior plot content, wherein the subsequent plot content includes content associated with the prior state information.

[0070] In some embodiments, the text generation device 400 also includes an adjustment module for analyzing the user's interest level in the current text content based on the user's operations during the reading of the generated text content and the user's stay time on the current text content; and adjusting the content of the text to be generated according to the interest level.

[0071] The text generation device provided in the embodiments of the present application obtains original text and then determines subtexts as branch nodes and multiple branch options from the original text to generate detailed plot information. This allows for generating content including multiple different branches in scenarios where branch nodes exist, thereby increasing the content diversity of the generated text.

[0072] Based on the same inventive concept, an embodiment of the present application also provides an electronic device. Figure 5 The electronic device shown further includes a communication interface 503 and a communication bus 504 , wherein the processor 501 , the memory 502 and the communication interface 503 communicate with each other via the communication bus 504 .

[0073] Memory 502 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk drive. Communication bus 504 may be an ISA bus, a PCI bus, or an EISA bus. Buses can be classified as address buses, data buses, and control buses. For ease of illustration, the figure uses only one bidirectional arrow, but this does not mean that there is only one bus or only one type of communication bus.

[0074] The communication interface 503 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.

[0075] Processor 501 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method may be completed by hardware integrated logic circuits or software instructions in processor 501. The above processor 501 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may 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 may implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in conjunction with the embodiments of this disclosure may be directly implemented and executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium well-known in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. The storage medium is located in the memory 502 , and the processor 501 reads the information in the memory 502 and completes the steps of the method of the above embodiment in combination with its hardware.

[0076] The present application also provides a computer storage medium having computer-readable storage medium storing computer-executable instructions. When executed by a processor, the computer-executable instructions are used to implement the text generation method described in any of the above embodiments. Therefore, these instructions will not be described in detail here. In addition, the description of the beneficial effects of using the same method will not be repeated here. For technical details not disclosed in the computer storage medium embodiments involved in the present invention, please refer to the description of the method embodiments of the present invention.

[0077] 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.

[0078] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing related hardware through a computer program. The program can be stored in a computer-readable storage medium, and when executed, the program can include the processes in the above-described method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0079] It should be understood that the present application is not limited to the exact structure 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: include: Get the original text; Using a preset algorithm set to determine a subtext as a branch node from the original text; wherein the preset algorithm set includes a semantic representation model and a part-of-speech recognition model; using the preset algorithm set to determine a subtext as a branch node from the original text includes: determining at least one first subtext as a potential branch node from the original text based on the semantic representation model in combination with the part-of-speech recognition model; using a sequence labeling algorithm based on an attention mechanism to determine a score corresponding to each first subtext, the score being used to indicate the importance of the corresponding first subtext as the potential branch node; and determining a second subtext in the at least one first subtext whose corresponding score meets a preset condition as the subtext serving as the branch node; Based on the subtext, determining a plurality of branch options; For any branch option, based on a conditional control mechanism, a detailed plot corresponding to the branch option is generated; wherein, for a first branch option, the style attributes of the detailed plot corresponding to the first branch option are controlled based on the conditional control mechanism; the style attributes include text style, and the conditional control mechanism is triggered when the text style of the generated detailed plot is inconsistent with a preset text style; in the process of generating the detailed plot, based on a model using a long short-term memory network (LSTM) architecture, prior state information of prior plot content is recorded; based on the prior state information associated with the prior plot content, subsequent plot content is generated, the subsequent plot content including content associated with the prior state information; and a plot embedding mechanism is used to encode the plot content into a vector; based on the vector corresponding to the current text content and the vector corresponding to the generated plot content, the plot similarity is compared; if the similarity is higher than a preset threshold, the plot embedding mechanism is triggered to call the generated plot content; For each branch option, determining the relevance of the detailed plot corresponding to the branch option to the generated text as a whole; and Based on the relevance, the detailed plot of the target branch option is used as the content of the text to be generated.

2. The method according to claim 1, characterized in that The step of using the detailed plot of the target branch option as the content of the text to be generated based on the relevance includes: Determine a score for each branch option based on the relevance of the detailed plot corresponding to each branch option to the generated text as a whole; and The detailed plot corresponding to the target branch option with the highest score is used as the content of the text to be generated.

3. The method according to claim 1, characterized in that The method further comprises: Analyzing the user's interest in the current text content based on the user's actions during reading the generated text content and the user's stay time on the current text content; and The content of the to-be-generated text is adjusted according to the degree of interest.

4. A text generation device, characterized in that: include: Acquisition module, used to obtain original text; A first determination module is configured to use a preset algorithm set to determine a subtext as a branch node from the original text; wherein the preset algorithm set includes a semantic representation model and a part-of-speech recognition model; the first determination module is specifically configured to determine at least one first subtext as a potential branch node from the original text based on the semantic representation model in combination with the part-of-speech recognition model; use an attention-based sequence labeling algorithm to determine a score corresponding to each first subtext, the score being used to indicate the importance of the corresponding first subtext as the potential branch node; and determine, in the at least one first subtext, a second subtext whose corresponding score meets a preset condition as the subtext serving as the branch node; A second determining module is configured to determine a plurality of branch options based on the subtext; and A generation module is configured to generate, for any branch option, a detailed plot corresponding to the branch option based on a conditional control mechanism; the generation module is specifically configured to control, for a first branch option, the style attributes of the detailed plot corresponding to the first branch option based on the conditional control mechanism; the style attributes include text style, and the conditional control mechanism is triggered when the text style of the generated detailed plot is inconsistent with a preset text style; the generation module is further configured to record prior state information of prior plot content based on a model using a long short-term memory network (LSTM) architecture during the generation of the detailed plot; generate subsequent plot content based on the prior state information associated with the prior plot content, the subsequent plot content including content associated with the prior state information; the generation module is further configured to encode the plot content into a vector using a plot embedding mechanism; compare plot similarity based on the vector corresponding to the current text content and the vector corresponding to the generated plot content; if the plot similarity is higher than a preset threshold, the plot embedding mechanism is triggered to call the generated plot content; The generation module is further configured to determine, for each branch option, the degree of correlation between the detailed plot corresponding to the branch option and the generated text as a whole; and based on the degree of correlation, use the detailed plot of the target branch option as the content of the text to be generated.

5. 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 3.

6. 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 3 when executed by a processor.

Citation Information

Patent Citations

  • Generation method and device of interactive multimedia content, electronic equipment and storage medium

    CN117633258A

  • Generation method and device of interactive multimedia content and computer readable storage medium

    CN117633259A