Document generation method and device, electronic equipment and storage medium
By determining the business scenario type based on user requests during enterprise project document writing, and acquiring and integrating information such as document structure templates, structured data, and compliance standard clauses, the problem of lack of logical structure in generated content in existing technologies is solved, thereby improving the professionalism and usability of documents.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- IFLYTEK CO LTD
- Filing Date
- 2026-04-13
- Publication Date
- 2026-05-12
AI Technical Summary
Existing technologies for writing enterprise project documents rely on semantic similarity to recall unstructured text fragments, resulting in generated content that lacks logical structural connections, making it difficult to meet the requirements of professionalism, accuracy, and compliance, and leading to low usability of the generated documents.
Based on the user's writing request, determine the business scenario type, obtain reference information such as document structure templates, structured business data, semantically related text, and compliance standard clauses, and generate the target document by integrating and constructing a logically related set of reference information.
It achieves deep integration of structured data and unstructured text, improving the professionalism, accuracy and usability of generated documents, and reducing the cost and business risks of manually integrating information.
Smart Images

Figure CN122021601A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a document generation method, apparatus, electronic device, and storage medium. Background Technology
[0002] In enterprise project document writing scenarios, retrieving and reusing high-quality content snippets from historical documents has become a common creation pattern.
[0003] Currently, Retrieval-Augmented Generation (RAG) combined with Large Language Model (LLM) is commonly used to assist writing. However, this method usually relies solely on semantic similarity to recall unstructured text fragments, resulting in generated content that often lacks logical structural connections, is prone to data bias, or does not conform to specific scenario norms, leading to low usability of the generated documents. Summary of the Invention
[0004] This invention provides a document generation method, apparatus, electronic device, and storage medium to address the deficiencies in the prior art.
[0005] This invention provides a document generation method, comprising the following steps: Based on the user's writing request, determine the business scenario type of the target document to be generated; The reference information type is determined based on the business scenario type, and the reference data corresponding to the reference information type is obtained; the reference information type includes at least one of document structure template, structured business data, semantically related text, and compliance standard clauses; The reference data is integrated according to the business scenario type to obtain a reference information set composed of logically related reference data; The target document is generated based on the aforementioned set of reference information.
[0006] According to a document generation method provided by the present invention, determining the reference information type based on the business scenario type includes: Identify the constraints imposed by the business scenario type on content accuracy and format compliance; Based on the constraints, at least one of the following is selected as the reference information type: the document structure template, the structured business data, the semantically related text, and the compliance standard clauses.
[0007] According to a document generation method provided by the present invention, the step of selecting at least one type of reference information from the document structure template, the structured business data, the semantically related text, and the compliance standard clauses, based on the constraints, includes: When the constraint requirement is indicated as a strong rule constraint, the document structure template, the structured business data, and the compliance standard clauses are selected as the reference information type. When the constraint requirement indicates an open-ended authoring type, the document structure template and the semantically related text are selected as the reference information type.
[0008] According to a document generation method provided by the present invention, the step of integrating the reference data according to the business scenario type to obtain a reference information set composed of logically related reference data includes: Based on the business scenario type, determine the weight parameters corresponding to the reference data for different reference information types; Based on the weight parameters of each reference data, the reference data are filtered to obtain candidate data; Based on the document structure template, the candidate data is mapped to the corresponding structural positions to obtain a set of reference information composed of logically related reference data.
[0009] According to a document generation method provided by the present invention, after generating the target document, the method further includes: The target document is subjected to a quality assessment to obtain an assessment score; If the evaluation score is lower than a preset threshold, the target document is marked as a negative sample, and the reason label for the negative sample's evaluation score being lower than the preset threshold is recorded. The negative samples and the cause labels are used to optimize the parameters of the model used to generate the target document.
[0010] According to a document generation method provided by the present invention, the step of optimizing the parameters of the model used to generate the target document using the negative samples and the cause labels includes: Target documents with an evaluation score greater than or equal to the preset threshold are used as positive samples; Calculate the content feature differences between the positive sample and the negative sample; Based on the differences in content features, the suppression weights of the feature patterns that lead to the negative samples are adjusted during the generation process of the model.
[0011] According to a document generation method provided by the present invention, obtaining reference data corresponding to the reference information type includes: If the reference information type includes the document structure template, then the document structure with the highest similarity in the historical document library is matched based on the writing request as the corresponding reference data; If the reference information type includes the structured business data, then the numerical indicators in the business system are retrieved based on the business keywords in the writing request as the corresponding reference data. If the reference information type includes the semantically related text, then the writing request is converted into a semantic vector and similar historical text fragments are recalled as corresponding reference data; If the reference information type includes the compliance standard clauses, then the corresponding industry standard clauses associated with the business scenario type are used as the corresponding reference data.
[0012] According to a document generation method provided by the present invention, before obtaining the reference data corresponding to the reference information type, the method further includes: Parse historical documents and identify at least one of the following: text, tables, images, and flowcharts. The text, the table, the image, and the flowchart are respectively structured to obtain knowledge fragments containing business attribute tags; Sensitive information is filtered from the knowledge fragments, and the filtered knowledge fragments are stored in the knowledge base.
[0013] According to a document generation method provided by the present invention, the step of performing structured processing on the text, the table, the image, and the flowchart respectively to obtain a knowledge fragment containing business attribute tags includes: For the text, the semantic boundaries of the text content are identified and segmented to obtain independent business units as the knowledge fragments; For the table, identify the key fields in the table and convert the key fields into key-value pair records that serve as the knowledge fragments; For the image, key text and visual elements are extracted from the image to generate structured descriptive information as the knowledge fragment; For the flowchart, the logical relationships and flow of the process nodes are analyzed to generate a data structure that represents the node jump logic as the knowledge fragment.
[0014] The present invention also provides a document generation apparatus, comprising the following modules: The determination module is used to determine the business scenario type of the target document to be generated based on the user's writing request; The acquisition module is used to determine the reference information type based on the business scenario type and acquire the reference data corresponding to the reference information type; the reference information type includes at least one of document structure template, structured business data, semantically related text, and compliance standard clauses; An integration module is used to integrate the reference data according to the business scenario type to obtain a set of reference information composed of logically related reference data; A generation module is used to generate the target document based on the reference information set.
[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the document generation methods described above.
[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the document generation method as described above.
[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the document generation methods described above.
[0018] The document generation method, apparatus, electronic device, and storage medium provided by this invention determine the business scenario type based on the user's writing request, and accurately match the required reference information type accordingly. Then, based on the business scenario type, the acquired multi-source reference data is structurally integrated to construct a reference information set composed of logically related reference data. Finally, the target document is generated based on this set. Because this invention overcomes the limitations of relying solely on keywords or semantic similarity for retrieval, it achieves deep integration of structured data, unstructured text, and industry standards. This effectively solves the problems of incompatible enterprise-level document generation styles, data fragmentation, and lack of compliance constraints in related technologies, significantly improving the professionalism, accuracy, and usability of the generated documents, while reducing the cost and business risks of manual information integration. Attached Figure Description
[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0020] Figure 1 This is a flowchart illustrating the document generation method provided by the present invention.
[0021] Figure 2 This is a flowchart of document generation and weight integration provided by the present invention.
[0022] Figure 3 This is a flowchart of the intelligent decision support and closed-loop iteration provided by the present invention.
[0023] Figure 4 This is a flowchart of the multimodal document parsing process provided by the present invention.
[0024] Figure 5 This is a flowchart illustrating another document generation method provided by the present invention.
[0025] Figure 6 This is a schematic diagram of the document generation device provided by the present invention.
[0026] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0028] Currently, Generative Artificial Intelligence (AIGC) combined with RAG technology and LLM has been widely applied in assisted writing scenarios. These technologies typically utilize pre-trained models to parse contextual intent to dynamically generate content, or employ deep learning-based semantic vector retrieval techniques to recall relevant text fragments for assisted generation, thus improving document writing efficiency to some extent.
[0029] However, existing document generation technologies still have significant limitations in terms of deep specialization and organizational knowledge reuse. First, the retrieval of information resources suffers from fragmentation and heterogeneity. Project documents often require the integration of multi-dimensional information, including unstructured historical assets, structured business data stored in systems such as enterprise resource planning (ERP), and external intelligence. Current tools typically rely solely on semantic similarity to recall single unstructured text fragments, making cross-system data cleaning and cross-validation difficult, resulting in generated content lacking accurate data support. Second, the generated content suffers from insufficient logical structure and professional depth. General models struggle to adapt to the specific professional expression standards and terminology systems of individual enterprises, and there is a lack of effective correlation with compliance clauses and industry standards. This easily leads to logical contradictions, misuse of terminology, or misleading information, resulting in mediocre texts lacking business logic support, failing to meet the stringent requirements of enterprise-level documents in terms of professionalism, accuracy, and compliance.
[0030] To address this, the present invention provides a document generation method that aims to determine the business scenario type based on the user's writing request, and accordingly accurately determine the required reference information type to obtain reference data covering at least one of document structure templates, structured business data, semantically related text, and compliance standard clauses. By integrating multi-dimensional reference data according to the business scenario type, a reference information set composed of logically related reference data is constructed, realizing document generation based on full-dimensional information fusion. This effectively solves the problems of data fragmentation and content disconnect from business logic, and improves the logical rigor, data accuracy, and scenario compliance of the generated document.
[0031] in, Figure 1 This is a flowchart illustrating the document generation method provided by the present invention, as shown below. Figure 1 As shown, the method includes steps 110, 120, 130 and 140.
[0032] Step 110: Based on the user's writing request, determine the business scenario type of the target document to be generated.
[0033] Here, a user's writing request can be understood as an instruction or information entered by the user to trigger a document generation task. This can be a text-based instruction, a voice instruction, or even a simple keyword or option selection. The writing request characterizes the topic, purpose, or general direction of the document the user hopes to generate. For example, in a scenario requiring the drafting of a formal business document, the writing request might be "Please help me write an implementation plan for Project A" entered by the user in the system interface; in a scenario requiring the drafting of legal documents, the writing request might be the user's selected "Generate software procurement contract" option and related contract elements.
[0034] As an optional implementation, the system interface can receive natural language text input by the user as a writing request. For example, if the user types "write a digital transformation strategic plan for a certain group" in the input box, the system will obtain that text as a writing request.
[0035] Because the writing request contains the user's creative intent, semantic parsing can be performed based on the writing request to determine the business scenario type of the target document to be generated. The target document refers to the document content that the system ultimately outputs and that meets the user's needs. It can be a complete document, such as an entire tender document, or a specific chapter or paragraph within a document, such as the "Technical Architecture" chapter.
[0036] The business scenario type refers to the specific business domain or application environment in which the target document is located. For example, if the writing request contains keywords such as "contract" or "agreement," the intent recognition model determines that the business scenario type is a legal compliance scenario; if the writing request contains keywords such as "implementation plan" or "technical route," the business scenario type is determined to be a technical solution scenario; if it contains keywords such as "annual summary" or "report," it is determined to be an administrative office scenario.
[0037] Furthermore, determining the type of business scenario can also be done by combining multiple dimensions of user characteristics, such as their identity information (e.g., department) and historical writing habits. For example, if a user belongs to the legal department and the request includes "review comments," the system is more likely to determine the business scenario type as a compliance review scenario.
[0038] Step 120: Determine the reference information type based on the business scenario type and obtain the reference data corresponding to the reference information type; the reference information type includes at least one of document structure template, structured business data, semantically related text, and compliance standard clauses.
[0039] After determining the business scenario type, the system needs to decide which types of auxiliary information are required based on the characteristics of that scenario. Reference information types refer to different dimensions of data categories used to assist in document generation. In this embodiment, reference information types specifically include at least one of the following: document structure templates, structured business data, semantically related text, and compliance standard clauses.
[0040] Among them, document structure templates refer to the chapter framework, hierarchical structure, and formatting specifications of a document, used to determine the overall organizational form of the document; structured business data refers to business indicators, technical parameters, or statistical data stored in the business system with clear numerical or field attributes, used to provide accurate factual support; semantically related text refers to paragraphs or sentences in historical documents that are semantically similar to the current writing topic, used to provide writing style references or content materials; compliance standard clauses refer to industry regulations, national standards, or internal management specifications of the enterprise, used to ensure the legality and compliance of the document content.
[0041] The required reference information types vary depending on the specific business scenario. For example, for the "bid document writing" scenario, due to its strict formatting requirements and involvement of specific pricing, the system determines that the reference information types should include document structure templates, structured business data, and compliance standard clauses. For the "project background introduction" scenario, which may place more emphasis on fluent writing and the reuse of past experience, the system determines that the reference information types should mainly include semantically related text, used to refer to background descriptions of similar projects.
[0042] After determining the required reference information type, the system performs the corresponding data acquisition operation to obtain the reference data. The reference data is the specific content entity under each of the above-mentioned reference information types.
[0043] As an optional implementation, if the reference information type includes a document structure template, the reference data can be obtained by matching the most suitable historical drafts in the company's historical document library based on the title or keywords in the writing request, and extracting their chapter and table of contents structure as the document structure template. For example, the table of contents structure of previously won project documents can be matched based on "Project A".
[0044] As an optional embodiment, if the reference information type includes structured business data, the reference data can be obtained by calling the enterprise's internal business system through the API interface based on the entity name in the writing request, and retrieving the precise numerical indicators.
[0045] As an optional embodiment, if the reference information type includes semantically related text, the reference data can be obtained by using semantic vector retrieval technology to convert the writing request into a query vector and recall content fragments with high semantic similarity from a large amount of unstructured historical assets. These fragments contain rich business logic and professional language.
[0046] As an optional implementation, if the reference information type includes compliance standard clauses, the reference data can be obtained by triggering the rule engine based on the business scenario type, and associating relevant industry policies, national standards or internal enterprise compliance specifications from the external real-time intelligence database or legal database.
[0047] Step 130: Integrate the reference data according to the business scenario type to obtain a set of reference information composed of logically related reference data.
[0048] The reference data obtained above is often scattered and heterogeneous, such as a directory tree, specific numbers, and text paragraphs. To enable the generative model to effectively utilize this data, it needs to be organically integrated according to the business scenario type. Integration refers to the process of assembling, cleaning, and sorting multi-dimensional reference data according to a certain logical structure. The reference information set composed of logically related reference data refers to the integrated data package with contextual coherence, which can serve as the input context for the generative model.
[0049] As an optional embodiment, the integration process may include: using the obtained document structure template as a skeleton, filling the retrieved structured business data into the corresponding chapter positions, attaching the recalled semantically related text as reference material to the prompt information of the relevant paragraphs, and placing compliance standard clauses as constraints in the header of the generation instruction.
[0050] The integration strategy varies depending on the type of business scenario. For example, in business scenarios with high rigor requirements, compliance standards and structured business data are given higher priority during integration. If semantically related text conflicts with standard clauses, the semantically related text is removed or corrected to ensure that the generated set of reference information is logically compliant and accurate. In business scenarios with high creativity requirements, more diverse semantically related text may be retained during integration to provide rich creative inspiration. Through this structured integration, the fragmented data is transformed into ordered information, constructing a complete and logically coherent information input.
[0051] Step 140: Generate the target document based on the reference information set.
[0052] Finally, the system uses a pre-built generative model (such as a large language model) as input, and takes the set of reference information consisting of logically related reference data obtained in step 130 as input to generate the final target document.
[0053] Because the reference information set already contains the basic framework of the document, core data materials, and compliance constraints, the generation model is subject to explicit constraints and guidance during the generation process. The model is not merely an open-ended continuation of text, but rather, based on the logical connections within the reference information set, it strings together scattered information into a coherent and professional text.
[0054] For example, the model generates documents according to the chapter order defined in the document structure template; when generating specific paragraphs, it references structured business data from the reference information set to ensure data accuracy; simultaneously, the model mimics the writing style of semantically related text, such as company-specific professional terminology, and adheres to compliance standards to avoid generating non-compliant content. The final generated target document retains the company's unique style while ensuring data accuracy and compliance.
[0055] The document generation method provided in this embodiment determines the business scenario type based on the user's writing request, accurately matches the required reference information type accordingly, and then structurally integrates the acquired multi-source reference data according to the business scenario type to construct a reference information set composed of logically related reference data. Finally, the target document is generated based on this set. Because this method overcomes the limitations of relying solely on keywords or semantic similarity for retrieval, it achieves deep integration of structured data, unstructured text, and industry standards. This effectively solves the problems of incompatible enterprise-level document generation styles, data fragmentation, and lack of compliance constraints in related technologies, significantly improving the professionalism, accuracy, and usability of the generated documents, while reducing the cost and business risks of manual information integration.
[0056] Given the significant differences in the emphasis placed on document content across different business scenarios—for example, some scenarios, such as financial audit reports, place extreme importance on data accuracy and compliance, while others, like corporate culture promotional materials, prioritize richness and fluency—it would be wasteful to retrieve all types of reference information for all scenarios. Furthermore, introducing irrelevant information, such as forcibly inserting complex financial data into promotional materials, could interfere with the generative model's creation logic and reduce document quality.
[0057] To address this issue, this embodiment determines the reference information type based on the business scenario type, including: Identify the constraints imposed by different business scenario types on content accuracy and format compliance; Based on the constraints, select at least one type of information from document structure templates, structured business data, semantically related text, and compliance standard clauses as the reference information type.
[0058] After determining the type of business scenario, the first step is to clarify the core requirements for content quality control within that scenario. The purpose of identifying constraints is to transform abstract scenario classifications into specific, quantifiable quality control indicators, thereby providing a basis for decision-making in subsequent information filtering. By identifying constraints, the system can accurately grasp the bottom line and red lines of document generation, ensuring that the generated documents meet specific business standards.
[0059] Here, constraints refer to the specific limitations imposed by the business scenario type on aspects such as content accuracy, data precision, format standardization, and compliance during document generation. Content accuracy primarily measures whether the data and facts cited in the document are consistent with the actual business situation and whether there is any fabrication or deviation; format standardization primarily measures whether the document's layout and clause wording conform to established industry standards or company specifications.
[0060] As an optional implementation, constraints can be identified by querying a pre-configured scenario attribute table. The system pre-stores a mapping table between various business scenario types and constraint levels. For example, when the business scenario type is "contract signing," querying this table reveals that its requirement for content accuracy is "high," meaning the data must be 100% accurate and error-free, and its requirement for format compliance is "strong," meaning it must strictly adhere to legal text formats. When the business scenario type is "brainstorming meeting minutes," querying this table reveals that its requirement for content accuracy is "medium," and its requirement for format compliance is "weak."
[0061] After defining the constraints, and considering that different types of reference information play different roles in improving document quality—for example, structured business data primarily improves accuracy, document structure templates primarily improve standardization, and semantically related text primarily improves richness—targeted selection based on the constraints is necessary to achieve the optimal generation effect. Through this step, the system can filter out information types with low value to the current scenario, focusing on core elements, thereby improving the efficiency of information retrieval and the relevance of the generated content.
[0062] As an optional implementation, the selection logic based on constraint requirements can be implemented using a rule engine. For example, if the constraint requirement is indicated as "strong rule constraint," meaning high accuracy and high standardization requirements, the system determines that a strict framework and precise data are needed. Therefore, document structure templates, structured business data, and compliance standard clauses are selected as reference information types, while semantically related text that may introduce subjective bias is temporarily ignored. If the constraint requirement is indicated as "open-ended creative type," meaning the accuracy requirements are relatively low and divergent thinking is encouraged, the system determines that rich materials are needed to inspire creativity. Therefore, document structure templates and semantically related text are selected as reference information types, while strict compliance standard clauses may be ignored.
[0063] This embodiment identifies the constraints on content accuracy and format standardization imposed by different business scenario types, and flexibly selects at least one of the following as reference information types: document structure template, structured business data, semantically related text, and compliance standard clauses. This achieves dynamic adaptation of the reference information acquisition strategy, avoids a one-size-fits-all approach to information retrieval, ensures compliance and accuracy in rigorous scenarios, and releases creative space in creative scenarios, effectively balancing the standardization and flexibility of document generation.
[0064] Given that constraints are abstract concepts, in practical applications, to facilitate automated logical judgment and execution by the system, continuous or complex constraints need to be discretized into specific category labels. Simultaneously, for different categories of constraints, clear information type combination strategies need to be pre-defined to ensure that the system can quickly locate the necessary resources when faced with massive amounts of heterogeneous data, avoiding invalid searches.
[0065] Based on this, in this embodiment, according to the constraints, at least one type of reference information is selected from document structure templates, structured business data, semantically related text, and compliance standard clauses, including: When the constraint requirement is indicated as a strong rule constraint, select document structure template, structured business data, and compliance standard clauses as the reference information type; When the constraints indicate an open-ended authoring category, select the document structure template and semantically related text as the reference information type.
[0066] First, for scenarios with extremely high requirements for accuracy and standardization, the system defines them as strongly rule-constrained categories, such as contract signing, financial auditing, and compliance reports. The core value of these scenarios lies in "accuracy," "completeness," and "compliance." The absence of a document structure template may lead to chaotic document formatting; the absence of structured business data may result in errors in key indicators; and the absence of compliance standard clauses may trigger legal risks. Therefore, it is necessary to enforce the selection of these three types of reference information to construct a rigorous logical loop. This selection strategy minimizes human error and compliance risks, ensuring the authority of the generated documents. Here, strongly rule-constrained categories refer to constraint categories that have mandatory requirements for the authenticity, logical rigor, and format standardization of document content, and have an extremely low tolerance for error.
[0067] As an optional implementation, when a user requests the generation of an "Annual Financial Audit Report," the system identifies the business scenario type as "Audit" and queries the configuration table to find that the constraint requirement for this scenario is "Strong Rule Constraint." At this time, the system automatically selects the document structure template, structured business data, and compliance standard clauses, and uses these three as the reference information types to be obtained, excluding semantically related text that may be subjective.
[0068] Furthermore, considering that many scenarios primarily focus on expressing viewpoints, articulating ideas, or sharing experiences, the system defines these as open-ended creative categories, such as project background introductions, initial drafts of market analyses, and creative copywriting. These scenarios prioritize fluency and richness of writing style over absolute data accuracy. Forcing the introduction of excessive structured data or rigid compliance clauses may limit the divergent thinking of the generated model, resulting in stiff content. Therefore, selecting a document structure template as the basic framework and emphasizing semantically related text as reference material can stimulate the model's creative potential. This selection strategy enhances the readability and appeal of the document, meeting users' needs for rich content. Here, open-ended creative categories refer to those with high requirements for the innovativeness and fluency of document content, while having relatively relaxed restrictions on data accuracy and formatting standards.
[0069] As an optional implementation, when a user requests the generation of a "Project A Construction Background," the system identifies the business scenario type as a creative solution and queries the configuration table to find that the constraint requirement for this scenario is open-ended creation. In this case, the system automatically selects the document structure template and semantically related text as reference information types. The system will prioritize retrieving high-quality text fragments from historical documents related to "urban development trends" and "pain point analysis" for model reference and refinement, without forcibly associating them with specific financial indicator data.
[0070] This embodiment subdivides the constraints into strong rule constraints and open-ended creation categories, and configures differentiated reference information type selection strategies accordingly. This not only optimizes the resource allocation for information retrieval, but also ensures from the source that the style of the generated document is highly consistent with the user's expectations.
[0071] Considering that the system may acquire massive amounts of reference data during multi-scale hierarchical information retrieval, such as dozens of similar semantically related texts or multiple versions of compliance standard clauses, feeding all this data into the generative model without filtering would not only exceed the model's context window limit but also potentially lead to logically chaotic generated content due to information redundancy or conflicts. Therefore, a mechanism is needed to measure the relative importance of different data and select and assemble them accordingly.
[0072] Based on this, this embodiment integrates the reference data according to the business scenario type to obtain a reference information set composed of logically related reference data, including: Based on the type of business scenario, determine the weight parameters corresponding to the reference data for different types of reference information; Based on the weight parameters of each reference data, the reference data are filtered to obtain candidate data; Based on the document structure template, candidate data is mapped to the corresponding structural positions to obtain a set of reference information composed of logically related reference data.
[0073] First, it's crucial to clarify which type of information is core and which is supplementary in the current business scenario. Different scenarios have drastically different requirements regarding the credibility and priority of information. For example, when drafting legal compliance documents, the authority of compliance standard clauses should be higher than that of semantically related text; when writing creative copy, the inspirational value of semantically related text may be superior to rigid, structured business data. By determining weighting parameters, we can establish quantitative evaluation criteria for subsequent data filtering, ensuring that data that best meets the needs of the scenario is retained. Here, weighting parameters refer to numerical factors used to characterize the importance of a particular type of reference information in the current integration process.
[0074] As an optional implementation, the system can have a built-in scene-aware controller that maintains a "scene-weight mapping table". When the business scene type is a strongly rule-constrained type, the controller automatically sets the weight parameter of compliance standard clauses to 0.5, the weight parameter of structured business data to 0.4, and the weight parameter of semantically related text to 0.1; when the business scene type is an open-ended creation type, the controller increases the weight parameter of semantically related text to 0.7.
[0075] After determining the weights for each type, considering that the actual retrieved reference data is often vast in quantity and of varying quality, it is necessary to filter using weight parameters to provide the highest quality input for the generative model. Through this filtering step, the system can eliminate data with low weight and poor quality, such as outdated text fragments, and retain data with high weight and high matching degree, thereby obtaining a concise and high-quality candidate data set.
[0076] As an optional implementation, the system can use a weighted ranking algorithm to process the reference data. Assume N reference data points are retrieved, each with a basic matching score. The system finds the corresponding weight parameter based on the reference information type to which the data belongs and calculates a comprehensive score. Then, the system sorts the data points from highest to lowest comprehensive score and selects the top K data points as candidate data. For example, in a business terms scenario, a piece of data with high semantic similarity but belonging to the "semantically related text" type might be filtered out because its weight parameter is extremely low, resulting in a lower comprehensive score than a piece of data with moderate semantic similarity but belonging to the "compliance standard terms" type.
[0077] After obtaining the filtered candidate data, considering that this data is currently fragmented and lacks logical context, direct use may result in a loosely structured generated content. To construct a logically rigorous information input, a document structure template is used as a skeleton to fill in these candidate data. This embodiment, through a mapping step, assigns clear chapter affiliations and logical positions to the fragmented data, thereby forming a set of reference information composed of logically related reference data.
[0078] As an optional implementation, the system parses the document structure template and identifies various chapter nodes, such as "1. Project Background," "2. Technical Solution," and "3. Business Quotation." Then, the system uses natural language processing technology to analyze the content attributes of candidate data and assigns them to the corresponding chapter nodes. For example, the selected "revenue growth rate" data is mapped to the "Business Quotation" chapter, and the "industry policies and regulations" clauses are mapped to the "Project Background" chapter. Finally, the system packages this hierarchical and corresponding data package to generate a reference information set composed of logically related reference data.
[0079] This embodiment achieves the transformation from massive data to ordered knowledge by dynamically determining weight parameters and using document structure templates for structured mapping. This not only solves the problem of information overload, but also ensures that reference data can be used in a logical order and manner through explicit structured constraints, significantly improving the organization and professionalism of the generated documents.
[0080] Figure 2 This is a flowchart of document generation and weight integration provided by the present invention, such as... Figure 2 As shown, this process details the entire process from the user's writing request, through multi-dimensional weight adjustment and data filtering, to the final generation of the target document.
[0081] First, the user initiates a writing request, specifying the paragraph title and requirements. The system receives the request and breaks down the paragraph title and requirements, clarifying the theme, key points, and constraints of the generated task.
[0082] Then, based on the decomposition results, multi-dimensional information retrieval and weight calculation are initiated in parallel: determining the weight of framework and format specifications to match the structure of historical manuscripts and provide skeletal support for paragraphs; determining the weight of atomic information retrieval to provide key indicators, clause elements, etc., to accurately extract structured business data such as amounts and parameters; determining the weight of semantic fragment retrieval to supplement contextual information, to retrieve semantically similar historical text fragments and provide writing references; and determining the weight of business standard association to output industry norms, to associate with industry standards or compliance clauses to ensure content compliance.
[0083] Next, a weighted summation operation is performed, which combines the weight parameters of each dimension to perform multi-level filtering and sorting on the massive amount of retrieved data. That is, the initial filtering of the massive amount of data is performed first to quickly narrow down the scope, and then a deep sorting based on fine features is performed to select the best recommendation materials.
[0084] Finally, the domain-specific fine-tuning writing model is invoked to integrate the selected recommended paragraphs, structured data, and compliance clauses into a coherent and complete target document, which is then archived and applied, thus concluding this generation task.
[0085] While generative models possess powerful text generation capabilities, they may still generate inaccurate, non-compliant, or logically flawed content when faced with complex enterprise-level business logic. If the system merely performs a one-way generation task without effectively utilizing erroneous results, the model struggles to learn from historical biases, leading to recurring error patterns in subsequent generation. To endow model parameters with adaptive iteration and continuous optimization capabilities, thereby improving model robustness and business adaptability, a feedback-based closed-loop optimization mechanism is needed.
[0086] Based on this, after generating the target document, this embodiment also includes: The target document is evaluated for quality, and an evaluation score is obtained. If the evaluation score is lower than the preset threshold, the target document will be marked as a negative sample, and the reason label for the negative sample's evaluation score being lower than the preset threshold will be recorded. The parameters of the model used to generate the target document are optimized using negative samples and cause labels.
[0087] Specifically, the assessment score is a quantitative indicator for measuring document quality, which comprehensively reflects the document's performance in multiple dimensions such as compliance, completeness, and accuracy.
[0088] As an optional implementation, the system can use a pre-trained discriminative model or rule engine to score the target document. Evaluation dimensions may include compliance scores (checking whether necessary legal clauses are included), logical integrity scores (checking whether chapter structures are missing), and data accuracy scores (checking whether cited data is consistent with reference data), etc. The final evaluation score is obtained by weighted summing of the scores from each dimension.
[0089] After obtaining the evaluation scores, considering that low-scoring documents, while unusable directly, serve as valuable negative examples, these low-quality documents need to be utilized to help the model understand what is wrong. Therefore, this embodiment determines that if the evaluation score is below a preset threshold, the target document is marked as a negative sample, and the reason label for the negative sample's evaluation score being below the preset threshold is recorded.
[0090] Here, negative samples refer to generated results that are judged to be substandard in quality or not in line with business requirements. The reason label is a structured description of the specific reasons for the low score, such as "missing disclaimer", "incorrect budget data", "incorrect use of terminology", etc.
[0091] As an optional implementation, the system sets a preset threshold (e.g., 80 points). When a target document's evaluation score is 75 points, the system determines that it has failed to meet the standard, stores it in the negative sample library, and automatically generates a reason label based on the specific deduction item.
[0092] After accumulating data containing negative samples and cause labels, this data is needed to fine-tune the model to prevent it from repeating the same mistakes in future generation tasks. Therefore, this embodiment introduces negative feedback to suppress the probability of the model generating specific error patterns, thereby improving the model's robustness and business adaptability.
[0093] As an alternative implementation, a direct preference optimization algorithm or contrastive learning method from reinforcement learning can be used. Negative samples with causal labels are used as counterexamples to construct a loss function, training the model to reduce the probability of outputting similar text sequences during generation. Through periodic offline training or online fine-tuning, the model's parameters are updated, enabling it to automatically avoid generation paths that lead to low scores when facing similar scenarios in the future.
[0094] in, Figure 3 This is a flowchart of the intelligent decision support and closed-loop iterative process provided by the present invention, as follows: Figure 3 As shown, the process includes: First, the user initiates a writing request, and the system generates an initial target document based on the writing request.
[0095] Then, the system initiates intelligent decision support assessment, using a domain-fine-tuned decision-making model to conduct a multi-dimensional in-depth examination of the target document. First, a quantitative assessment is performed, calculating metrics such as project return on investment, cost-risk scores, and compliance ratings to determine the target document's commercial value and risk level. Second, problem identification involves checking the completeness of clauses and the compatibility of technical solutions with existing resources, identifying specific issues such as "missing key compliance clauses" or "infeasibility of the technical solution."
[0096] Next, the system integrates the evaluation results and provides optimization suggestions, clearly pointing out "where the problems are and how to improve them." These optimization suggestions drive the system to enter a secondary content approval stage after revision, using a domain-specific fine-tuning writing model for targeted iteration.
[0097] Specifically, at the data level, numerical correction and qualitative changes are performed to fix erroneous data; at the semantic level, semantic-based expression optimization is carried out to enhance logical coherence; at the business level, compliance clauses and requirement descriptions are verified and supplemented to ensure business closure.
[0098] Finally, the system iteratively generates new target documents based on the optimized content until all evaluation metrics are met, at which point the process ends.
[0099] While penalizing only negative samples tells the model what not to do, it may not yet clarify what the model should do. To more efficiently guide the model towards convergence in the correct direction, the most effective approach is to construct a learning scenario that contrasts positive and negative samples. By comparing the differences between high-quality positive samples and low-quality negative samples, the model can more accurately capture the key features that cause these quality differences.
[0100] Based on this, this embodiment utilizes negative samples and cause labels to optimize the parameters of the model used to generate the target document, including: Target documents with an evaluation score greater than or equal to a preset threshold are used as positive samples; Calculate the differences in content features between positive and negative samples; Based on the differences in content features, the suppression weights of feature patterns that lead to negative samples are adjusted during the generation process.
[0101] Here, a positive sample refers to a document that meets the quality standards and can be directly used in business scenarios. In this embodiment, if the evaluation score is greater than or equal to a preset threshold, the corresponding target document is used as a positive sample.
[0102] As an optional embodiment, when a target document has an evaluation score of 95 points and a preset threshold of 80 points, the system determines it to be a high-quality document, automatically marks it as a positive sample, and stores it in the positive sample library.
[0103] Having both positive and negative samples, it's clear that simply accumulating samples is insufficient to directly guide model optimization; therefore, it's necessary to quantify the differences between them. Only by clarifying the specific distance and direction of difference between positive and negative samples in the semantic vector space or feature representation can we provide clear gradient guidance for model parameter updates. Based on this, this embodiment calculates the content feature differences between positive and negative samples to determine the optimization gradient direction that the model needs to adjust in the feature space, thus providing a quantitative basis for updating model parameters.
[0104] Among them, content feature difference refers to the statistical distance or feature vector difference between positive and negative samples in dimensions such as text embedding vector, key entity distribution, and syntactic structure.
[0105] As an alternative implementation, positive and negative samples generated for the same writing request can be input into a feature extraction model to obtain their respective feature vectors. Then, the difference vector between the two is calculated, which contains the direction of feature change required to move from error to correctness.
[0106] Finally, the calculated feature differences are used to update the model's generation strategy. By increasing the suppression of negative feature patterns while encouraging positive feature patterns, the model can be forced to actively avoid low-quality generation paths that lead to low scores in future generation path selection.
[0107] Based on this, this embodiment adjusts the suppression weights of feature patterns that lead to negative samples during the generation process according to the differences in content features. Here, the suppression weight refers to the coefficient that penalizes the generation probability of specific words, phrases, or sentence structures during the decoding process.
[0108] As an alternative implementation, a loss function can be constructed using the direct preference optimization algorithm. This loss function aims to maximize the likelihood probability of positive samples while minimizing the likelihood probability of negative samples. Specifically, during training, the model adjusts the parameters of its internal attention mechanism or decoding layer based on differences in content features. This ensures that the non-normalized probability values of generation paths highly similar to those of negative samples are suppressed, i.e., the suppression weights are increased. For example, if overly colloquial feature patterns frequently appear in negative samples, the probability of generating such expressions will significantly decrease after the model parameters are updated.
[0109] In practical technical implementation, different types of reference data are stored in different systems with different data structures, and their retrieval logic is also completely different. If a single retrieval method is used, it will not only be inefficient, but also cannot guarantee accurate retrieval of various types of data. Therefore, this embodiment designs a dedicated acquisition path and algorithm for each type of information.
[0110] Specifically, the reference data corresponding to the aforementioned types of reference information includes: If the reference information type includes a document structure template, then the document structure with the highest similarity in the historical document library is matched as the corresponding reference data based on the writing request; If the reference information type includes structured business data, then the numerical indicators in the business system are retrieved based on the business keywords in the writing request as the corresponding reference data. If the reference information type includes semantically related text, the writing request is converted into a semantic vector and similar historical text fragments are recalled as corresponding reference data. If the reference information type includes compliance standard clauses, then the corresponding industry standard clauses will be associated with the business scenario type as the corresponding reference data.
[0111] Regarding the acquisition of document structure templates, it's important to consider that the document's chapter and table of contents structure directly determines the logical framework and hierarchy of the content. The historical document library contains a large number of high-quality documents that have been validated by business practices, and their structures often have extremely high reference value. Directly reusing the structure of similar historical documents can quickly build a document skeleton that conforms to business specifications, avoiding the loose structure or missing elements that can result from building from scratch. Therefore, in this embodiment, if the reference information type includes a document structure template, the document structure with the highest similarity in the historical document library is matched as the corresponding reference data based on the writing request.
[0112] As an optional implementation, keywords in the writing request can be extracted using term frequency-inverse document frequency (IF-IVF) and retrieved from the metadata of the historical document database. A matching score is calculated between each historical document and the writing request, and the historical document with the highest score is selected. Its directory tree structure is then parsed as the corresponding reference data.
[0113] For acquiring structured business data, considering that this type of data is typically stored in heterogeneous business systems and has extremely high accuracy requirements, allowing no room for error, it cannot be obtained through fuzzy text semantic retrieval and must be obtained through precise entity queries. Therefore, in this embodiment, if the reference information type includes structured business data, numerical indicators from the business system are retrieved based on the business keywords in the writing request as the corresponding reference data.
[0114] As an optional implementation, named entity recognition technology can be used to extract business keyword entities from the writing request. Then, a query request is sent to the enterprise system through a pre-built API interface. The enterprise system returns precise numerical indicators as structured business data.
[0115] Regarding the acquisition of semantically related text, considering that unstructured text fragments often rely on deep semantic similarity of context rather than surface keyword matching, vectorized retrieval can bridge the lexical gap and recall high-quality historical passages with different wording but similar meanings, thereby enriching the expressive material of the generated content. Based on this, in this embodiment, if the reference information type includes semantically related text, the writing request is converted into a semantic vector, and similar historical text fragments are recalled as corresponding reference data.
[0116] As an optional implementation, a pre-trained language model can be used to convert writing requests into high-dimensional semantic vectors. Simultaneously, a vector database of historical document fragments is maintained. By calculating the cosine similarity between the query vector and the vectors of each fragment in the database, text fragments with similarity exceeding a preset threshold are recalled as semantically related text.
[0117] Regarding the acquisition of compliance standard clauses, considering that compliance is the bottom line for corporate documentation and has mandatory and standardized characteristics, this type of information is usually strongly related to specific business scenarios. It is not suitable to obtain it through divergent searches, but rather through deterministic rules to ensure the accuracy of the referenced clauses and reduce legal risks. Therefore, in this embodiment, if the reference information type includes compliance standard clauses, the corresponding industry regulatory clauses are associated based on the business scenario type as the relevant reference data.
[0118] As an optional implementation, a rule engine can be built in, which maintains a mapping graph of "business scenarios - regulatory clauses". When the business scenario type is determined to be "software procurement contract", the rule engine is automatically triggered, retrieving relevant clauses from the legal and regulatory database, as well as relevant internal clauses of the enterprise, as compliance standard clauses.
[0119] Given that the massive amounts of historical documents accumulated within enterprises are mostly unstructured data, models cannot directly understand and utilize them. Without pre-processing, subsequent retrieval and recall would be like searching for a needle in a haystack, extremely inefficient and lacking in accuracy. Furthermore, historical documents often contain sensitive information, and direct storage may pose data security risks. To build a high-quality, secure, and usable knowledge base to support efficient subsequent retrieval, in-depth parsing and cleaning of historical documents is necessary.
[0120] Based on this, before obtaining the reference data corresponding to the reference information type, this embodiment further includes: Parse historical documents and identify at least one of the following: text, tables, images, and flowcharts. The text, tables, images, and flowcharts are structured to obtain knowledge fragments containing business attribute tags. Sensitive information is filtered from knowledge fragments, and the filtered knowledge fragments are stored in the knowledge base.
[0121] Documents are not solely composed of plain text; non-text elements such as tables, images, and flowcharts often carry more critical business logic. Treating them all indiscriminately as text will result in the loss of a significant amount of high-value information. Therefore, this embodiment parses historical documents to identify at least one of the following: text, tables, images, and flowcharts. Here, historical documents refer to various unstructured files stored on enterprise servers or in the cloud, such as project contracts, implementation plans, and acceptance reports.
[0122] As an optional embodiment, computer vision technology can be used to analyze the layout of historical documents, automatically selecting and classifying text areas, table areas, image areas, and flowchart areas.
[0123] After identifying different types of content, and considering that the parsing logic for each type is completely different, in order to maximize the extraction of semantic information, this embodiment uses targeted structured processing to transform the originally uneditable and unsearchable pixel or character streams into machine-readable structured data with semantic tags, thereby achieving knowledge fragmentation.
[0124] Specifically, this embodiment performs structured processing on text, tables, images, and flowcharts to obtain knowledge fragments containing business attribute tags. Here, structured processing refers to the process of converting unstructured data into a data format with explicit key-value pairs, logical relationships, or semantic descriptions. A knowledge fragment is the smallest unit of information with independent semantic integrity.
[0125] As an optional implementation, for text, optical character recognition (OCR) can be used combined with natural language processing for paragraph segmentation; for tables, the row and column structure can be identified and cell content extracted, converted into key-value pairs; for flowcharts, node shapes and connection directions can be identified and converted into JSON data describing the process logic. After processing, business attribute tags are automatically added to each fragment based on the document's metadata. Here, metadata refers to information describing the document's own attributes, such as the document's creation time, author, project name, and version number; business attribute tags are classification tags used to identify the business characteristics of the knowledge fragment, such as "Project Stage: Acceptance," "Department: Finance Department," and "Risk Level: High."
[0126] After obtaining structured knowledge fragments, considering the requirements of enterprise data security compliance, data containing private information cannot be directly exposed to the generative model or stored in a public knowledge base. Therefore, this embodiment uses pre-processing to de-identify sensitive information, thus cutting off the risk of sensitive information leakage at the source and ensuring the security of the knowledge base.
[0127] As an optional implementation, a sensitive information identification model can be used to scan all knowledge fragments. Once sensitive entities such as ID card numbers, mobile phone numbers, and salary data are detected, they are automatically masked or the field is directly removed. The cleaned and secure knowledge fragments are stored in a vector database or knowledge graph for subsequent retrieval operations.
[0128] Given that different types of unstructured data have completely different ways of carrying information—for example, text relies on semantic coherence, tables on row and column correspondence, images on visual elements, and flowcharts on topological relationships—using a single processing mode will inevitably lead to information loss or parsing errors. Therefore, it is necessary to use customized parsing algorithms for each specific data format to restore its inherent business logic to the greatest extent possible.
[0129] Based on this, this embodiment performs structured processing on text, tables, images, and flowcharts respectively to obtain knowledge fragments containing business attribute tags, including: For text, the semantic boundaries of the text content are identified and segmented to obtain independent business units as knowledge fragments; For tables, identify the key fields in the table and convert the key fields into key-value pair records as knowledge fragments; For images, key text and visual elements are extracted to generate structured descriptive information as knowledge fragments; For the flowchart, the logical relationships and flow of the process nodes are analyzed to generate a data structure that represents the node jump logic as a knowledge fragment.
[0130] Specifically, for plain text areas in documents, lengthy texts often contain multiple independent business themes, such as a contract containing both "payment terms" and "liability for breach of contract." Without segmentation, subsequent searches may retrieve too much irrelevant content; however, overly fine segmentation, such as by sentence, would compromise semantic integrity. Therefore, this embodiment identifies semantic boundaries and segments the text into business units with independent meaning. Here, semantic boundaries refer to the dividing lines between different themes, intentions, or logical paragraphs within the text. An independent business unit refers to a text block capable of expressing a complete business meaning on its own.
[0131] As an optional implementation, text segmentation algorithms from natural language processing can be used to identify features such as titles, clause numbers, or semantic turning points to divide long texts into several independent knowledge segments. For example, an "implementation plan" document can be segmented into independent business units such as project objectives, technical architecture, and personnel configuration.
[0132] For table areas in a document, tables are typically used to display structured data, and their core value lies in the correspondence between rows and columns. If they are treated merely as text strings, this correspondence will be lost. By converting them into key-value pairs, the structured attributes of the data can be restored, facilitating subsequent precise retrieval.
[0133] As an alternative implementation, a table parsing algorithm can be used to identify the table header and cell coordinates. Then, each row of data is converted into a set of key-value pairs in JSON format. For example, a row of table data can be converted into {Item Name: Server, Unit Price: 20000, Quantity: 10} and stored as an independent knowledge fragment.
[0134] For image regions in a document, the information within the images is often highly condensed. By extracting key text and visual elements, unsearchable image data can be transformed into structured information that can be indexed and retrieved.
[0135] As an optional implementation, for scanned documents, the text content is extracted; for statistical charts, their legends, axes, and trend meanings are identified; for seals, the seal name and stamping location are identified. Finally, a structured descriptive information is generated as a knowledge fragment.
[0136] For flowchart areas in a document, the core value of a flowchart lies in the flow logic between nodes. Ordinary text recognition can only recognize the text of nodes and cannot understand the flow. By parsing the topology, the graphical flowchart can be transformed into machine-readable logical data.
[0137] As an alternative implementation, a graph neural network can be used to identify nodes and connections in the flowchart. Text within nodes is extracted as attributes, and the direction of arrows in connections is identified as relationships. Finally, a data structure representing the node transition logic is generated and stored as a knowledge fragment.
[0138] in, Figure 4 This is a flowchart of the multimodal document parsing process provided by the present invention, such as... Figure 4 As shown, the process includes: First, the user uploads a multimodal historical document, the document layout and data type are identified, and it is determined whether the content is text, image, table or flowchart.
[0139] For text-based content, the text parsing module uses semantic boundary recognition to intelligently slice the text; for image-based content, the image parsing module uses optical character recognition and visual understanding to extract key text and visual elements, generating a structured description; for table-based content, the table parsing module extracts key fields and converts them into structured key-value pairs; for flowchart-based content, the flowchart parsing module parses node relationships and outputs machine-readable structured output.
[0140] Next, sensitive information is de-identified and filtered, such as using regular expressions and deep learning models to block private data like ID card numbers and bank account numbers in real time, while accurately retaining core business fields to ensure compliance with enterprise-level data security standards.
[0141] Finally, all parsed outputs are converted into high-dimensional semantic vectors through a domain-fine-tuned vector model, and automatically vectorized and labeled with multi-dimensional business attribute tags such as document type, project stage, risk level, and department. Finally, the structured knowledge fragments that have passed security verification are stored in the knowledge fragment library.
[0142] Figure 5 This is a flowchart illustrating another document generation method provided by the present invention, such as... Figure 5As shown, on the one hand, the system receives historical documents and performs multimodal document parsing, transforming unstructured documents into structured knowledge fragments; on the other hand, users input writing requests such as project title and keywords.
[0143] Then, the knowledge fragments parsed from the multimodal document are stored in the enterprise knowledge base as the underlying data support for subsequent retrieval. Based on the user's writing request, the system performs multi-dimensional information retrieval in parallel in the enterprise knowledge base, such as matching manuscript templates to determine the document skeleton, performing atomic information retrieval to obtain key data indicators, performing semantic fragment retrieval to supplement contextual materials, and associating with business standards to introduce industry compliance clauses.
[0144] Next, the system performs recall information integration, structuring and assembling multi-dimensional reference data to construct a reference information set composed of logically related reference data. Subsequently, the target document is generated based on this set using a domain-fine-tuned writing model.
[0145] Finally, the system initiates the intelligent decision-making process, using a domain-specific fine-tuning decision-making model to evaluate the target document. If the decision evaluation fails, optimization suggestions are generated and feedback is provided to drive iterative modifications back to the generation stage. If the decision evaluation passes, the target document is archived and applied, and the task ends.
[0146] The document generation apparatus provided by the present invention will be described below. The document generation apparatus described below and the document generation method described above can be referred to in correspondence.
[0147] Based on any of the above embodiments Figure 6 This is a schematic diagram of the document generation device provided by the present invention, as shown below. Figure 6 As shown, the device includes: The determination module 610 is used to determine the business scenario type of the target document to be generated based on the user's writing request; The acquisition module 620 is used to determine the reference information type based on the business scenario type and acquire the reference data corresponding to the reference information type; the reference information type includes at least one of document structure template, structured business data, semantically related text, and compliance standard clauses; The integration module 630 is used to integrate reference data according to the business scenario type to obtain a set of reference information composed of logically related reference data; The generation module 640 is used to generate the target document based on the reference information set.
[0148] Figure 7 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 7As shown, the electronic device may include a processor 710, a communications interface 720, a memory 730, and a communication bus 740, wherein the processor 710, the communications interface 720, and the memory 730 communicate with each other through the communication bus 740. The processor 710 can call logical instructions in the memory 730 to execute a document generation method.
[0149] Furthermore, the logical instructions in the aforementioned memory 730 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, 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 a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0150] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the document generation methods provided by the above methods.
[0151] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the document generation methods provided by the methods described above.
[0152] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0153] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0154] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A document generation method, characterized in that, include: Based on the user's writing request, determine the business scenario type of the target document to be generated; The reference information type is determined based on the business scenario type, and the reference data corresponding to the reference information type is obtained; The reference information types include at least one of document structure templates, structured business data, semantically related text, and compliance standard clauses; The reference data is integrated according to the business scenario type to obtain a reference information set composed of logically related reference data; The target document is generated based on the aforementioned set of reference information; After generating the target document, the process also includes: The target document is subjected to a quality assessment to obtain an assessment score; If the evaluation score is lower than a preset threshold, the target document is marked as a negative sample, and the reason label for the negative sample's evaluation score being lower than the preset threshold is recorded. Target documents with an evaluation score greater than or equal to the preset threshold are used as positive samples; Calculate the content feature differences between the positive sample and the negative sample; Based on the differences in content features, the suppression weights of the feature patterns that lead to the negative samples are adjusted during the generation process.
2. The document generation method according to claim 1, characterized in that, The step of determining the reference information type based on the business scenario type includes: Identify the constraints imposed by the business scenario type on content accuracy and format compliance; Based on the constraints, at least one of the following is selected as the reference information type: the document structure template, the structured business data, the semantically related text, and the compliance standard clauses.
3. The document generation method according to claim 2, characterized in that, Based on the constraints, at least one of the following is selected as the reference information type from the document structure template, the structured business data, the semantically related text, and the compliance standard clauses: When the constraint requirement is indicated as a strong rule constraint, the document structure template, the structured business data, and the compliance standard clauses are selected as the reference information type. When the constraint requirement indicates an open-ended authoring type, the document structure template and the semantically related text are selected as the reference information type.
4. The document generation method according to any one of claims 1 to 3, characterized in that, The step of integrating the reference data according to the business scenario type to obtain a reference information set composed of logically related reference data includes: Based on the business scenario type, determine the weight parameters corresponding to the reference data for different reference information types; Based on the weight parameters of each reference data, the reference data are filtered to obtain candidate data; Based on the document structure template, the candidate data is mapped to the corresponding structural positions to obtain a set of reference information composed of logically related reference data.
5. The document generation method according to any one of claims 1 to 3, characterized in that, The step of obtaining the reference data corresponding to the reference information type includes: If the reference information type includes the document structure template, then the document structure with the highest similarity in the historical document library is matched based on the writing request as the corresponding reference data; If the reference information type includes the structured business data, then the numerical indicators in the business system are retrieved based on the business keywords in the writing request as the corresponding reference data; If the reference information type includes the semantically related text, then the writing request is converted into a semantic vector and similar historical text fragments are recalled as corresponding reference data; If the reference information type includes the compliance standard clauses, then the corresponding industry standard clauses associated with the business scenario type are used as the corresponding reference data.
6. The document generation method according to any one of claims 1 to 3, characterized in that, Before obtaining the reference data corresponding to the reference information type, the process also includes: Parse historical documents and identify at least one of the following: text, tables, images, and flowcharts. The text, the table, the image, and the flowchart are respectively structured to obtain knowledge fragments containing business attribute tags; Sensitive information is filtered from the knowledge fragments, and the filtered knowledge fragments are stored in the knowledge base.
7. The document generation method according to claim 6, characterized in that, The process of structuring the text, table, image, and flowchart respectively to obtain knowledge fragments containing business attribute tags includes: For the text, the semantic boundaries of the text content are identified and segmented to obtain independent business units as the knowledge fragments; For the table, identify the key fields in the table and convert the key fields into key-value pair records that serve as the knowledge fragments; For the image, key text and visual elements are extracted from the image to generate structured descriptive information as the knowledge fragment; For the flowchart, the logical relationships and flow of the process nodes are analyzed to generate a data structure that represents the node jump logic as the knowledge fragment.
8. A document generation device, characterized in that, include: The determination module is used to determine the business scenario type of the target document to be generated based on the user's writing request; The acquisition module is used to determine the reference information type based on the business scenario type and acquire the reference data corresponding to the reference information type; The reference information types include at least one of document structure templates, structured business data, semantically related text, and compliance standard clauses; An integration module is used to integrate the reference data according to the business scenario type to obtain a set of reference information composed of logically related reference data; A generation module is used to generate the target document based on the reference information set; After generating the target document, the process also includes: The target document is subjected to a quality assessment to obtain an assessment score; If the evaluation score is lower than a preset threshold, the target document is marked as a negative sample, and the reason label for the negative sample's evaluation score being lower than the preset threshold is recorded. Target documents with an evaluation score greater than or equal to the preset threshold are used as positive samples; Calculate the content feature differences between the positive sample and the negative sample; Based on the differences in content features, the suppression weights of the feature patterns that lead to the negative samples are adjusted during the generation process.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the document generation method as described in any one of claims 1 to 7.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the document generation method as described in any one of claims 1 to 7.