Text generation method and device, electronic equipment and storage medium
By determining and correcting the word count for each paragraph in text generation, and using adjustment models to reduce or supplement content, the problem of inaccurate word count control in the prior art is solved, and more efficient text word count control and text coherence are achieved.
Patent Information
- Application Number
- CN202411086492.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-08
- Publication Date
- 2024-11-26
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the word count control is not accurate when text generation, resulting in excess or insufficient word count of the generated article, affecting the standardization and consistency of the text, especially inconvenient in application scenarios where strict word count control is required.
By receiving text generation instructions, determine the paragraphs of the target text and the target word count of each paragraph, generate the paragraph and correct the actual word count. If it is inconsistent, use the predetermined adjustment model to reduce or supplement the content to make it consistent with the target word count, and output the adjusted text.
It realizes precise control of the word count of text, reduces manual workload, improves the consistency of text and the fineness of word count control, and is suitable for text generation scenarios that require strict word count control.
Smart Images

Figure CN119026591A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of text processing technology, and in particular to a text generation method, device, electronic device and storage medium. Background Art
[0002] Users usually specify the topic and word count of the article through prompt words, but due to the randomness and context dependence of large models when generating text, the generated articles often have more or less words. This uncertainty not only affects the standardization and consistency of the text, but also brings inconvenience to application scenarios that require strict word count control. Summary of the invention
[0003] The present application provides a text generation method to solve the technical problem of low precision in controlling the number of words in a text.
[0004] In a first aspect, the present application provides a text generation method, the method comprising:
[0005] Based on the received text generation instruction, determining at least one paragraph of the target text to be generated and a target number of words for each paragraph;
[0006] generating the at least one paragraph, and determining whether the actual word count of each paragraph is consistent with the target word count;
[0007] If the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model so that the actual word count of the paragraph is consistent with the target word count;
[0008] The target text is output based on the adjusted at least one paragraph.
[0009] In a possible implementation, if the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model includes:
[0010] If the actual word count is greater than the target word count, reducing the content of the paragraph based on the first adjustment model;
[0011] If the actual word count is less than the target word count, the content of the paragraph is supplemented based on a second adjustment model.
[0012] In a possible implementation, reducing the content of the paragraph based on the first adjustment model includes:
[0013] The core content of the paragraph is determined based on the first adjustment model, and redundant content in the paragraph is deleted according to the core content and the target word count.
[0014] In a possible implementation, supplementing the content of the paragraph based on the second adjustment model includes:
[0015] The context content of the paragraph is determined based on the second adjustment model, and the content of the paragraph is supplemented according to the context content and the target word count.
[0016] In a possible implementation, after determining at least one paragraph of the target text to be generated and the target number of words in each paragraph, the method further includes:
[0017] Output the target word count for each of the paragraphs;
[0018] A determination is made based on the received feedback operation whether to update the target word count.
[0019] In a possible implementation, the determining whether to update the target word count based on the received feedback operation includes:
[0020] In response to receiving a confirmation operation, determining not to update the target word count;
[0021] In response to receiving a modification operation, it is determined to update the target word count based on information indicated by the modification operation.
[0022] In a possible implementation, outputting the target text includes:
[0023] Output the target text in a structured format.
[0024] In a second aspect, the present application provides a text generation device, the device comprising:
[0025] A determination unit, configured to determine at least one paragraph of a target text to be generated and a target number of words for each paragraph based on the received text generation instruction;
[0026] A generating unit, configured to generate the at least one paragraph, and determine whether the actual number of words in each paragraph is consistent with the target number of words;
[0027] an adjusting unit, configured to adjust the content of the paragraph based on a predetermined adjustment model if the actual word count is inconsistent with the target word count, so that the actual word count of the paragraph is consistent with the target word count;
[0028] An output unit is used to output the target text based on the adjusted at least one paragraph.
[0029] In a third aspect, the present application provides an electronic device, comprising a processor, a memory, and an executable program stored in the memory and capable of being run by the processor, wherein the processor executes any one of the methods described in the first aspect when running the executable program.
[0030] In a fourth aspect, the present application further provides a computer storage medium storing an executable program; after the executable program is executed by a processor, it can implement any of the methods described in the first aspect above.
[0031] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: the method provided by the embodiment of the present application determines at least one paragraph of the target text to be generated and the target number of words of each paragraph based on the received text generation instruction; generates the at least one paragraph, and determines whether the actual number of words of each paragraph is consistent with the target number of words; if the actual number of words is inconsistent with the target number of words, adjusts the content of the paragraph based on a predetermined adjustment model so that the actual number of words of the paragraph is consistent with the target number of words; outputs the target text based on the adjusted at least one paragraph. In this way, for text generation scenarios that require strict control of the number of words, the number of words in each paragraph can be adjusted and corrected based on automatic segmentation and model-based, so that the text word count control can be completed more accurately and efficiently, reducing manual workload, and using paragraphs as the adjustment granularity can make the word count control more refined and the text coherence higher. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0034] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0035] Figure 1 A flowchart of a text generation method provided in an embodiment of the present application;
[0036] Figure 2 A flowchart of a text generation method provided in an embodiment of the present application;
[0037] Figure 3 A flowchart of a text generation method provided in an embodiment of the present application;
[0038] Figure 4 A schematic diagram of a text generation device provided in an embodiment of the present application;
[0039] Figure 5 A schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0041] The disclosure below provides many different embodiments or examples to implement different structures of the present invention. In order to simplify the disclosure of the present invention, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present invention. In addition, the present invention can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0042] In order to solve the technical problem of low accuracy in text word count control in the prior art, the present application provides a text generation method, which configures a target word count for each paragraph based on automatic segmentation, and corrects and adjusts the word count of each paragraph based on an adjustment model after generating the paragraph content, thereby efficiently and accurately completing strict control of the word count of the text, with finer adjustment granularity and better coherence between text paragraphs.
[0043] Figure 1 A flowchart of a text generation method provided in this embodiment is shown as follows: Figure 1 As shown, the method may include:
[0044] S10: Based on the received text generation instruction, determine at least one paragraph of the target text to be generated and a target number of words for each paragraph.
[0045] In this embodiment, the text generation instruction can be a content instruction or a request instruction input by the user, and the instruction can include the text subject of the target text and the expected total number of words in the text. Here, the target text can be a variety of types of text such as articles, papers, novels, speeches, etc. The user inputs the text generation instruction, and the required target text can be generated through the large model.
[0046] In one embodiment, step S10 may include: determining the text theme and the total number of words of the target text to be generated based on the received text generation instruction; dividing the target text into at least one paragraph based on the text theme, and determining the target number of words for each paragraph based on the total number of words in the text.
[0047] In one embodiment, dividing at least one paragraph of the target text based on the text theme may include: dividing at least one paragraph of the target text based on the text theme and the total number of words in the text. For example, according to the text theme and the total number of words in the text, determine the logical structure of the target text, such as introduction, main body (including multiple sub-theme paragraphs), conclusion, etc. Exemplarily, for the theme "Application of artificial intelligence in medicine", it may be divided into paragraphs such as introduction, medical image analysis, personalized treatment, medical data management, and conclusion.
[0048] In one embodiment, determining the target number of words for each paragraph based on the total number of words in the text may include: determining the target number of words for each paragraph based on the total number of words in the text and the importance and / or content complexity of each paragraph, for example, 150 words for the introduction and conclusion, 200 words for each paragraph in the main body, etc.
[0049] In one embodiment, if the text generation instruction includes or indicates at least one paragraph desired by the user and the target number of words for each paragraph, the paragraph and the number of words indicated in the text generation instruction are determined to be at least one paragraph of the target text to be generated and the target number of words for each of the paragraphs.
[0050] S20: Generate at least one paragraph, and determine whether the actual number of words in each paragraph is consistent with the target number of words.
[0051] In one embodiment, generating at least one paragraph may include generating at least one paragraph based on the text generation instruction and the target number of words for each paragraph. For example, generating at least one paragraph may be based on the text topic and the target number of words for each paragraph.
[0052] In one embodiment, generating at least one paragraph may be generating all paragraphs at the same time, or may be generating all paragraphs one by one in paragraph order. For example, the paragraph order may be determined based on the text theme of the target text.
[0053] In one embodiment, after generating at least one paragraph, the actual number of words in each paragraph may be determined. The actual number of words in each paragraph is compared with its corresponding target number of words to determine whether the target number of words is consistent with the actual number of words.
[0054] In one embodiment, if the text generation instruction indicates not only the total number of words in the text, but also an allowable error range, such as allowing ±50 words, then determining the target number of words for each paragraph may also include determining the target number of words for each paragraph and the error range. Determining whether the actual number of words in each paragraph is consistent with the target number of words may refer to determining whether the actual number of words in each paragraph is equal to the target number of words, or determining whether the actual number of words in each paragraph is within the error range of the target number of words.
[0055] In one embodiment, the error range corresponding to each paragraph may be the same or different, for example, it may be determined according to the target word count and / or paragraph theme corresponding to the paragraph. Here, the paragraph theme may be determined together with at least one paragraph of the target text, for example, the paragraph theme of each paragraph may be determined according to the text theme.
[0056] S30: If the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model so that the actual word count of the paragraph is consistent with the target word count.
[0057] In one embodiment, the actual word count is inconsistent with the target word count, which may mean that the actual word count is not equal to the target word count, and the content of the paragraph is adjusted based on a predetermined adjustment model to adjust the actual word count of the paragraph. For example, the content of the paragraph may be adjusted based on a predetermined adjustment model and the target word count.
[0058] In one embodiment, adjusting the paragraph content based on a predetermined adjustment model and a target word count may include: adjusting the paragraph content based on the predetermined adjustment model and a difference between the target word count and the actual word count.
[0059] In one embodiment, the predetermined adjustment model may include a first adjustment model and a second adjustment model. When the actual word count of a paragraph is greater than the target word count, the paragraph content may be reduced based on the first adjustment model to reduce the actual word count of the paragraph; when the actual word count of a paragraph is less than the target word count, the paragraph content may be supplemented based on the second adjustment model to increase the actual word count of the paragraph.
[0060] Here, the first adjustment model may be a model specifically used for simplification, used to delete redundant parts in a paragraph. For example, for a paragraph that exceeds the target word count, the first adjustment model will automatically delete redundant descriptions and retain the core information. The second adjustment model may be a model specifically used for supplementation, used to add relevant content. For example, for a paragraph that is less than the target word count, the second adjustment model will supplement necessary information based on the context.
[0061] S40: Outputting the target text based on the adjusted at least one paragraph.
[0062] In one embodiment, step S40 may include: combining at least one paragraph into a complete target text. For example, the introduction, each paragraph of the main body and the conclusion may be combined in sequence according to the format of structured output to form a complete text.
[0063] In this way, for text generation scenarios that require strict control of the number of words, the number of words in each paragraph can be adjusted and corrected based on automatic segmentation and the model, which can complete the text word count control more accurately and efficiently and reduce manual workload. The adjustment granularity of paragraphs can make the word count control more refined, the coherence between text paragraphs is higher, and the text will not be unsmooth due to word count correction.
[0064] In some embodiments, if the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model may include:
[0065] If the actual word count is greater than the target word count, reducing the content of the paragraph based on the first adjustment model;
[0066] If the actual word count is less than the target word count, the content of the paragraph is supplemented based on a second adjustment model.
[0067] In one embodiment, reducing the content of the paragraph based on the first adjustment model may include: reducing the content of the paragraph based on the first adjustment model and the target word count. For example, determining the number of words to be reduced based on the target word count, and reducing the content of the paragraph based on the first adjustment model and the number of words to be reduced. Here, the number of words to be reduced may be the difference between the actual number of words and the target number of words.
[0068] In one embodiment, reducing the content of the paragraph based on the first adjustment model may include: determining the core content of the paragraph based on the first adjustment model, and deleting redundant content in the paragraph according to the core content and the target word count.
[0069] In one embodiment, the redundant content in the paragraph is deleted according to the core content and the target word count, including: determining the number of words to be reduced according to the target word count; and deleting the redundant content in the paragraph based on the first adjustment model according to the number of words to be reduced and the core content. Here, the redundant content can be content other than the core content.
[0070] In this way, the model prioritizes deleting redundant content to reduce the number of words in a paragraph, so that when a paragraph exceeds the target number of words, the word count can be adjusted more efficiently without affecting the integrity and coherence of the paragraph content as much as possible.
[0071] In one embodiment, supplementing the content of the paragraph based on the second adjustment model may include: supplementing the content of the paragraph based on the second adjustment model and the target word count. For example, the number of words to be supplemented is determined based on the target word count, and the content of the paragraph is supplemented based on the second adjustment model and the number of words to be supplemented. Here, the number of words to be supplemented may be the difference between the target word count and the actual word count.
[0072] In one embodiment, supplementing the content of the paragraph based on the second adjustment model may include: determining the context content of the paragraph based on the second adjustment model, and supplementing the content of the paragraph according to the context content and the target word count.
[0073] In one embodiment, supplementing the content of the paragraph according to the context content and the target word count includes: determining the number of words required to be supplemented according to the target word count; and supplementing the content of the paragraph based on a second adjustment model according to the number of words required to be supplemented and the context content.
[0074] In one embodiment, supplementing the content of a paragraph may include: supplementing the content at the front part and / or the back part of the paragraph. For example, when the number of words to be supplemented is lower than a supplementation threshold, supplementing the content at the front part and / or the back part of the paragraph.
[0075] In one embodiment, when the number of words to be supplemented is greater than or equal to a supplementation threshold, content is supplemented in the entire paragraph.
[0076] In this way, the model can add relevant content to the paragraph according to the paragraph context, thereby avoiding adding overly irrelevant content while achieving precise control of the number of words, thereby further improving the coherence of the text.
[0077] Figure 2 A flowchart of a text generation method provided in this embodiment is shown as follows: Figure 2 As shown, the method may include:
[0078] S11: Based on the received text generation instruction, determine at least one paragraph of the target text to be generated and a target number of words for each paragraph;
[0079] S21: Output the target number of words for each paragraph;
[0080] S31: Determine whether to update the target word count based on the received feedback operation;
[0081] S41: generating at least one paragraph, and determining whether the actual number of words in each paragraph is consistent with the target number of words;
[0082] S51: If the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model so that the actual word count of the paragraph is consistent with the target word count;
[0083] S61: Outputting a target text based on the adjusted at least one paragraph.
[0084] In this embodiment, the specific implementation methods and related embodiments of steps S11, S41, S51 and S61 can refer to the specific implementation methods and related embodiments of the aforementioned steps S10-S40, which will not be repeated here.
[0085] In one embodiment, outputting the target number of words in each paragraph may be outputting the target number of words in each paragraph through a display interface. For example, the display interface may be a display interface for receiving a text generation instruction.
[0086] In one embodiment, outputting the target number of words for each paragraph may include: outputting the paragraph topic and the target number of words for each paragraph. For example, outputting the paragraph topic and the target number of words for each paragraph via a display interface. The display interface may be a display interface for receiving a text generation instruction.
[0087] In one embodiment, outputting the target number of words in each paragraph may include outputting the target number of words in each paragraph in the form of numbers, bar graphs, pie charts, etc.
[0088] In one embodiment, the feedback operation is an operation performed by the user on the output target word count, for example, it may include a confirmation operation and / or a modification operation. The confirmation operation may be an operation in which the user agrees with the output target word count, such as an operation of clicking a confirmation button, etc. The modification operation may be an operation in which the user modifies the target word count, such as inputting a new target word count or adjusting a bar chart or a pie chart, etc.
[0089] In one embodiment, step S31 may include: in response to receiving a confirmation operation, determining not to update the target word count; in response to receiving a modification operation, determining to update the target word count based on information indicated by the modification operation.
[0090] Here, the information indicating the modification operation may be a new target word count value input by the user, or a new target word count value modified by the user on a bar chart or a pie chart.
[0091] In one embodiment, if it is determined not to update the target word count, the target word count used in steps S41-S61 remains unchanged and is still the target word count determined in step S11. If the target word count is updated based on the information indicated by the modification operation, the target word count used in steps S41-S61 is the updated target word count.
[0092] In this way, after automatic segmentation and division of the word count of each paragraph, whether it meets the user's needs is determined by sending it to the user for confirmation, so that the word count and content can be more accurately controlled within the range expected by the user.
[0093] In some embodiments, outputting the target text includes: outputting the target text in a structured format.
[0094] Here, the structured format may include a lightweight data exchange format, such as JavaScript Object Notation (JSON) format. In the target text output in the structured format, each paragraph can be stored as an independent field, so as to facilitate subsequent separate processing and improve processing efficiency.
[0095] In this way, using structured formats such as JSON to output generated content makes it easier to edit and manage text content, and also helps in further automated processing and applications, such as classification, indexing, and retrieval of content.
[0096] As a possible implementation method, a text generation method is provided, such as Figure 3 As shown, the specific steps include:
[0097] Step 1. Enter the article topic and total word count:
[0098] The user enters the topic of the article and the total number of words they want to reach. This step is mainly an initialization process, providing necessary parameters for subsequent steps.
[0099] Step 2. Paragraph division and word count allocation:
[0100] (1) Paragraph segmentation: The big model automatically divides the paragraphs based on the total number of words and the topic of the article. The big model analyzes the topic and determines the logical structure of the article, such as the introduction, main body (including multiple sub-topic paragraphs), and conclusion. For example, for the topic "Application of artificial intelligence in medicine", the big model may divide it into introduction, medical image analysis, personalized treatment, medical data management, conclusion, etc.
[0101] (2) Word count allocation: The big model allocates the number of words to each paragraph reasonably according to the importance and complexity of the content. For example, the introduction and conclusion are 150 words each, and the main body is 200 words per paragraph. The system provides a preliminary word count allocation plan and confirms or further adjusts it through the user to meet specific needs.
[0102] Step 3. Large model paragraph generation:
[0103] (1) Generation method: The big model generates text content paragraph by paragraph based on the topic and the preset word count requirement of each paragraph. The system takes the topic and the word count limit of each paragraph as input to guide the big model to generate paragraphs that meet the requirements.
[0104] (2) Generation example: For the first introduction, the system input is: "Write an introduction on 'Application of Artificial Intelligence in Healthcare', with a word count of about 150 words."
[0105] Step 4. Structured output format:
[0106] (1) Structured output method: The generated content is output in JSON format. Each paragraph is stored as an independent field to facilitate subsequent processing.
[0107] (2) Example format:
[0108] {
[0109] "Introduction": "The application of artificial intelligence in medicine has made significant progress in recent years..."
[0110] }
[0111] Step 5. Word count check and adjustment:
[0112] (1) Word count checking method: The system checks the actual number of words in each paragraph to determine whether it meets the preset requirements.
[0113] (2) Word count adjustment method: If a paragraph exceeds the predetermined word count, a large model specifically used for simplification is called to delete the redundant parts. For example, for a paragraph exceeding 200 words, the simplification large model will automatically delete the redundant description and retain the core information. If a paragraph is less than the predetermined word count, a large model specifically used for supplementation is called to add relevant content. For example, for a paragraph less than 200 words, the supplementation large model will add necessary information based on the context.
[0114] Step 6. Final article output:
[0115] After the word count of all paragraphs is adjusted, the system combines all paragraphs into a complete article. According to the format of structured output, the introduction, main body paragraphs and conclusion are combined in sequence to form a complete article.
[0116] like Figure 4 As shown, the embodiment of the present application provides a text generation device, which may include:
[0117] A determination unit 110, configured to determine at least one paragraph of a target text to be generated and a target number of words for each paragraph based on the received text generation instruction;
[0118] A generating unit 120, configured to generate the at least one paragraph, and determine whether the actual number of words in each paragraph is consistent with the target number of words;
[0119] An adjusting unit 130, configured to adjust the content of the paragraph based on a predetermined adjustment model so that the actual number of words in the paragraph is consistent with the target number of words if the actual number of words is inconsistent with the target number of words;
[0120] The output unit 140 is configured to output the target text based on the adjusted at least one paragraph.
[0121] In a possible implementation manner, the adjustment unit 130 is specifically configured to:
[0122] If the actual word count is greater than the target word count, reducing the content of the paragraph based on the first adjustment model;
[0123] If the actual word count is less than the target word count, the content of the paragraph is supplemented based on a second adjustment model.
[0124] In a possible implementation manner, the adjustment unit 130 is specifically configured to:
[0125] The core content of the paragraph is determined based on the first adjustment model, and redundant content in the paragraph is deleted according to the core content and the target word count.
[0126] In a possible implementation manner, the adjustment unit 130 is specifically configured to:
[0127] The context content of the paragraph is determined based on the second adjustment model, and the content of the paragraph is supplemented according to the context content and the target word count.
[0128] In a possible implementation, the determining corresponding to 110 is further used for:
[0129] Output the target word count for each of the paragraphs;
[0130] A determination is made based on the received feedback operation whether to update the target word count.
[0131] In a possible implementation, determining the correspondence 110 is specifically used for:
[0132] In response to receiving a confirmation operation, determining not to update the target word count;
[0133] In response to receiving a modification operation, it is determined to update the target word count based on information indicated by the modification operation.
[0134] In a possible implementation, the output unit 140 is specifically configured to:
[0135] Output the target text in a structured format.
[0136] In the embodiment of the present device, the specific implementation methods and embodiments of each unit can refer to the specific implementation methods and embodiments corresponding to the same content mentioned above, and will not be repeated here.
[0137] like Figure 5 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0138] Memory 113, used for storing computer programs;
[0139] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the text generation method provided by any of the aforementioned method embodiments, including: based on the received text generation instruction, determining at least one paragraph of the target text to be generated and the target number of words of each paragraph; generating the at least one paragraph, and determining whether the actual number of words in each paragraph is consistent with the target number of words; if the actual number of words is inconsistent with the target number of words, adjusting the content of the paragraph based on a predetermined adjustment model so that the actual number of words in the paragraph is consistent with the target number of words; and outputting the target text based on the adjusted at least one paragraph.
[0140] In a possible implementation, if the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model includes: if the actual word count is greater than the target word count, reducing the content of the paragraph based on a first adjustment model; if the actual word count is less than the target word count, supplementing the content of the paragraph based on a second adjustment model.
[0141] In a possible implementation, reducing the content of the paragraph based on the first adjustment model includes: determining the core content of the paragraph based on the first adjustment model, and deleting redundant content in the paragraph according to the core content and the target word count.
[0142] In a possible implementation, supplementing the content of the paragraph based on the second adjustment model includes: determining the context content of the paragraph based on the second adjustment model, and supplementing the content of the paragraph according to the context content and the target word count.
[0143] In a possible implementation, after determining at least one paragraph of the target text to be generated and a target number of words for each paragraph, the method further includes: outputting the target number of words for each paragraph; and determining whether to update the target number of words based on a received feedback operation.
[0144] In a possible implementation, determining whether to update the target word count based on the received feedback operation includes: in response to receiving a confirmation operation, determining not to update the target word count; in response to receiving a modification operation, determining to update the target word count based on information indicated by the modification operation.
[0145] In a possible implementation, outputting the target text includes: outputting the target text in a structured format.
[0146] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the text generation method provided in any of the aforementioned method embodiments are implemented.
[0147] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0149] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0150] In the absence of contradiction, each step in a certain implementation mode or example can be implemented as an independent example, and the steps can be arbitrarily combined. For example, a solution after removing some steps in a certain implementation mode or example can also be implemented as an independent example, and the order of the steps in a certain implementation mode or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain implementation mode or example can be arbitrarily combined; in addition, the various implementation modes or examples can be arbitrarily combined. For example, some or all steps of different implementation modes or examples can be arbitrarily combined, and a certain implementation mode or example can be arbitrarily combined with the optional methods or optional examples of other implementation modes or examples.
[0151] The above is only a specific embodiment of the present application, so that those skilled in the art can understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to these embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.
Claims
1. A text generation method, characterized in that: The method comprises: Based on the received text generation instruction, determining at least one paragraph of the target text to be generated and a target number of words for each paragraph; generating the at least one paragraph, and determining whether the actual word count of each paragraph is consistent with the target word count; If the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model so that the actual word count of the paragraph is consistent with the target word count; The target text is output based on the adjusted at least one paragraph.
2. The method according to claim 1, characterized in that If the actual word count is inconsistent with the target word count, adjusting the content of the paragraph based on a predetermined adjustment model includes: If the actual word count is greater than the target word count, reducing the content of the paragraph based on the first adjustment model; If the actual word count is less than the target word count, the content of the paragraph is supplemented based on a second adjustment model.
3. The method according to claim 2, characterized in that The reducing the content of the paragraph based on the first adjustment model comprises: The core content of the paragraph is determined based on the first adjustment model, and redundant content in the paragraph is deleted according to the core content and the target word count.
4. The method according to claim 2, characterized in that: The content of the paragraph is supplemented based on the second adjustment model, including: The context content of the paragraph is determined based on the second adjustment model, and the content of the paragraph is supplemented according to the context content and the target word count.
5. The method according to claim 1, characterized in that After determining at least one paragraph of the target text to be generated and a target number of words for each paragraph, the method further includes: Output the target word count for each of the paragraphs; A determination is made based on the received feedback operation whether to update the target word count.
6. The method according to claim 5, characterized in that The determining whether to update the target word count based on the received feedback operation comprises: In response to receiving a confirmation operation, determining not to update the target word count; In response to receiving a modification operation, it is determined to update the target word count based on information indicated by the modification operation.
7. The method according to claim 1, characterized in that The output target text includes: Output the target text in a structured format.
8. A text generation device, characterized in that: The device comprises: A determination unit, configured to determine at least one paragraph of a target text to be generated and a target number of words for each paragraph based on the received text generation instruction; A generating unit, configured to generate the at least one paragraph, and determine whether the actual number of words in each paragraph is consistent with the target number of words; an adjustment unit, configured to adjust the content of the paragraph based on a predetermined adjustment model if the actual word count is inconsistent with the target word count, so that the actual word count of the paragraph is consistent with the target word count; An output unit is used to output the target text based on the adjusted at least one paragraph.
9. An electronic device comprising a processor, a memory, and an executable program stored in the memory and capable of being run by the processor, wherein: When the processor runs the executable program, the method according to any one of claims 1 to 7 is performed.
10. A computer storage medium storing an executable program; After the executable program is executed by a processor, the method according to any one of claims 1 to 7 can be implemented.
Citation Information
Patent Citations
Auxiliary method and device for text creation and server
CN113033182A
Text generation method and system based on neural network vocabulary extension paragraph
CN113743087A
Document segmentation method, electronic equipment and computer readable storage medium
CN117688926A
Related information display method and electronic device capable of automatically displaying related information
US20160179833A1
Cited By
Document generation method and device and computer equipment
CN121092500A
