Document generation method and apparatus, and computer device
Patent Information
- Application Number
- CN202511498100.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2045-10-20
AI Technical Summary
但这两类技术均有明显缺点:模板填充灵活性差,难以适配个性化需求,且需人工设计大量模板,成本高;大语言模型训练数据存在噪声,对用户的文档生成需求理解不足
[0008]By generating text in multiple rounds according to the outline, and by combining the target round with the previous paragraphs and image datasets, the paragraphs generated in each round can maintain historical context, avoiding the problem of "forgetting earlier content" in extremely long documents. For example, when generating a chapter of a technical report, subsequent rounds can refer to the framework of the first round to refine the content, ensuring that each paragraph in the same section revolves around the outline theme, greatly reducing thematic deviation, making the document logically coherent and consistent, and ensuring that the content closely adheres to the task requirements, thus improving the document's relevance.
Smart Images

Figure CN121092500B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence technology, and includes, but is not limited to, a document generation method, apparatus, and computer equipment. Background Technology
[0002] There are two main types of existing document generation technologies: one is template-filling, which fills in user-inputted keywords and other data into fixed positions based on a preset framework; the other is large language model-driven, which generates content autonomously by understanding textual needs, and some models combine retrieval enhancement techniques to supplement information. However, both of these technologies have significant drawbacks: template filling lacks flexibility, making it difficult to adapt to personalized needs, and requires the manual design of a large number of templates, resulting in high costs; large language model training data contains noise, leading to insufficient understanding of users' document generation requirements. Both technologies can result in unreliable generated documents that are difficult to match actual task requirements. Summary of the Invention
[0003] In view of this, the document generation method, apparatus, and computer device provided in this application embodiment understand document generation requirements through image and text datasets, improving the reliability of document generation and making the generated content more closely aligned with the target task. The document generation method, apparatus, and computer device provided in this application embodiment are implemented as follows: This application provides a document generation method, the method comprising: Obtain the generation requirement information of the document to be generated, wherein the generation requirement information includes the task information of the target task; The generation requirement information is input into the document generation model, and at least one key text is extracted from the task information through the document generation model, and at least one reference image corresponding to the at least one key text is generated; The at least one reference image is matched with the at least one key text to generate an image-text dataset, which includes multiple image-text data, each of which includes one or more key texts and a corresponding reference image; According to each part of the outline of the document to be generated, generate a document for each part based on the image and text dataset, and output the document to be generated.
[0004] In the above embodiments, by acquiring the document generation requirement information, the user's target task can be accurately located, ensuring that subsequent operations revolve around the core requirements input by the user and preventing the generated content from deviating from the intended direction. The requirement information is input into the document generation model, which extracts key text and generates reference images. Based on the model's powerful analysis and generation capabilities, key information is quickly extracted, and the combination of text and images provides mutual corroboration, reducing false information, improving content credibility, and preventing logical contradictions. Finally, each part of the document is generated according to the outline and the text and image dataset, ensuring a standardized document structure, clear hierarchy, and compliance with various document format requirements. This effectively improves the reliability of document generation, making the generated document highly relevant to the user's task requirements.
[0005] In some embodiments, the method further includes: The consistency score is obtained by calculating the consistency between the at least one reference image and the task information using the document generation model. The step of matching the at least one reference image with the at least one key text to generate an image-text dataset includes: If the consistency score is greater than a preset threshold, the at least one reference image is matched with the at least one key text to generate the image and text dataset.
[0006] By calculating the consistency between reference images and task information using a document generation model and setting a threshold for filtering, images with low relevance can be filtered out, ensuring that all images participating in the matching are closely related to the core task. The mechanism of only pre-setting thresholds ensures that only highly consistent images are matched with key text to generate the dataset, avoiding irrelevant or contradictory image-text combinations. This guarantees logical consistency between the text and images from the source, improving the reliability of the document content and its relevance to the task.
[0007] In some embodiments, generating a document for each part of the outline of the document to be generated, based on the image and text dataset, includes: According to each part of the outline, a multi-round text generation process is performed based on the image and text dataset to obtain a document for each part; wherein, the multi-round text generation process includes: In the first round of text generation in the multiple rounds, the paragraph corresponding to the first round is generated based on the image and text dataset; During the text generation process for the target round, a paragraph corresponding to the target round is generated based on at least one paragraph corresponding to at least one round preceding the target round and the image and text dataset. The target round is any round other than the first round among multiple rounds.
[0008] By generating text in multiple rounds according to the outline, and by combining the target round with the previous paragraphs and image datasets, the paragraphs generated in each round can maintain historical context, avoiding the problem of "forgetting earlier content" in extremely long documents. For example, when generating a chapter of a technical report, subsequent rounds can refer to the framework of the first round to refine the content, ensuring that each paragraph in the same section revolves around the outline theme, greatly reducing thematic deviation, making the document logically coherent and consistent, and ensuring that the content closely adheres to the task requirements, thus improving the document's relevance.
[0009] In some embodiments, the step of generating a paragraph corresponding to the target round during the text generation process for the target round, based on at least one paragraph corresponding to at least one round prior to the target round and the image-text dataset, includes: If the number of words in at least one paragraph exceeds a first preset number of words, the first preset number of words is extracted from the at least one paragraph in the order of generation of the at least one paragraph from back to front as the first input text to obtain the first input content, the first input content including the first input text and the image and text dataset; Based on the remaining text in the at least one paragraph excluding the first input text, a second input content is determined, the second input content including at least one second input text obtained based on the remaining text; Based on the first input content and the second input content, generate the paragraph corresponding to the target round.
[0010] When a paragraph exceeds the word limit, the first input is a pre-defined section of text extracted from the end to the beginning. This preserves the most recent context and ensures coherence between the new paragraph and the preceding details. The second input, derived from the remaining text, carries the overall theme and prevents the generated content from deviating from the core logic. This dual-input mechanism balances local coherence with global consistency, effectively addressing common issues like contextual disconnect and theme drift in extremely long texts, and significantly improving the coherence and accuracy of the generated content.
[0011] In some embodiments, the at least one second input text includes a plurality of second input texts; and determining the second input content based on the remaining text in the at least one paragraph excluding the first input text includes: Based on the remaining text, determine the plurality of second input texts; According to the generation order of multiple second input texts from back to front, multiple weights corresponding to the multiple second input texts are determined. Each second input text corresponds to one weight, and the weight corresponding to the second input text generated later in the generation order is higher. Based on the plurality of second input texts and the corresponding plurality of weights, the second input content is determined. The second input content includes a plurality of sub-input content corresponding to the plurality of second input texts, and each sub-input content includes a second input text and a corresponding weight.
[0012] This method first splits the remaining text into multiple second input texts to ensure no historical content is omitted. Then, it assigns different weights from the last to the first text in the order of generation, allowing more recent text to have a greater impact on the generation of the target paragraph. This avoids interference from earlier text with the current expression while ensuring overall thematic coherence through weight transfer. This differentiated weight design allows the model to closely inherit details of recent content while anchoring the global core logic when generating the target paragraph, effectively reducing logical breaks and thematic deviations in long documents and improving content consistency and reliability.
[0013] In some embodiments, determining the plurality of second input texts based on the remaining text includes: If the number of characters in the remaining text is greater than or equal to the second preset number of characters, the ratio of the number of characters in the remaining text to the second preset number of characters is determined as the number of segments; The remaining text is divided into the plurality of second input texts according to the number of segments.
[0014] When the remaining text reaches the target word count, the number of segments is calculated based on the second preset word count, and then the text is evenly divided according to this number. This avoids both excessively long individual segments that burden the model's understanding and overly fragmented information caused by excessive segmentation. This scientific segmentation method ensures that each second input text can fully carry some historical information. When generating the target paragraph later using weights, it can more accurately convey the global logic, further reducing logical gaps in the generation of long documents and improving content coherence and accuracy.
[0015] In some embodiments, after generating the paragraph corresponding to the target round based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset, the method further includes: If the document to be generated meets the authenticity detection conditions, determine the confidence level of the paragraph corresponding to the target round; If the confidence level is greater than or equal to the confidence level threshold, and the target round is any round other than the last round among the multiple rounds, then the text generation process for the next round of the target round is performed.
[0016] This method first performs an authenticity check on the document. Once the document meets the required standard, it assesses the confidence level of the target paragraph. Only when the confidence level meets the standard and it is not the last round will the document proceed to the next round. This mechanism can promptly intercept low-confidence content, such as logical contradictions and distorted information paragraphs, to avoid the accumulation of errors. At the same time, dynamic verification ensures the quality of each generation round, guaranteeing the reliability and accuracy of the final document from a process perspective and reducing the cost of invalid generation.
[0017] In some embodiments, after generating the paragraph corresponding to the target round based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset, the method further includes: Verify the logical consistency between the at least one paragraph and the paragraph corresponding to the target round; If the logical consistency requirement is met, and the target round is any round other than the last round among the multiple rounds, then the text generation process for the next round of the target round is performed.
[0018] This method, after generating the target round paragraph, first verifies its logical coherence with historical paragraphs to ensure there are no contradictions, such as consistency between previous timeline descriptions and the current progress plan. The next round of generation is only initiated when the logic is sound and it is not the final round. This mechanism can promptly intercept logically broken content, preventing errors from accumulating over rounds, ensuring each round of generation is based on a coherent logical foundation. This significantly improves the overall logical rigor of long documents, reduces document unreliability issues caused by logical contradictions, and guarantees that the content aligns with task requirements.
[0019] This application provides a document generation apparatus, the apparatus comprising: The requirement information acquisition module is used to acquire the generation requirement information of the document to be generated, wherein the generation requirement information includes the task information of the target task; The image and text information generation module is used to input the generation requirement information into the document generation model, extract at least one key text from the task information through the document generation model, and generate at least one reference image corresponding to the at least one key text. The image and text dataset construction module is used to match the at least one reference image with the at least one key text to generate an image and text dataset. The image and text dataset includes multiple image and text data, and each image and text data includes one or more key texts and corresponding reference images. The document output module is used to generate a document for each part of the outline of the document to be generated based on the image and text dataset, and output the document to be generated.
[0020] This application provides a computer device, including a memory and a processor. The memory stores a computer program that can run on the processor, and the processor executes the program to implement the method of this application. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 This is a flowchart illustrating the document generation method provided in the embodiments of this application; Figure 2 This is a schematic diagram illustrating the process of constructing the image and text dataset provided in the embodiments of this application; Figure 3 This is a flowchart illustrating another document generation method provided in the embodiments of this application; Figure 4 This is a schematic diagram of the process for generating target round segments provided in the embodiments of this application; Figure 5 This is a schematic diagram of the process for determining the second input content provided in the embodiments of this application; Figure 6 This is a schematic diagram of the process for determining multiple second input texts provided in the embodiments of this application; Figure 7 This is a schematic diagram of the document confidence verification process provided in the embodiments of this application; Figure 8 This is a schematic diagram of the document generation logic consistency verification process provided in the embodiments of this application; Figure 9 This is a structural block diagram of the document generation device provided in the embodiments of this application; Figure 10 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the specific technical solutions of this application will be further described in detail below with reference to the accompanying drawings of the embodiments of this application. The following embodiments are used to illustrate this application, but are not intended to limit the scope of this application.
[0024] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0025] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0026] It should be noted that the terms "first, second, third" used in the embodiments of this application are used to distinguish similar or different objects and do not represent a specific order of objects. It can be understood that "first, second, third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0027] Document generation technology has been deeply integrated into fields such as digital office and enterprise business automation. Typical application scenarios can be summarized into two categories: one is compliance document generation scenarios, such as financial institutions routinely creating loan contracts and administrative departments drafting approval forms. These scenarios have strict requirements for document format standardization and clause completeness, and must strictly follow industry regulatory standards. Format errors may lead to compliance risks. The other is personalized document generation scenarios, such as consulting firms customizing project solutions for clients and educational institutions creating learning reports for students. These scenarios need to be combined with specific requirements to ensure that the documents meet actual needs.
[0028] Current mainstream document generation technologies fall into two categories: One is template-filling, centered on a "pre-defined framework + data injection." This involves manually creating a fixed template with placeholders, collecting data through form input and system integration, and then automatically matching and filling in the generated document. While fast and with a uniform format, it relies on a fixed framework, requiring template redesign for personalized needs, resulting in high maintenance costs. The other is large language model-driven, encompassing basic generation and retrieval enhancement. The former generates content and optimizes formatting based on semantic understanding of user needs, while the latter adds an external knowledge retrieval step to supplement the latest information. While template-free and flexible, it is affected by noise in pre-trained data and struggles to accurately capture task details in user needs, easily generating disjointed content. Both technologies have limitations, leading to insufficient reliability of generated documents and difficulty meeting practical usage requirements.
[0029] Therefore, improving the reliability of document generation and accurately understanding the real needs of users in document generation tasks is an urgent problem to be solved.
[0030] In view of this, embodiments of this application provide a document generation method and apparatus, which obtains generation requirement information of the document to be generated, including task information of the target task; inputs the generation requirement information into a document generation model, extracts at least one key text from the task information through the document generation model, and generates at least one reference image corresponding to the at least one key text; matches the at least one reference image with the at least one key text to generate a text-image dataset, the text-image dataset including multiple text-image data, each text-image data including one or more key texts and corresponding reference images; generates a document for each part of the outline of the document to be generated based on the text-image dataset, and outputs the document to be generated. Embodiments of this application understand document generation requirements through text-image datasets, improve the reliability of document generation, and make the generated content more closely aligned with the target task.
[0031] To make the objectives and technical solutions of this application clearer and more intuitive, a document generation method and apparatus provided by the embodiments of this application will be described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit this application.
[0032] The method in this embodiment is executed by an electronic device. It should be noted that the aforementioned electronic device may include, but is not limited to, mobile phones, wearable devices (such as smartwatches, smart bracelets, smart glasses, etc.), tablet computers, laptops, in-vehicle terminals, and PCs (Personal Computers). The functions implemented by this method can be achieved by the processor in the electronic device calling program code. Of course, the program code can be stored in a computer storage medium. Therefore, the electronic device includes at least a processor and a storage medium.
[0033] Please refer to Figure 1 This is a flowchart illustrating the document generation method provided in the embodiments of this application, such as... Figure 1 As shown, the method may include the following steps S110 to S140: S110: Obtain the generation requirement information of the document to be generated, which includes the task information of the target task.
[0034] The requirement information is a collection of core requirements, goals, and constraints related to the document to be generated. It clarifies the direction of document generation, avoids deviating from the core task, and can also constrain the specifications, define the requirements for content, format, etc., to ensure that the document meets the user's expectations in both content and form.
[0035] The task information of the target task is a core component of generating requirements information. It is a clear description of the specific business that the document needs to serve or the core purpose to be achieved. The task information of the target task focuses on the "substantive content that the document needs to carry." For example, when generating a project implementation plan, it includes the project name, duration, core functional modules, etc. It is used to determine "what to write" in the document.
[0036] In some embodiments, the generation requirement information includes not only the content information of the target task but also the requirement information of the target task. The requirement information of the target task focuses on the "constraints of the document generation process," such as font format, output format (e.g., docx, PPT), data citation specifications, etc. It is used to determine "how to write" the document. Together, the two constitute the complete generation requirement information, providing a comprehensive basis for the electronic device to subsequently generate documents that meet expectations.
[0037] In some embodiments, electronic devices can obtain demand information through user-initiated interactive input: relying on a preset interactive interface, they can receive content directly provided by the user. For example, in office software or document generation platforms, users can fill in a structured form containing "document type, project name, and project duration", input natural language commands containing requirements such as "regional sales data and competitor comparison", upload an Excel / Word draft containing a document framework, or verbally state the requirements of a recruitment brochure. The electronic device can then extract key information after converting the speech to text. In other embodiments, electronic devices can automatically collect data by connecting to external business systems: through API interfaces, database connections, etc., they can retrieve basic data and requirements constraints from related business systems. For example, when generating monthly attendance reports, they can connect to the HR management system to obtain employee clock-in, leave, and overtime data, and at the same time read preset Excel formats, statistics by department, and submission time nodes, without the need for manual input.
[0038] S120: Input the generated requirement information into the document generation model, extract at least one key text from the task information through the document generation model, and generate at least one reference image corresponding to at least one key text.
[0039] It's important to note that at least one key text corresponds to at least one reference image, and one reference image can correspond to one or more key texts. In other words, it's not required that each key text must be matched with a separate reference image; rather, the overall relevance between the reference image set and the key text set is crucial. The core function of reference images is to reinforce key information and reduce the loss of key information during document generation. Therefore, a strict "one-to-one" matching is unnecessary. As long as the combination of the reference image set and the key text set allows the document generation model to infer the user's true generation intent through their mutual assistance, the requirements are met. For example, if the target task's content includes information such as "tender control price of 9.8 million yuan" and "construction period of 120 days," then key texts such as "9.8 million yuan" and "120 days" can be extracted. The system does not need to generate a separate image for each key text. Even generating only one reference image integrating "9.8 million yuan" and "120 days" can effectively complement the key text, without affecting the accuracy and clarity of the document's transmission of key parameters.
[0040] In some embodiments, the document generation model can be fine-tuned by a pre-trained language model (such as BERT, GPT series), or adapted and optimized by a multimodal pre-trained model (such as CLIP, FLAVA); in addition, it can also be obtained by distillation optimization of a lightweight model (such as DistilBERT, T5-small), which reduces the model parameter scale and inference time while retaining the core generation capabilities, and adapts to deployment scenarios with limited computing power.
[0041] In some embodiments, key text extraction can employ natural language processing techniques, such as named entity recognition (NER). This technique works by learning the part-of-speech features and contextual relationships of entities in the text through a model, thereby quickly distinguishing between ordinary expressions and key entities. Alternatively, knowledge graph association matching can be used. First, a domain knowledge graph is constructed, and then the text in the graph dataset is matched with the graph nodes to accurately locate the text fragments associated with the core nodes. Another approach is rule-based template extraction, which uses pre-defined regular expressions or keyword templates for fixed-format information to directly filter text content that matches the template, adapting to scenarios with relatively standardized information formats.
[0042] In some embodiments, the reference image can be standardized, such as by resizing, cropping, or normalizing, so that the standardized reference image is adopted. S130: Match at least one reference image with at least one key text to generate an image-text dataset. The image-text dataset includes multiple image-text data, and each image-text data includes one or more key texts and a corresponding reference image.
[0043] In some embodiments, firstly, for at least one reference image and at least one key text output by the document generation model, semantic association analysis is used to match the text “bid control price 9.8 million yuan” with the corresponding reference image, while performing logical consistency verification to ensure that the reference image that best fits the core meaning of the key text is matched. Then, the key text and the corresponding reference image are encapsulated into independent image and text data. After integrating multiple image and text data, an image and text dataset containing complete image and text relationships is formed.
[0044] It should be noted that the reference image can be in various formats, such as JPEG, PNG, BMP, SVG, EPS, etc. There are no specific restrictions here; the actual requirements should be considered when setting the format.
[0045] It should be noted that reference images can be text-based images containing only key text, bar charts, or images of real objects / scenes, etc. There are no specific restrictions here; the settings should be based on actual needs.
[0046] S140: Generate a document for each part of the outline of the document to be generated based on the image and text dataset, and output the document to be generated.
[0047] In some embodiments, the outline can call a preset template based on the document type (such as report, contract) in the generated requirements information, or be automatically split by parsing the task information of the target task through the model, or be generated by the user manually uploading a customized framework. In some embodiments, when generating each part of the document, the outline part is first matched with the associated units in the image and text dataset. Then, the content is organized by combining the theme logic of that part, with key text as the core and reference images as the auxiliary, through a text generation model to ensure that each part is closely related to the theme and that the images and text are well-matched. In some embodiments, the output process first integrates the various documents, verifies the consistency of format and logic, and then exports them as needed in editable formats (such as docx, markdown), non-modifiable formats (such as PDF), or directly pushes them to a specified platform (such as email, cloud documents). In some scenarios, it also supports generating online preview links.
[0048] Therefore, the method in this application embodiment obtains the generation requirement information by combining text and images, ensuring that the core requirements of the document to be generated are not omitted, improving the relevance of the content, and effectively avoiding information deviation and formatting errors.
[0049] Among them, constructing a text and image dataset can structurally associate scattered key texts with reference images, ensuring semantic consistency between the two, providing clear and reliable material support for the subsequent generation of documents for each part according to the outline, and avoiding content disconnect.
[0050] Please refer to Figure 2 , Figure 2This is a schematic diagram illustrating the process of constructing the image and text dataset provided in the embodiments of this application, such as... Figure 2 As shown, the method may include the following steps S210 to S230: S210: Calculate the consistency between at least one reference image and the task information using the document generation model to obtain a consistency score.
[0051] It should be understood that consistency between at least one reference image and task information refers to the overall consistency between at least one reference image and task information.
[0052] In some embodiments, after generating a reference image set, the model returns image-related information and judges its relevance to the original task information. The focus is on whether the overall image set can be integrated with the task information, allowing the algorithm to infer the user's true intent. Even if some key texts do not match corresponding images, as long as the overall image set helps anchor the core task and reduces the loss of key information, it meets the evaluation logic. When the consistency score is higher than a preset indicator (e.g., 90%), the image set is deemed acceptable and can proceed to the subsequent image-text matching stage; if it is unacceptable, the entire image set is regenerated without adjusting individual images. S220: If the consistency score is greater than the preset threshold, match at least one reference image with at least one key text to generate an image-text dataset.
[0053] In some embodiments, the consistency score needs to be set in conjunction with the technical field and application scenario. For example, in fields with high accuracy requirements such as medical care and bidding, the threshold is set at a higher level (e.g., 85%-95%) to avoid information bias; in education and daily office scenarios, the threshold can be appropriately lowered (e.g., 75%-85%) to balance efficiency. The differences in standards across different fields stem from core demands, such as the need to ensure data rigor in the medical field and the need to balance speed and quality in office work.
[0054] Figure 2 The method described above generates a text and image dataset by calculating the consistency between reference images and task information and accurately matching them. This lays a solid foundation for document creation and makes data associations across different fields more adaptable to needs. Based on this, documents can be generated in multiple rounds according to an outline, allowing for more refined content construction.
[0055] In the steps described above, which generate a document for each part of the outline of the document to be generated based on the image and text dataset, in some embodiments, a multi-round text generation process is performed based on the image and text dataset for each part of the outline to obtain a document for each part.
[0056] The multi-round text generation process includes a first round and other rounds. The input for the first round can be a text and image dataset, while the input for each round in other rounds includes not only the text and image dataset but also the paragraphs output from the previous round.
[0057] Please refer to Figure 3 This is a flowchart illustrating another document generation method provided in this application embodiment, such as... Figure 3 As shown, the method may include the following steps S310 to S320: S310: In the first round of text generation in a multi-round process, generate the corresponding paragraph for the first round based on the image and text dataset.
[0058] In some embodiments, the outline content corresponding to the content to be generated in the first round is first determined, and then the graphic and text data are input into the document generation model based on the outline content. The model integrates the semantics of the graphic and text based on the outline framework to generate paragraph 1 corresponding to the first round. This paragraph will serve as the basis for the content expansion in subsequent rounds.
[0059] S320: During the text generation process of the target round, generate the paragraph corresponding to the target round based on at least one paragraph and the image and text dataset corresponding to at least one round before the target round. The target round is any round other than the first round among multiple rounds.
[0060] It should be understood that "at least one round corresponds to at least one paragraph" means that at least one round before the target round corresponds to at least one paragraph, and one round corresponds to one paragraph. In other words, the generation process of one round will generate a corresponding paragraph.
[0061] It should also be understood that generating the paragraph corresponding to the target round based on at least one paragraph and a text-image dataset means that in the target round, at least one paragraph and a text-image dataset corresponding to at least one round before the target round are used as input for the target round, and the paragraph corresponding to the target round is obtained based on the at least one paragraph and the text-image dataset.
[0062] In some embodiments, based on the outline content corresponding to each round, the first round inputs the image and text dataset to generate paragraph 1; the second round inputs paragraph 1 and the image and text dataset to generate paragraph 2; the third round inputs paragraph 1, paragraph 2, and the image and text dataset to generate paragraph 3; and so on to generate each paragraph, and each paragraph is combined in the order of generation to form a complete document.
[0063] Figure 3 The document generation method adapts to requirements by using an outline, builds a content framework based on the image and text dataset in the first round, and refines it by combining the previous text and dataset in subsequent rounds, thereby improving efficiency and content quality. However, multi-round generation requires accurate input support, so it is necessary to process the text generation input content to adapt it to the generation logic and provide reliable materials for each round.
[0064] Please refer to Figure 4 This is a schematic diagram of the process for generating the target round segment provided in the embodiments of this application, such as... Figure 4As shown, the method may include the following steps S410 to 430: S410: If the number of words in at least one paragraph exceeds the first preset number of words, extract the first preset number of words from the at least one paragraph in the generation order of the at least one paragraph from back to front as the first input text to obtain the first input content, the first input content including the first input text and the image and text dataset.
[0065] It should be understood that if the word count of at least one paragraph exceeds the first preset word count, it means that the total word count of all currently generated content exceeds the first preset word count. It should also be understood that "exceeds" means greater than or equal to.
[0066] In this embodiment, the total word count of at least one paragraph is determined to see if it exceeds a first preset word count. If it does, a first preset word count is extracted from the at least one paragraph in the order it was generated from the last paragraph to the first preset word count, which is then used as the first input text. This first input content includes the first input text and the image-text dataset. For example, when the total word count of the at least one generated paragraph exceeds the first preset word count, text is extracted in the order it was generated from the last paragraph to the first preset word count, prioritizing text that is closer to the current generation round and has a higher relevance to the target paragraph. This preset word count is then used as the "first input text." This text is then integrated with the previously constructed image-text dataset to form the "first input content."
[0067] For example, if the first preset word count is 1000 words, and paragraph 1 (800 words) + paragraph 2 (500 words) have been generated, the total word count exceeds the preset threshold of 1000 words. Then, 1000 words (including all 500 words of paragraph 2 + the last 300 words of paragraph 1) are extracted from the end to the beginning as the first input text. Combined with the image and text dataset, this provides recent core content support for the generation of the target paragraph.
[0068] S420: Determine second input content based on the remaining text in at least one paragraph other than the first input text, the second input content including at least one second input text obtained based on the remaining text.
[0069] In this step, at least one second input text can be determined based on the remaining text, thereby obtaining the second input content.
[0070] In some embodiments, at least one second input text may include a second input text, in which case the second input content may include the second input text.
[0071] In other embodiments, at least one second input text may include multiple second input texts. In this case, the second input content may include multiple second input texts. For example, it may also include weights corresponding to multiple second input texts, which will be described in detail later.
[0072] S430: Generate the paragraph corresponding to the target round based on the first input content and the second input content.
[0073] In this step, the first and second input contents are used as inputs, and a document generation model is used to generate the paragraphs corresponding to the target round.
[0074] In some embodiments, the first input content ensures continuity with recent content, while the second input content supplements earlier information, balancing document coherence and completeness. For example, when generating a "product summary," the recent test data from the first input and the early design concepts from the second input are combined to generate logically coherent paragraphs.
[0075] Figure 4 The method uses closely related text combined with image-text datasets as the core input to avoid excessive input and reduced efficiency. The remaining text is processed as needed, and any excess text is split and weighted to retain key information. By fusing the two types of input to generate paragraphs, the method ensures logical coherence with the preceding text while supplementing previous information, thus solving the problems of input overload and insufficient consistency in long documents and improving the quality of the generated content.
[0076] To further improve the accuracy and model adaptability of converting the remaining text into the second input content, this application also provides a special processing scheme for the second input text.
[0077] Please refer to Figure 5 This is a schematic diagram of the process for determining the second input content provided in the embodiments of this application, such as... Figure 5 As shown, the method may include the following steps S510 to S530: S510: Determine multiple second input texts based on the remaining text.
[0078] In this embodiment, the number of second input texts determined based on the remaining text is multiple.
[0079] It should be understood that the prerequisite for splitting into the second input text is that the number of characters in the generated content exceeds the first preset number of characters.
[0080] S520: Determine multiple weights corresponding to the multiple second input texts according to the generation order from back to front. Each second input text corresponds to one weight, and the weight corresponding to the second input text generated later in the generation order is higher.
[0081] In some embodiments, when the remaining text is split into multiple second input texts, each second input text will have a different weight. The paragraph generated later will be assigned a higher weight, and the paragraph will contribute more to the generation of the next paragraph. Meanwhile, the sum of the weight values of all second input texts is 1.
[0082] It should be noted that the weights can be set manually, for example, as a fractional value. Based on the total number of segments n (where n is a positive integer) of the second input text that has been generated, the denominator is calculated using the formula (1+n)×n÷2, which is the sum of an arithmetic series from 1 to n (e.g., the denominator is 3 when n=2, and 6 when n=3). The numerator is then assigned values of n, n-1, ..., 1 according to the generation time from most recent to furthest, forming a gradient where "the later the generation, the higher the weight" (e.g., when n=2, the weight of the recent segment is 2 / 3 and the weight of the furthest segment is 1 / 3; when n=3, the weight of the recent segment is 3 / 6, the weight of the middle segment is 2 / 6, and the weight of the furthest segment is 1 / 6), ensuring that the sum of the weights of all segments is always 1.
[0083] It should be noted that weighting can also be done through subjective experience-based assignment, directly assigning fixed weights to different objects based on past experience or business needs (e.g., assigning 0.6 to A if it is considered highly important, and 0.4 to B if it is considered less important); weighting can also be done through the Analytic Hierarchy Process (AHP), which breaks down complex decision problems into multiple levels, determines the relative importance of each factor through pairwise comparisons, and then calculates the weights; weighting can also be done through entropy weighting, which determines weights based on the dispersion (entropy value) of the data itself. The higher the dispersion (the more information content), the greater the corresponding weight; this is an objective weighting method. No specific restrictions are imposed here, and weights can be set according to the actual situation.
[0084] S530: Determine the second input content based on multiple second input texts and their corresponding weights. The second input content includes multiple sub-input contents corresponding to the multiple second input texts. Each sub-input content includes a second input text and its corresponding weight.
[0085] Based on the multiple weighted second input texts obtained from splitting the remaining text in S510 and S520, further integration is used to form standardized input content. Specifically, these texts are bound to weights one by one, forming multiple sub-input contents. Each sub-input contains two core elements: "a second input text" and "the weight corresponding to that text." All sub-input contents together constitute the final determined second input content, providing structured input material for paragraph generation in subsequent rounds. For example, if the target round is the fourth round, there can be three sub-input contents. The first sub-input could be: {Text: the remaining text part1 after truncation, after extracting keywords and refining the content, weight: 1 / 6}; the second sub-input could be: {Text: the remaining text part2 after truncation, after extracting keywords and refining the content, weight: 2 / 6}; and the third sub-input could be: {Text: the remaining text part3 after truncation, after extracting keywords and refining the content, weight: 3 / 6}. That is, the second input content is composed of these three sub-input contents.
[0086] In some embodiments, the method for determining weights can be based on data statistics and analysis of variance, which assigns weights by statistically analyzing the dispersion (i.e., variance) of the data corresponding to multiple second input texts. If the data variance of a certain second input text is smaller, it indicates that its information stability is higher and its fit with the target generation requirements is better, and it will be assigned a higher weight; conversely, texts with large variance and large information fluctuations will have lower weights.
[0087] In other embodiments, the weights can be determined using a gradient weighting method based on model learning. This method relies on the self-learning ability of the document generation model to determine the weights by calculating the gradient influence of the text on the generated result. The model iteratively analyzes the contribution gradient of each second input text to the paragraph's logical coherence and information accuracy during the generation process. Texts with larger contribution gradients (i.e., more significant impact on generation quality) are assigned higher weights.
[0088] Figure 5 The method first breaks down the remaining text into single-dimensional text to avoid information redundancy and help the model grasp the core; then it assigns weights from back to front according to the generation order, so that recently highly related texts receive more attention and reduce invalid parsing; finally, it binds the text and weights in a structured way as standard input, which not only covers the previous information, but also guides the model to focus on the key points, improves the accuracy and efficiency of paragraph generation, and strengthens the global consistency of long documents.
[0089] Please refer to Figure 6 This is a flowchart illustrating the process of determining multiple second input texts provided in an embodiment of this application, such as... Figure 6 As shown, the method may include the following steps S610 to S620: S610: If the number of characters in the remaining text is greater than or equal to the second preset number of characters, the ratio of the number of characters in the remaining text to the second preset number of characters is determined as the number of segments.
[0090] In other words, in this embodiment, when the remaining text has a large number of characters, it will be considered to split it into multiple second input texts. That is, when the number of characters in the remaining text is greater than or equal to the second preset number of characters, multiple second input texts will be determined. In some embodiments, when the number of characters in the remaining text exceeds or equals the pre-set second preset number of characters (e.g., 400 characters), the system will first calculate the ratio of the number of characters in the remaining text to the second preset number of characters. For example, if the ratio is not an integer (e.g., 1000 characters in the remaining text, 400 characters in the second preset number of characters, the ratio is 2.5), then the rounding rule is used to determine the number of segments (here, rounded to 3 segments). This ensures that the number of characters in each segment after splitting does not exceed the second preset number of characters, fully adapting to the information processing range of the model, and avoiding the omission of core information or parsing distortion due to a certain segment exceeding the character limit; if the ratio is an integer (e.g., 800 characters in the remaining text, 400 characters in the second preset number of characters, the ratio is 2), then the integer is directly used as the number of segments to achieve uniform splitting of the text.
[0091] S620: Divide the remaining text into multiple second input texts according to the number of segments.
[0092] It should be understood that the number of second input texts is equal to the number of segments. Therefore, the remaining text is divided into multiple second input texts according to the number of segments.
[0093] Figure 6 The method uses a second preset number of characters as a benchmark and determines the number of segments based on the remaining text in a certain way, so that the size of each segment is adapted to the optimal processing range of the model and avoids excessive parsing burden due to excessively long single segments; the quantitative and regular division of text not only makes the splitting logic clear, but also improves the operability of subsequent weight allocation, adapts to the needs of text splitting and quantification scenarios, and optimizes the standardization and efficiency of input processing.
[0094] In other embodiments, if the number of remaining text characters does not reach the second preset number of characters (e.g., 300 remaining characters, 400 preset characters), it indicates that the current text volume is within the range that the model can efficiently parse, and no further splitting is required. In this case, the number of segments is directly set to 1, that is, the complete remaining text is retained as a single input unit. This design can reduce unnecessary splitting operations, avoid information dimension breaks due to excessive splitting, and reduce the model's cost of connecting multiple text segments, ensuring the integrity of information transmission.
[0095] In other embodiments, the remaining text can be directly divided into paragraphs according to a preset number. For example, based on the specific needs of the document generation scenario (such as each round needing to correspond to 3 information dimensions), the number of segments can be preset to 3. Regardless of the ratio of the remaining text word count to a second preset word count, the remaining text will be directly split into 3 segments. Fixing the segment size can improve the standardization of subsequent weight allocation and content integration processes.
[0096] After completing the fine processing and segmentation of the input content, in order to further ensure the quality and reliability of the generated document and avoid the impact of information deviation or logical omission on the document's usability, this application also constructs a document generation confidence verification mechanism to ensure the accuracy and rationality of the generated content.
[0097] Please refer to Figure 7 This is a schematic diagram of the document generation confidence verification process provided in the embodiments of this application, such as... Figure 7 As shown, the method may include the following steps S710 to S720: S710: If the document to be generated meets the authenticity detection conditions, determine the confidence level of the paragraph corresponding to the target round.
[0098] In some embodiments, the triggering scenarios for authenticity detection conditions are strongly related to document type, content attributes, and user needs, and may include, but are not limited to, the following: First, the document belongs to a type with a default high authenticity requirement, such as medical records, legal contracts, bidding documents, experimental data sections of scientific research papers, etc. These documents naturally require authenticity verification because they are directly related to rights, security, or decision-making; Second, the document content contains key information that needs to be verified, such as specific data (e.g., "equipment operating temperature ≤ 80℃"), cited sources (e.g., "based on GB / T 1234-2020 standard"), professional terms, or factual descriptions (e.g., "project duration is 180 days"); Third, the user explicitly requests a high authenticity requirement, which triggers the detection conditions regardless of the document type. In some embodiments, the confidence level can be calculated based on the model output probability. For example, when using a GPT-type model to generate "the Earth's rotation period is about 24 hours", the generation probability of key tokens such as "24 hours" and "rotation period" in the sentence is extracted. If the probability of these tokens all exceeds 98% and the probability distribution is concentrated, the confidence level of the overall sequence is obtained by calculating the product of the token probabilities. In other embodiments, the method for calculating confidence can be semantic consistency analysis. For example, when generating a weather forecast for a certain region, natural language processing technology can be used to detect a logical contradiction between "heavy rain all day tomorrow" and "it is recommended to go out to dry clothes tomorrow morning". The semantic consistency is determined to be low, and the corresponding confidence drops to 50%. In other embodiments, the method for calculating confidence can be based on comparative analysis. For example, when generating a descriptive text of a historical event, the content is compared with official historical documents such as the Records of the Grand Historian and the Zizhi Tongjian. If the core information such as the time, people, and causes of the event are completely consistent, it is determined that it is highly consistent with the authoritative source, and the confidence level is calculated to be 95%.
[0099] S720: If the confidence level is greater than or equal to the confidence threshold, and the target round is any round other than the last round in a multi-round process, proceed with the text generation process for the next round of the target round.
[0100] In some embodiments, the "determination of confidence level" achieves quantitative evaluation through multi-dimensional verification: First, from the information matching dimension, the target paragraph is compared with the input image and text dataset (such as original contract terms, experimental records) and authoritative sources (such as public standards, literature databases) to check for issues such as fabricated data and incorrect citations, ensuring that the content is consistent with the underlying basis; second, from the logical coherence dimension, it verifies whether the factual information in the paragraph contradicts that of the preceding paragraph. For example, if the preceding text clearly states "construction period of 180 days," and the current paragraph mentions "construction period of 200 days," the logical consistency score will be lowered; finally, from the professional compliance dimension, for professional fields such as law and medicine, it verifies whether the terminology used and process descriptions in the paragraph comply with industry standards. For example, it checks whether the "complaint" contains the plaintiff's information, litigation claims, and other legally required elements. After completing the evaluation of each dimension, the final confidence level is calculated by weighting (e.g., information matching degree accounts for 60%, logical coherence accounts for 30%, and professional compliance accounts for 10%), and a quantitative score of 0-100 is output. The higher the score, the stronger the authenticity and reliability of the paragraph.
[0101] Figure 7 The document generation confidence verification method described above is of significant value for scenarios with high authenticity requirements (such as tender documents, legal documents, medical reports, etc.). It first precisely identifies the document type and content to be verified by clearly defined authenticity detection conditions (such as default high-authenticity documents, texts containing key data, or user-specified scenarios), avoiding inefficient verification caused by indiscriminate checks. Then, it determines the confidence level through multi-dimensional weighted evaluation (information matching degree, logical coherence, professional compliance), eliminating issues such as fabricated data and incorrect citations from the fundamental basis, while ensuring factual consistency and compliance with professional standards between paragraphs, making the confidence measurement results more credible. Finally, based on the confidence level threshold and round judgment, it decides whether to proceed to the next round of generation, forming an "inter-round quality control" mechanism. This effectively intercepts low-authenticity content from entering subsequent processes, providing reliable quality assurance for tender documents, legal documents, and other documents with stringent authenticity requirements, reducing legal risks and decision-making errors caused by information distortion.
[0102] While ensuring the authenticity of generated content through confidence verification, long document generation also needs to avoid the problem of "logical gaps between paragraphs". Especially in scenarios such as tender documents and legal documents, if there are logical contradictions between the preceding paragraphs and the current paragraph (such as data conflicts or inconsistent expressions), even if the content of a single paragraph is true, it will affect the overall rigor of the document.
[0103] Please refer to Figure 8 This is a schematic diagram of the document generation logic consistency verification process provided in the embodiments of this application, such as... Figure 8 As shown, the method may include the following steps S810 to S820: S810: Verify the logical consistency between at least one paragraph and the paragraph corresponding to the target round.
[0104] In some embodiments, the logical verification method may be a key information consistency comparison method. For example, when generating an equipment operation and maintenance manual, the preceding paragraph clearly states that "the equipment inspection cycle is once a week," but the target paragraph states that "the inspection cycle is once a month." By comparing key data, it is determined that there is a logical conflict. In some embodiments, the logic verification method can be a process and causal logic verification method. For example, when generating a home appliance installation guide, the preceding steps are "install the base first and then connect the power supply", and the target paragraph is "connect the power supply first and then install the base". By verifying the process sequence, the logic is determined to be broken. In other embodiments, the logical verification method can be a semantic and conceptual consistency analysis method. For example, when generating contract documents, the preceding clause stipulates that "the penalty for breach of contract shall be calculated at 10% of the contract amount," while the target paragraph states that "the penalty for breach of contract shall be calculated at 5% of the contract amount." By parsing the semantics, the deviation in conceptual expression can be determined. In other embodiments, the logic verification method can be a range and constraint boundary verification method. For example, when generating a product manual, the preface states "applicable voltage 220V" and the target paragraph states "applicable voltage 110V-220V". By verifying the applicable range, the logic is determined to be out of bounds.
[0105] S820: If the logical consistency requirement is met and the target round is any round other than the last round in a multi-round process, proceed with the text generation process for the next round of the target round.
[0106] In some embodiments, on the one hand, it is necessary to confirm the logical consistency verification result of S810. Only when the target round paragraph has no key information conflict, process reversal, semantic deviation or scope overrun with the preceding paragraph (i.e., meets the preset logical consistency requirements, such as no conflict records and logical matching degree higher than the threshold), can it be ensured that the current content is smoothly connected with the preceding text and avoid the accumulation of contradictions. On the other hand, it is necessary to determine the position of the target round. If the current round is not the last round in the multi-round generation (for example, when generating bidding documents, the current round is "technical solution", and there are still "business quotation" and "after-sales service" rounds later), then the next round of text generation is triggered, allowing the document to be gradually improved according to the preset framework. If the current round is already the last round, there is no need to advance, and the document integration or output stage can be directly entered. In some embodiments, such as when generating an engineering construction plan, the multi-round sequence is "Project Overview → Construction Process → Material Plan → Quality Control". When the "Construction Process" round (target round) passes the logical verification (no conflict with the schedule and site information in "Project Overview"), and there is still a "Material Plan" round to follow, the system will automatically start the text generation of the "Material Plan". If "Quality Control" is the last round, the plan integration will be completed directly after passing the verification, and the next round will not be promoted.
[0107] It should be understood that although the steps in the above flowcharts are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the above flowcharts may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0108] Based on the foregoing embodiments, this application provides a document generation device, which includes various modules and units included in each module, and can be implemented by a processor; of course, it can also be implemented by specific logic circuits; in the implementation process, the processor can be a central processing unit (CPU), microprocessor (MPU), digital signal processor (DSP) or field programmable gate array (FPGA), etc.
[0109] Figure 9 For a structural block diagram of the document generation device provided in the embodiments of this application, please refer to... Figure 9 A document generation device, comprising: a demand information acquisition module S910, a graphic information generation module S920, a graphic dataset construction module S930, and a document output module S940.
[0110] The requirement information acquisition module S910 is used to acquire the generation requirement information of the document to be generated, which includes the task information of the target task. The image and text information generation module S920 is used to input the generation requirement information into the document generation model, extract at least one key text from the task information through the document generation model, and generate at least one reference image corresponding to at least one key text. The image and text dataset construction module S930 is used to match at least one reference image with at least one key text to generate an image and text dataset. The image and text dataset includes multiple image and text data, and each image and text data includes one or more key texts and corresponding reference images. The document output module S940 is used to generate a document for each part of the outline of the document to be generated based on the image and text dataset, and output the document to be generated.
[0111] In one embodiment, the image and text dataset construction module S930 is used to calculate the consistency between at least one reference image and task information through a document generation model to obtain a consistency score. Match at least one reference image with at least one key text to generate an image-text dataset, including: If the consistency score is greater than the preset threshold, at least one reference image will be matched with at least one key text to generate an image-text dataset.
[0112] In one embodiment, the document output module S940 is configured to perform a multi-round text generation process based on the image and text dataset according to each part of the outline, to obtain a document for each part; wherein the multi-round text generation process includes: In the first round of text generation in a multi-round process, paragraphs corresponding to the first round are generated based on the image and text dataset; During the text generation process for the target round, the paragraph corresponding to the target round is generated based on at least one paragraph and image / text dataset corresponding to at least one round prior to the target round. The target round is any round other than the first round among multiple rounds.
[0113] In one embodiment, the document output module S940 is used to extract the first preset number of characters from the at least one paragraph in the order of generation of the at least one paragraph from back to front as the first input text when the number of characters in at least one paragraph exceeds the first preset number of characters, so as to obtain the first input content, the first input content including the first input text and the image and text dataset. Determine the second input content based on the remaining text in at least one paragraph other than the first input text, the second input content including at least one second input text obtained based on the remaining text; Based on the first and second inputs, generate the paragraph corresponding to the target round.
[0114] In one embodiment, the document output module S940 is configured to determine a plurality of second input texts based on the remaining text; Based on the generation order of multiple second input texts from back to front, determine multiple weights corresponding to multiple second input texts. Each second input text corresponds to one weight, and the weight corresponding to the second input text generated later in the generation order is higher. The second input content is determined based on multiple second input texts and their corresponding weights. The second input content includes multiple sub-input contents corresponding to the multiple second input texts, and each sub-input content includes a second input text and its corresponding weight.
[0115] In one embodiment, the document output module S940 is used to determine the ratio of the number of characters in the remaining text to the second preset number of characters as the number of segments when the number of characters in the remaining text is greater than or equal to the second preset number of characters. The remaining text is divided into multiple second input texts according to the number of segments.
[0116] In one embodiment, the document output module S940 is used to determine the confidence level of the paragraph corresponding to the target round if the document to be generated meets the authenticity detection conditions. If the confidence level is greater than or equal to the confidence threshold, and the target round is any round other than the last round in a multi-round process, proceed with the text generation process for the next round of the target round.
[0117] In one embodiment, the document output module S940 is used to verify the logical consistency between at least one paragraph and the paragraph corresponding to the target round; If the logical consistency requirement is met, and the target round is any round other than the last round in a multi-round process, then proceed with the text generation process for the next round of the target round.
[0118] The document generation apparatus provided in this application embodiment can acquire generation requirement information of the document to be generated, including task information of the target task; input the generation requirement information into a document generation model, extract at least one key text from the task information through the document generation model, and generate at least one reference image corresponding to the at least one key text; match the at least one reference image with the at least one key text to generate a text-image dataset, the text-image dataset including multiple text-image data, each text-image data including one or more key texts and corresponding reference images; generate the document for each part according to each part of the outline of the document to be generated, based on the text-image dataset, and output the document to be generated. This application embodiment understands the document generation requirements through the text-image dataset, improves the reliability of document generation, and makes the generated content more closely aligned with the target task.
[0119] The description of the system embodiments above is similar to that of the method embodiments above, and has similar beneficial effects. For technical details not disclosed in the system embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0120] It should be noted that, in the embodiments of this application... Figure 9 The module division of the document generation device shown is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used. Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, exist as separate physical units, or be integrated into one unit with two or more units. The integrated units described above can be implemented in hardware, as software functional units, or in a combination of software and hardware.
[0121] It should be noted that, in the embodiments of this application, if the above-described methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0122] Figure 10 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Please refer to... Figure 10This application provides a computer device, which can be an electronic device, such as a mobile phone, a watch, and a vehicle terminal, etc., and its internal structure diagram can be as follows. Figure 10 As shown. The computer device includes a processor 1020, memory, and a network interface 1040 connected via a system bus 1010. The processor 1020 provides computing and control capabilities. The memory includes a non-volatile storage medium 1031 and internal memory 1032. The non-volatile storage medium 1031 stores an operating system, computer programs, and a database. The internal memory 1032 provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium 1031. The database is used to store data. The network interface 1040 is used to communicate with external terminals via a network connection. When the computer program is executed by the processor 1020, it implements the aforementioned methods.
[0123] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the method provided in the above embodiments.
[0124] Those skilled in the art will understand that Figure 10 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0125] In one embodiment, the document generation apparatus provided in this application can be implemented as a computer program, and the computer program can be implemented in the form of, for example, Figure 10 The device operates on the computer device shown. The memory of the computer device can store the various program modules that make up the above-described apparatus. The computer program, composed of the various program modules, causes the processor to execute the steps of the methods in the various embodiments of this application described in this specification.
[0126] It should be noted that the descriptions of the storage medium and device embodiments above are similar to the descriptions of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium, storage medium, and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0127] It should be understood that the phrases "one embodiment," "an embodiment," or "some embodiments" mentioned throughout the specification mean that a specific feature, structure, or characteristic related to an embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment," "in one embodiment," or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely for descriptive purposes and do not represent the superiority or inferiority of the embodiments. The descriptions of the various embodiments above tend to emphasize the differences between the various embodiments; their similarities or commonalities can be referred to mutually, and for the sake of brevity, they will not be repeated here.
[0128] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three kinds of relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist simultaneously, and object B exists alone.
[0129] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0130] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or modules can be electrical, mechanical, or other forms.
[0131] The modules described above as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules. They may be located in one place or distributed across multiple network units. Some or all of the modules may be selected to achieve the purpose of this embodiment according to actual needs.
[0132] In addition, each functional module in the various embodiments of this application can be integrated into one processing unit, or each module can be a separate unit, or two or more modules can be integrated into one unit; the integrated modules can be implemented in hardware or in the form of hardware plus software functional units.
[0133] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.
[0134] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0135] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A document generation method, characterized in that, The method includes: Obtain the generation requirement information of the document to be generated, wherein the generation requirement information includes the task information of the target task; The generation requirement information is input into the document generation model, and at least one key text is extracted from the task information through the document generation model, and at least one reference image corresponding to the at least one key text is generated; The at least one reference image is matched with the at least one key text to generate an image-text dataset. The image-text dataset includes multiple image-text data, and each image-text data includes one or more key texts and a corresponding reference image. According to each part of the outline of the document to be generated, generate a document for each part based on the image and text dataset, and output the document to be generated; The step of generating a document for each part of the outline of the document to be generated, based on the image and text dataset, includes: According to each part of the outline, a multi-round text generation process is performed based on the image and text dataset to obtain a document for each part; wherein, the multi-round text generation process includes: In the first round of text generation in the multiple rounds, the paragraph corresponding to the first round is generated based on the image and text dataset; During the text generation process for the target round, a paragraph corresponding to the target round is generated based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset. The target round is any round other than the first round among multiple rounds. In the text generation process for the target round, generating the paragraph corresponding to the target round based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset includes: If the number of characters in at least one paragraph exceeds a first preset number of characters, the first preset number of characters is extracted from the at least one paragraph in the order of generation of the at least one paragraph from back to front as the first input text to obtain the first input content, the first input content including the first input text and the image and text dataset; Based on the remaining text in the at least one paragraph excluding the first input text, a second input content is determined, the second input content including at least one second input text obtained based on the remaining text; Based on the first input content and the second input content, generate the paragraph corresponding to the target round.
2. The method according to claim 1, characterized in that, The method further includes: The consistency score is obtained by calculating the consistency between the at least one reference image and the task information using the document generation model. The step of matching the at least one reference image with the at least one key text to generate an image-text dataset includes: If the consistency score is greater than a preset threshold, the at least one reference image is matched with the at least one key text to generate the image and text dataset.
3. The method according to claim 1, characterized in that, The at least one second input text includes a plurality of second input texts; and the step of determining the second input content based on the remaining text in the at least one paragraph excluding the first input text includes: Based on the remaining text, determine the plurality of second input texts; According to the generation order of multiple second input texts from back to front, multiple weights corresponding to the multiple second input texts are determined. Each second input text corresponds to one weight, and the weight corresponding to the second input text generated later in the generation order is higher. The second input content is determined based on the plurality of second input texts and the corresponding plurality of weights. The second input content includes a plurality of sub-input content corresponding to the plurality of second input texts, and each sub-input content includes a second input text and a corresponding weight.
4. The method according to claim 3, characterized in that, The step of determining the plurality of second input texts based on the remaining text includes: If the number of characters in the remaining text is greater than or equal to the second preset number of characters, the ratio of the number of characters in the remaining text to the second preset number of characters is determined as the number of segments; The remaining text is divided into the plurality of second input texts according to the number of segments.
5. The method according to claim 1, characterized in that, After generating the paragraph corresponding to the target round based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset, the method further includes: If the document to be generated meets the authenticity detection conditions, determine the confidence level of the paragraph corresponding to the target round; If the confidence level is greater than or equal to the confidence level threshold, and the target round is any round other than the last round among the multiple rounds, then the text generation process for the next round of the target round is performed.
6. The method according to claim 1, characterized in that, After generating the paragraph corresponding to the target round based on at least one paragraph corresponding to at least one round prior to the target round and the image and text dataset, the method further includes: Verify the logical consistency between the at least one paragraph and the paragraph corresponding to the target round; If the logical consistency requirement is met, and the target round is any round other than the last round among the multiple rounds, then the text generation process for the next round of the target round is performed.
7. A document generation device, characterized in that, include: The requirement information acquisition module is used to acquire the generation requirement information of the document to be generated, wherein the generation requirement information includes the task information of the target task; The image and text information generation module is used to input the generation requirement information into the document generation model, extract at least one key text from the task information through the document generation model, and generate at least one reference image corresponding to the at least one key text. The image and text dataset construction module is used to match the at least one reference image with the at least one key text to generate an image and text dataset. The image and text dataset includes multiple image and text data, and each image and text data includes one or more key texts and corresponding reference images. The document output module is used to generate a document for each part of the outline of the document to be generated based on the image and text dataset, and output the document to be generated. The document output module is specifically used for: Based on each section of the outline, a multi-round text generation process is performed using the image and text dataset to obtain the document for each section; the multi-round text generation process includes: In the first round of text generation in a multi-round process, paragraphs corresponding to the first round are generated based on the image and text dataset; In the text generation process of the target round, based on at least one paragraph and image-text dataset corresponding to at least one round before the target round, the paragraph corresponding to the target round is generated. The target round is any round other than the first round in the multiple rounds. The document output module is specifically used for: If the number of words in at least one paragraph exceeds the first preset number of words, extract the preset number of words from at least one paragraph in the generation order of at least one paragraph from back to front as the first input text to obtain the first input content. The first input content includes the first input text and the image and text dataset. Determine the second input content based on the remaining text in at least one paragraph other than the first input text, the second input content including at least one second input text obtained based on the remaining text; Based on the first and second inputs, generate the paragraph corresponding to the target round.
8. A computer device comprising a memory and a processor, the memory storing a computer program executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Conference material generation method and device and storage medium
CN118898663A