Document generation method, apparatus, device, and storage medium

By processing multi-format source documents and generating structured data, the problem of low conversion efficiency of SSTS documents was solved, and the automatic generation of adapted CTS documents was achieved, thus improving the efficiency of component R&D.

CN122154631APending Publication Date: 2026-06-05CHONGQING LANDIAN AUTOMOBILE TECHNOLOGY CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHONGQING LANDIAN AUTOMOBILE TECHNOLOGY CO LTD
Filing Date
2026-02-27
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, the inconsistent SSTS document format and diverse information presentation methods lead to low efficiency for technicians when converting them into CTS documents, affecting the development progress of components.

Method used

By processing source documents in multiple formats, structured data is generated, and CTS documents are automatically generated according to user functional requirements, including text segmentation, target field identification, and functional information extraction. Querying and updating are performed using preset rules and language models.

Benefits of technology

It improved the efficiency of converting SSTS documents to CTS documents, reduced the time spent by technical personnel on information parsing and writing, and improved the overall R&D progress.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154631A_ABST
    Figure CN122154631A_ABST
Patent Text Reader

Abstract

The application relates to a document generation method, device and equipment and a storage medium, the method comprising the following steps: acquiring a plurality of source documents; dividing each source document according to a preset text division rule to obtain at least one text block; analyzing each text block to determine target field and function information corresponding to each text block, wherein the target field is used for indicating a process condition type to which the corresponding text block belongs; for each function information, generating structured data corresponding to the function information according to a target text block corresponding to the function information and a target field corresponding to the target text block; when receiving function query content related to a spare part, querying each function information corresponding structured data according to the function query content to obtain a target query result; and generating a target document corresponding to the function query content according to the target query result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a document generation method, apparatus, device, and storage medium. Background Technology

[0002] With the continuous advancement of automotive technology, Component Technical Specifications (CTS) documents, as the core basis for component design, testing, and verification, occupy an important position in the overall vehicle development system. These CTS documents are typically written by relevant technical personnel based on Sub-System Technical Specifications (SSTS) documents.

[0003] However, in existing technologies, SSTS documents are written by engineers from multiple fields and generally use unstructured formats such as natural language, tables, and diagrams to describe the functions, performance, interfaces, and environmental requirements of each subsystem. Due to factors such as inconsistent document formats and diverse information presentation methods, technicians need to invest a lot of time in information parsing and organization during the conversion of SSTS documents to CTS documents, resulting in low document conversion efficiency and consequently affecting the overall R&D progress of components. Summary of the Invention

[0004] This application provides a document generation method, apparatus, device, and storage medium. The method can process multi-format source documents to generate structured data corresponding to functional information, and then automatically generate adapted CTS documents according to the user's actual functional requirements, effectively improving the conversion efficiency of SSTS documents to CTS documents.

[0005] Firstly, this application provides a document generation method, the method comprising: Retrieve multiple source documents; According to the preset text segmentation rules, each source document is divided into at least one text block; Each text block is analyzed to determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block corresponding to the functional information and the target field corresponding to the target text block; Upon receiving a function query related to a component, the system queries the structured data corresponding to each function information to obtain the target query result. The target document corresponding to the function query content is generated based on the target query results.

[0006] Optionally, each text block can be analyzed to determine the target fields corresponding to each text block, including: Determine the text vector corresponding to each text block, and combine the text vectors of all text blocks to form a text vector set; For each target field, a match is performed in the text vector set based on the standard text corresponding to the target field to obtain the matching result corresponding to the target field; Based on the text block corresponding to each text vector and the matching result corresponding to each target field, determine the target field corresponding to each text block.

[0007] Optionally, each text block can be analyzed to determine the functional information corresponding to each text block, including: For each text block, determine the position information of the text block in the corresponding source document; Based on the chapter information corresponding to the location information, determine the functional information corresponding to the text block.

[0008] Optionally, after obtaining the structured data, the method further includes: For each target field in the structured data, a pre-trained first language model is invoked to identify the field content corresponding to the target field, and an identification result is obtained. The identification result includes all target fields and the field content corresponding to each target field. If the identification result is the first identification result, the structured data is updated according to the identification result.

[0009] Optionally, based on the target text block corresponding to the functional information and the target field corresponding to the target text block, structured data corresponding to the functional information is generated, including: Based on the functional information, the target text block corresponding to the functional information, and the target field corresponding to the target text block, structured data corresponding to the functional information is generated.

[0010] Optionally, based on the function query content, a query is performed in the structured data corresponding to each function information to obtain the target query results, including: According to the preset keyword segmentation rules, the function query content is segmented to obtain at least one keyword; If there is only one keyword, the target query result is obtained by querying the functional information included in all structured data based on the keyword. If there are multiple keywords, the system queries the structured data corresponding to each functional information based on the keywords to obtain the target query results.

[0011] Optionally, if the function query content is the first query content, a query is performed in the structured data corresponding to each function information based on the function query content to obtain the target query result, including: The pre-trained second language model is invoked to identify the first query content and obtain the second query content corresponding to each target field. For each target field, a query is performed in all structured data based on the target field and the corresponding second query content to obtain the query result corresponding to the target field; Determine the target query result based on the query results corresponding to each target field.

[0012] Secondly, this application provides a document generation apparatus, the apparatus comprising: The acquisition unit is used to acquire multiple source documents; A segmentation unit is used to divide each source document into at least one text block according to a preset text segmentation rule. The analysis unit is used to analyze each text block and determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. The first generation unit is used to generate structured data corresponding to each type of functional information based on the target text block corresponding to the functional information and the target field corresponding to the target text block. The query unit is used to, upon receiving functional query content related to components, perform a query in the structured data corresponding to each functional information based on the functional query content to obtain the target query result; The second generation unit is used to generate the target document corresponding to the function query content based on the target query result.

[0013] Optional, analysis unit, used for: Determine the text vector corresponding to each text block, and combine the text vectors of all text blocks to form a text vector set; For each target field, a match is performed in the text vector set based on the standard text corresponding to the target field to obtain the matching result corresponding to the target field; Based on the text block corresponding to each text vector and the matching result corresponding to each target field, determine the target field corresponding to each text block.

[0014] Optional, analysis unit, used for: For each text block, determine the position information of the text block in the corresponding source document; Based on the chapter information corresponding to the location information, determine the functional information corresponding to the text block.

[0015] Optionally, after obtaining the structured data, the apparatus further includes an update unit, the update unit being configured to: For each target field in the structured data, a pre-trained first language model is invoked to identify the field content corresponding to the target field, and an identification result is obtained. The identification result includes all target fields and the field content corresponding to each target field. If the identification result is the first identification result, the structured data is updated according to the identification result.

[0016] Optionally, the first generating unit is used for: Based on the functional information, the target text block corresponding to the functional information, and the target field corresponding to the target text block, structured data corresponding to the functional information is generated.

[0017] Optional, query unit, used for: According to the preset keyword segmentation rules, the function query content is segmented to obtain at least one keyword; If there is only one keyword, the target query result is obtained by querying the functional information included in all structured data based on the keyword. If there are multiple keywords, the system queries the structured data corresponding to each functional information based on the keywords to obtain the target query results.

[0018] Optionally, when the function query content is the first query content, the query unit is used to: The pre-trained second language model is invoked to identify the first query content and obtain the second query content corresponding to each target field. For each target field, a query is performed in all structured data based on the target field and the corresponding second query content to obtain the query result corresponding to the target field; Determine the target query result based on the query results corresponding to each target field.

[0019] Thirdly, this application provides a document generation device, comprising: at least one communication interface; at least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; and at least one memory connected to the at least one bus, wherein the processor is configured to: Retrieve multiple source documents; According to the preset text segmentation rules, each source document is divided into at least one text block; Each text block is analyzed to determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block corresponding to the functional information and the target field corresponding to the target text block; Upon receiving a function query related to a component, the system queries the structured data corresponding to each function information to obtain the target query result. The target document corresponding to the function query content is generated based on the target query results.

[0020] Fourthly, this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described document generation method.

[0021] Compared with the prior art, the technical solution provided in this application has the following advantages: In this application embodiment, multiple source documents are obtained; each source document is divided according to a preset text segmentation rule to obtain at least one text block; each text block is analyzed to determine the target field and functional information corresponding to each text block, wherein the target field is used to indicate the process condition type of the corresponding text block; for each type of functional information, structured data corresponding to the functional information is generated according to the target text block corresponding to the functional information and the target field corresponding to the target text block; when receiving functional query content related to components, a query is performed in the structured data corresponding to each functional information according to the functional query content to obtain the target query result; and a target document corresponding to the functional query content is generated according to the target query result. In this application embodiment, by processing multi-format source documents, structured data corresponding to functional information is generated. Then, according to the actual functional requirements of the user, a query is performed in the structured data, and an adapted CTS document is automatically generated according to the query result. This avoids the problem of technicians querying SSTS documents and writing CTS documents, effectively improving the conversion efficiency of SSTS documents to CTS documents. Attached Figure Description

[0022] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0024] One or more embodiments are illustrated by way of example with reference numerals in the accompanying drawings. These illustrations do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are denoted as similar elements. Unless otherwise stated, the figures in the drawings are not to be limited by scale.

[0025] Figure 1 A flowchart illustrating a document generation method provided in an embodiment of this application; Figure 2 A flowchart illustrating a data query method provided in an embodiment of this application; Figure 3 A flowchart illustrating a data query method provided in an embodiment of this application; Figure 4 This is a schematic flowchart of a document generation apparatus provided in an embodiment of this application; Figure 5 This is a schematic diagram of a document generation device provided in an embodiment of this application. Detailed Implementation

[0026] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0027] The following disclosure provides numerous different embodiments or examples for implementing various structures of the invention. To simplify the disclosure, specific examples of components and arrangements are described below. These are merely examples and are not intended to limit the scope of the invention. Furthermore, reference numerals and / or letters may be repeated in different examples. Such repetition is for simplification and clarity and does not in itself indicate a relationship between the various embodiments and / or arrangements discussed.

[0028] With the continuous advancement of automotive technology, Component Technical Specifications (CTS) documents, as the core basis for component design, testing, and verification, occupy an important position in the overall vehicle development system. These CTS documents are typically written by relevant technical personnel based on Sub-System Technical Specifications (SSTS) documents.

[0029] However, in existing technologies, SSTS documents are written by engineers from multiple fields and generally use unstructured formats such as natural language, tables, and diagrams to describe the functions, performance, interfaces, and environmental requirements of each subsystem. Due to factors such as inconsistent document formats and diverse information presentation methods, technicians need to invest a lot of time in information parsing and organization during the conversion of SSTS documents to CTS documents, resulting in low document conversion efficiency.

[0030] To address the aforementioned issues, this application provides a document generation method. This method processes multi-format source documents to generate structured data corresponding to functional information, and then automatically generates an adapted CTS document based on the user's actual functional requirements, effectively improving the conversion efficiency from SSTS documents to CTS documents. Figure 1 As shown, the specific steps include: Step 101: Obtain multiple source documents.

[0031] The source documents are SSTS documents, and the source documents are in different formats, including PDF, DOC, DOCX and other formats.

[0032] In this step, the document generation system can obtain the source documents uploaded by the user. For example, technicians can upload multiple SSTS documents (such as chassis_spec.pdf, ecu_requirement.doc, signal_list.xls) through the web interface or API of the document generation system so that the document generation system can obtain these SSTS documents.

[0033] Step 102: Divide each source document into at least one text block according to the preset text segmentation rules.

[0034] The text segmentation rules are used to divide the source document into text blocks according to hierarchy, such as chapters, functional description paragraphs, etc., and are composed of regular expressions and keywords. For example: pattern_section=r"^(#+)\s (\d+\.)?\s ([^\n]+)$" (matches Markdown headings); pattern_function=r"^(function\s \d+[.:]|Function\s \d+[.:])" (matches paragraphs that begin with "Function1:" or "Function1:").

[0035] In this step, since the source documents include documents of various formats, they need to be converted into Markdown intermediate documents for easier processing. Next, the content of the intermediate documents is cleaned to obtain cleaned documents. Finally, the content of these documents is divided using preset text segmentation rules to obtain at least one text block.

[0036] In the above process, the specific steps for converting the source document into an intermediate document in Markdown format are as follows: In step 101, after receiving the source document, the document generation system uses a preset function to identify the file extension of the source document, and then determines the format type of the source document based on the file extension. Then, for source documents of different format types, different format conversion methods are used to convert the source document into an intermediate document in Markdown format.

[0037] The specific steps for converting a source document into an intermediate document in Markdown format, using different format conversion methods for different source document formats, are as follows: When the source document is in PDF format, a pre-defined multi-format parsing routing function is invoked. This function uses PyPDF2 (a Python-specific third-party library for manipulating PDF files) to quickly read the PDF pages and sample a few pages of text to obtain the target text. The target text is then determined as a text-based PDF or a scanned / table-based PDF by calculating text density (text length / page area) and the presence of layout borders. For example, if the target text has no layout borders or has layout borders and the text length / page area ratio is higher than a preset value, the source document containing the target text is identified as a text-based PDF; otherwise, it is identified as a scanned / table-based PDF.

[0038] When the target text is a text-based PDF, PyPDF2's PdfReader (a class in the PyPDF2 library used to read / parse PDF files) is used directly to read and extract the text content of each page in the corresponding source document. When the target text is a scanned / table-based PDF, the magic_pdf library is called. This library is used to break down the PDF pages in the corresponding source document into different blocks and extract them, such as title blocks, paragraph blocks, table blocks, and figure caption blocks.

[0039] Among them, the magic_pdf library is a Python third-party library that focuses on intelligent PDF parsing. The library relies on deep learning models to build core parsing capabilities, which can accurately identify the complex layout of PDF documents and adapt to the structured parsing needs of various types of documents.

[0040] In addition, after using PyPDF2.PdfReader to extract the text content of each page, you can also use PdfReader to access the Annots property of that page to extract the content of annotations / comments, and select the content of the annotation / comment in the extracted text content. Then, insert the content of the annotation / comment after the selected content to ensure that information such as requirements and comments are not lost.

[0041] Finally, after obtaining the text extracted by PyPDF2 or the sections identified by magic_pdf, the document is reconstructed into a Markdown format document according to the visual presentation rules of the PDF document content (including the spatial arrangement order of text blocks, title levels, section relationships, etc.).

[0042] Before reconstructing the document based on the sections identified by magic_pdf, the format of each type of section needs to be converted: For sections identified as first-level headings, they are converted to Markdown first-level heading format (#heading text); for paragraph sections, their paragraph text content is directly extracted and retained; for table sections, magic_pdf first parses them into a two-dimensional data structure, and then converts them into Markdown table syntax based on this structure (example: |Header1|Header2|\n|---|---|\n|Cell1|Cell2|); for image sections, the image files are first extracted and saved to the server, and then the corresponding image links are generated in Markdown.

[0043] When the source document is in DOC / DOCX format, the comtypes library is used to call the Microsoft Word application in the background, or the file is uploaded to a server pre-installed with LibreOffice and converted to PDF format via the command line using `soffice --convert-to pdf input.doc`. After conversion, the PDF file can be processed according to the above PDF file parsing process to obtain an intermediate document in Markdown format.

[0044] The comtypes library is a third-party library specific to Python. Its core function is to enable Python programs to call COM components (ComponentObjectModel) of the Windows system. COM components correspond to the functional interfaces of software such as Adobe Acrobat, Microsoft Office, and WPS on Windows.

[0045] When the source document is in .xlsx / .xlsm format, the openpyxl library is used to load the target Excel workbook, and all worksheets in the workbook are traversed sequentially. For each worksheet, the cell values ​​of the header row are extracted as dictionary keys, and then the subsequent data rows are traversed, reading the values ​​of each cell in each row, and mapping each row of data to a dictionary with the header as the key and the cell value as the value. Finally, the contents of the entire worksheet are constructed into a Python List[Dict] data structure, and then a Markdown format intermediate document is generated based on this structure.

[0046] The openpyxl library is a Python-specific third-party library whose core function is to read, write, and modify .xlsx / .xlsm format files in Excel 2007 and later versions using pure Python code.

[0047] After obtaining the intermediate document, data cleaning can be performed on its content to obtain the cleaned document. Specific steps include: cleaning and standardizing the initially parsed Markdown text, specifically including standardizing spaces and line breaks, unifying terminology, and correcting encoding. Standardizing spaces and line breaks uses regular expressions (e.g., r"\n{3,}") to replace multiple consecutive line breaks with two, and consecutive spaces with one. Unifying terminology involves establishing an internal enterprise terminology dictionary (e.g., the technical terminology for CAN bus is CAN, CAN-BUS, or CANbus), traversing the text, and uniformly replacing synonyms listed in the dictionary with standard terms. Encoding correction addresses potential OCR errors during PDF parsing by using a confusion matrix (e.g., '0' and 'O', '1' and 'l') to correct common errors.

[0048] Step 103: Analyze each text block to determine the target fields and functional information corresponding to each text block.

[0049] The target field is used to specify the process condition type to which the corresponding text block belongs. This process condition type includes four categories: enabling condition, triggering condition, execution operation, and stop condition. Generally speaking, the complete execution logic of any function must cover the above four types of process conditions. For example, the enabling condition of the motor cooling function is "the equipment is in operation", the triggering condition is "motor temperature ≥ 80℃", the execution operation is "start the cooling fan and adjust the speed to medium-high", and the stop condition is "motor temperature ≤ 60℃".

[0050] In this step, the process of determining the target field corresponding to each text block is as follows: For each type of process condition, a corresponding sample text is pre-configured. For each type of process condition, based on the sample text corresponding to that process condition, the N text blocks with the highest similarity to it are retrieved from the set of text blocks to be processed, and the fields corresponding to these text blocks are assigned as the target fields corresponding to that process condition type.

[0051] The similarity calculation algorithm can employ commonly used text similarity algorithms such as cosine similarity and edit distance.

[0052] In this step, the steps to determine the functional information corresponding to each text block are as follows: based on the content of the text block, locate its position in the source document, and determine the functional information corresponding to the text block based on the chapter information corresponding to that position.

[0053] Step 104: For each type of functional information, generate structured data corresponding to the functional information based on the target text block and the target field corresponding to the target text block.

[0054] In this step, text blocks corresponding to the same functional information are aggregated to obtain a set of text blocks for each type of functional information. For each set of text blocks, the text blocks in the set are used as target text blocks, and based on these target text blocks and their corresponding target fields, they are filled into the CTS document template to obtain structured data. This structured data corresponds to the functional information of the set of text blocks.

[0055] In practice, the aforementioned structured data is represented in the form of a JSON tree, for example, json{ "chapter_id": "4.3", "chapter_title": "Brake Control Function", "requirements": [ { "req_id": "SYS-BRK-001", "description": "Vehicle deceleration request processing", "enabling_condition": "[Text extracted from section 4.3.1]", "trigger_condition": "[Text extracted from section 4.3.5]", "output": "[Text extracted from Table 4-5]", "stop_condition": "[Text extracted from section 4.3.8]", "source": "chassis_spec.pdf, P28" } ] } Step 105: Upon receiving functional query content related to the parts, perform a query in the structured data corresponding to each functional information based on the functional query content to obtain the target query result.

[0056] In this step, users can initiate relevant information queries based on the functions of the components and input the query content into the document generation system. After receiving the function query information, the document generation system matches it with structured data and uses the successfully matched structured data as the target query result.

[0057] Step 106: Generate the target document corresponding to the content queried by the function based on the target query results.

[0058] The target document is a CTS document.

[0059] In this step, the target document corresponding to the function query content is generated based on the target query results and the format specified by the user.

[0060] In this embodiment, multiple source documents with different formats are obtained. Each source document is divided according to a preset text segmentation rule to obtain at least one text block. Each text block is analyzed to determine the target field and functional information corresponding to it. The target field indicates the process condition type of the corresponding text block. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block and the target field corresponding to that target text block. When a functional query related to a component is received, a query is performed in the structured data corresponding to each functional information based on the functional query content to obtain the target query result. A target document corresponding to the functional query content is generated based on the target query result. In this embodiment, by processing multi-format source documents, structured data corresponding to functional information is generated. Then, according to the user's actual functional requirements, a query is performed in the structured data, and an adapted CTS document is automatically generated based on the query result. This avoids the problem of technicians querying SSTS documents and writing CTS documents, effectively improving the conversion efficiency of SSTS documents to CTS documents.

[0061] In this embodiment, the text vector corresponding to each text block is first determined, and all text vectors are combined to form a text vector set. Then, for each target field, matching is performed in the vector set based on its corresponding standard text to obtain a matching result. Finally, the target field corresponding to each text block is determined based on the text block and the matching result. It is evident that this application achieves automatic correspondence between text blocks and target fields through text vector semantic matching, improving matching accuracy and processing efficiency. Specific steps include: determining the text vector corresponding to each text block, and combining the text vectors of all text blocks to form a text vector set; for each target field, matching is performed in the text vector set based on the standard text corresponding to the target field to obtain a matching result for the target field; and determining the target field corresponding to each text block based on the text block corresponding to each text vector and the matching result for each target field.

[0062] The standard text mentioned above is an example text corresponding to the target field. For example, the example text for the triggering condition is "When XXX, XX", where XX is a general placeholder indicating that it is any text. When a text block is similar to the example text, the field corresponding to that text block is set to the field corresponding to the example text.

[0063] In this step, each text block is input into an embedding model (e.g., the Qwen3-Embedding-4B model) for vectorization. This model converts each text block into a high-dimensional vector (e.g., a 4096-dimensional vector), representing the semantic information of the corresponding text in numerical form, thus obtaining the text vector corresponding to each text block. The text vectors of all text blocks are then aggregated to form a text vector set. For each target field, its corresponding standard text is obtained and converted into a standard text vector. The similarity between each text vector in the text vector set and the standard text vector is calculated, and the text vectors with the highest similarity (a predetermined number) are selected as the matching results for that target field. Through the above method, the matching results for each target field are obtained. Finally, based on the correspondence between the text blocks, target fields, and matching results corresponding to each text vector, and the text vectors in each matching result, the target field corresponding to each text block is determined.

[0064] In this embodiment, the functional information of a text block is related to its position in the source document. Therefore, it is necessary to first determine the position information of the text block in the corresponding source document, and then determine the functional information corresponding to the text block based on the position information. The specific steps are as follows: for each text block, determine the position information of the text block in the corresponding source document; determine the functional information corresponding to the text block based on the chapter information corresponding to the position information.

[0065] In this step, for each text block, its position information in the corresponding source document, such as page number, paragraph, and chapter level, is determined; based on this position information, the chapter information to which the text block belongs is determined, and the chapter information is directly determined as the functional information corresponding to the text block, or keywords are extracted from the chapter information, and the extracted keywords are determined as the functional information corresponding to the text block.

[0066] In this embodiment, after obtaining structured data, the field content (the field content corresponding to the target field) in the structured data can be detected to see if it meets the requirements. If it does not meet the requirements, the structured data needs to be updated. The specific steps include: for each target field in the structured data, calling a pre-trained first language model to identify the field content corresponding to the target field and obtaining the identification result; if the identification result is the first identification result, updating the structured data according to the identification result.

[0067] The pre-trained first language model is a machine learning model, which can be an encoder model such as BERT, RoBERTa, LLaMA, or Qwen, or a generative large language model. This first language model can recognize the content of the input text to identify the content corresponding to each target field.

[0068] The identification results include all target fields and the content corresponding to each target field. A first identification result indicates that the content corresponding to other target fields has been identified, meaning the content of other target fields in the identification results is not empty. A second identification result indicates that no content corresponding to other target fields has been identified, meaning the content of other target fields in the identification results is empty. Here, "other target fields" refers to fields other than the target field corresponding to the identification result. For example, if the target field corresponding to the identification result is an enable condition field, then the other target fields would be trigger condition fields, execution operation fields, and stop condition fields.

[0069] In this step, for each target field in the structured data, the corresponding field content is obtained and input into a pre-trained first language model to recognize the field content and obtain a recognition result. The recognition result is then determined to be either a first recognition result or a second recognition result. If the recognition result is the first recognition result, the structured data is updated based on that result. If the recognition result is the second recognition result, the structured data is not updated based on that result.

[0070] For ease of distinction, this application refers to the target field corresponding to the recognition result as the first field, and the target fields other than the target field corresponding to the recognition result as the second field. The specific steps for updating the structured data based on the recognition result are as follows: update the field content corresponding to the first field in the corresponding structured data according to the field content corresponding to the first field in the recognition result. Alternatively, while updating the field content corresponding to the first field in the corresponding structured data according to the field content corresponding to the first field in the recognition result, the field content corresponding to the second field in the recognition result and the field content of the second field in the corresponding structured data can also be obtained, and these two field contents can be compared. The field content with more comprehensive content is retained, and then the structured data is updated based on the retained content.

[0071] In this embodiment, the target query result can be obtained by directly querying all structured data based on the function query content. To ensure the accuracy of the query results, the function query content can be divided first to obtain at least one keyword, and then the target query result can be obtained by querying all structured data based on the keyword. The specific steps include: dividing the function query content according to a preset keyword division rule to obtain at least one keyword; and querying the structured data corresponding to each function information based on the keyword to obtain the target query result.

[0072] The preset keyword segmentation rule is to use a preset keyword library to segment the content of the function query.

[0073] In the above process, the specific steps for querying the structured data corresponding to each functional information based on keywords to obtain the target query results are as follows: Each keyword can be matched with the content of each field in the structured data (this field content can be the content of all fields in the structured data, or it can specifically refer to the content of the target field), and the structured data with the most matching keywords is taken as the target query result. Other query methods can also be used; this is not limited here.

[0074] In this embodiment, the structured data includes not only the target field and its corresponding field content, but also functional information. When the functional query content includes only a single keyword, to facilitate rapid retrieval, the query is performed within all the functional information included in the structured data based on the functional query content to obtain the target query result. Therefore, this embodiment provides a data query method, such as... Figure 2 As shown, the specific steps include: Step 201: Generate structured data corresponding to the functional information based on the functional information, the target text block corresponding to the functional information, and the target field corresponding to each target text block.

[0075] In this step, the CTS document template also includes function fields and target fields. The corresponding function information is filled in according to the position indicated by the function field, and the corresponding target text block is filled in the corresponding position according to the target field, thereby generating structured data.

[0076] Step 202: According to the preset keyword segmentation rules, the function query content is segmented to obtain at least one keyword.

[0077] The preset keyword segmentation rule is to use a preset keyword library to segment the content of the function query.

[0078] Step 203: If there is only one keyword, search for the functional information included in all structured data based on that keyword to obtain the target query result.

[0079] In this step, if only one keyword exists, it indicates that the keyword is highly important. The similarity between this keyword and the functional information contained in each structured data point can be calculated to obtain the similarity score for each structured data point. When the similarity score for a structured data point is greater than a preset similarity score, that structured data point is selected as the target query result.

[0080] Step 204: If there are multiple keywords, query the structured data corresponding to each functional information according to the keyword to obtain the target query results.

[0081] In this step, if there are multiple keywords, the scope of the query can be expanded. If the keyword is too broad, it can be matched with the content of each field in the structured data (which can be all field content or the field content corresponding to the target field), and the structured data with the most matching keywords can be used as the target query result.

[0082] In this embodiment, when the function query content is long, it can be parsed and identified using a pre-trained language model to extract the field content corresponding to each target field. Based on this field content, a matching query is performed in the corresponding fields of the structured data. This reduces matching resource consumption while ensuring the accuracy of the query results. Therefore, this embodiment provides a data query method, such as... Figure 3 As shown, the specific steps include: Step 301: If the function query content is the first query content, call the pre-trained second language model to identify the first query content and obtain the second query content corresponding to each target field.

[0083] The first query content contains a relatively large number of characters. For example, when the number of characters corresponding to a function query content exceeds a preset number, that function query content is determined as the first query content. This pre-trained second language model is similar to the first language model described above, and will not be elaborated further here.

[0084] In this step, the number of characters in the function query content is checked. When the number of characters exceeds the preset number, the function query content is determined to be the first query content, which may include the field content corresponding to multiple target fields. In this case, the first query content can be input into a pre-trained second language model so that the pre-trained second language model can recognize the first query content and obtain the field content corresponding to each target field, which is the second query content corresponding to each target field.

[0085] Step 302: For each target field, query all structured data based on the target field and the corresponding second query content to obtain the query result corresponding to the target field.

[0086] The query results corresponding to the target field include at least one structured data.

[0087] In this step, for each target field, the field content corresponding to the target field is obtained from the structured data, and the similarity between the field content and the second query content is calculated. When the similarity is greater than the preset similarity, the structured data is used as the query result corresponding to the target field.

[0088] The aforementioned similarity can be at least one of cosine similarity, Pearson correlation coefficient, Euclidean distance, or Manhattan distance.

[0089] For example, when the target field is an enabling condition field and there is a second query content corresponding to the enabling condition field, for any structured data, the field content corresponding to the enabling condition field in the structured data is obtained, and then the similarity between the field content and the second query content is calculated. When the similarity is greater than the preset similarity, the structured data is used as the query result corresponding to the enabling condition field.

[0090] Step 303: Determine the target query result based on the query results corresponding to each target field.

[0091] In this step, the predefined structured data points that appear most frequently among all query results can be selected as the target query results. Alternatively, for each structured data point, the weight corresponding to the target field can be multiplied by the similarity calculated based on the target field to obtain the evaluation score for that target field. The evaluation scores for all target fields are then summed to obtain the total score for that structured data point. Finally, the predefined structured data points with the highest total score are selected as the target query results.

[0092] like Figure 4 As shown, this application embodiment provides a document generation apparatus, which corresponds to the method embodiment, and specifically includes: Acquisition unit 401 is used to acquire multiple source documents; The segmentation unit 402 is used to segment each source document according to a preset text segmentation rule to obtain at least one text block; Analysis unit 403 is used to analyze each text block and determine the target field and functional information corresponding to each text block. The target field is used to indicate the process condition type to which the corresponding text block belongs. The first generation unit 404 is used to generate structured data corresponding to each type of functional information based on the target text block corresponding to the functional information and the target field corresponding to the target text block. The query unit 405 is used to, when receiving functional query content related to a component, perform a query in the structured data corresponding to each functional information according to the functional query content, and obtain the target query result; The second generation unit 406 is used to generate the target document corresponding to the function query content based on the target query result.

[0093] Optionally, analysis unit 402 is used for: Determine the text vector corresponding to each text block, and combine the text vectors of all text blocks to form a text vector set; For each target field, a match is performed in the text vector set based on the standard text corresponding to the target field to obtain the matching result corresponding to the target field; Based on the text block corresponding to each text vector and the matching result corresponding to each target field, determine the target field corresponding to each text block.

[0094] Optionally, analysis unit 402 is used for: For each text block, determine the position information of the text block in the corresponding source document; Based on the chapter information corresponding to the location information, determine the functional information corresponding to the text block.

[0095] Optionally, after obtaining the structured data, the device further includes an update unit 407, the update unit 407 being configured to: For each target field in the structured data, a pre-trained first language model is invoked to identify the field content corresponding to the target field, and an identification result is obtained. The identification result includes all target fields and the field content corresponding to each target field. If the identification result is the first identification result, the structured data is updated according to the identification result.

[0096] Optionally, the first generating unit 404 is used for: Based on the functional information, the target text block corresponding to the functional information, and the target field corresponding to the target text block, structured data corresponding to the functional information is generated.

[0097] Optionally, query unit 405 is used for: According to the preset keyword segmentation rules, the function query content is segmented to obtain at least one keyword; If there is only one keyword, the target query result is obtained by querying the functional information included in all structured data based on the keyword. When there are multiple keywords, the system queries the structured data corresponding to each functional information based on the keywords to obtain the target query results.

[0098] Optionally, when the function query content is the first query content, the query unit 405 is used to: The pre-trained second language model is invoked to identify the first query content and obtain the second query content corresponding to each target field. For each target field, a query is performed in all structured data based on the target field and the corresponding second query content to obtain the query result corresponding to the target field; Determine the target query result based on the query results corresponding to each target field.

[0099] like Figure 5 As shown in the figure, this application embodiment provides a document generation device, including a processor 501, a communication interface 502, a memory 503, and a communication bus 504, wherein the processor 501, the communication interface 502, and the memory 503 communicate with each other through the communication bus 504. Memory 503 is used to store computer programs; In one embodiment of this application, when the processor 501 executes a program stored in the memory 503, it implements the document generation method provided in any of the foregoing method embodiments, including: Retrieve multiple source documents; According to the preset text segmentation rules, each source document is divided into at least one text block; Each text block is analyzed to determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block corresponding to the functional information and the target field corresponding to the target text block; Upon receiving a function query related to a component, the system queries the structured data corresponding to each function information to obtain the target query result. The target document corresponding to the function query content is generated based on the target query results.

[0100] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps performed by the document generation method provided in any of the foregoing method embodiments.

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

[0102] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented using software plus a general-purpose hardware platform, or of course, using hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, 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.

[0103] It should be understood that the terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms “a,” “an,” and “described” as used herein may also include the plural forms. The terms “comprising,” “including,” “containing,” and “having” are inclusive and therefore indicate the presence of the stated features, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not construed as requiring them to be performed in a particular order described or illustrated unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.

[0104] The above description is merely a specific embodiment of the present invention, enabling those skilled in the art to understand or implement the invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the invention. Therefore, the present invention is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A document generation method, characterized in that, The method includes: Retrieve multiple source documents; According to the preset text segmentation rules, each source document is divided into at least one text block; Each text block is analyzed to determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block corresponding to the functional information and the target field corresponding to the target text block; Upon receiving a function query related to a component, the system queries the structured data corresponding to each function information to obtain the target query result. The target document corresponding to the function query content is generated based on the target query results.

2. The method according to claim 1, characterized in that, Each text block is analyzed to determine the target fields corresponding to each text block, including: Determine the text vector corresponding to each text block, and combine the text vectors of all text blocks to form a text vector set; For each target field, a match is performed in the text vector set based on the standard text corresponding to the target field to obtain the matching result corresponding to the target field; Based on the text block corresponding to each text vector and the matching result corresponding to each target field, determine the target field corresponding to each text block.

3. The method according to claim 1, characterized in that, Each text block is analyzed to determine its corresponding functional information, including: For each text block, determine the position information of the text block in the corresponding source document; Based on the chapter information corresponding to the location information, determine the functional information corresponding to the text block.

4. The method according to claim 1, characterized in that, After obtaining the structured data, the method further includes: For each target field in the structured data, a pre-trained first language model is invoked to identify the field content corresponding to the target field, and an identification result is obtained. The identification result includes all target fields and the field content corresponding to each target field. If the identification result is the first identification result, the structured data is updated according to the identification result.

5. The method according to claim 1, characterized in that, Based on the target text block corresponding to the functional information and the target field corresponding to the target text block, structured data corresponding to the functional information is generated, including: Based on the functional information, the target text block corresponding to the functional information, and the target field corresponding to the target text block, structured data corresponding to the functional information is generated.

6. The method according to claim 5, characterized in that, Based on the function query content, a query is performed in the structured data corresponding to each function information to obtain the target query results, including: According to the preset keyword segmentation rules, the function query content is segmented to obtain at least one keyword; If there is only one keyword, the target query result is obtained by querying the functional information included in all structured data based on the keyword. When there are multiple keywords, the system queries the structured data corresponding to each functional information based on the keywords to obtain the target query results.

7. The method according to claim 1, characterized in that, When the function query content is the first query content, the system queries the structured data corresponding to each function information according to the function query content to obtain the target query results, including: The pre-trained second language model is invoked to identify the first query content and obtain the second query content corresponding to each target field. For each target field, a query is performed in all structured data based on the target field and the corresponding second query content to obtain the query result corresponding to the target field; Determine the target query result based on the query results corresponding to each target field.

8. A document generation device, characterized in that, The device includes: The acquisition unit is used to acquire multiple source documents; A segmentation unit is used to divide each source document into at least one text block according to a preset text segmentation rule. The analysis unit is used to analyze each text block and determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. The first generation unit is used to generate structured data corresponding to each type of functional information based on the target text block corresponding to the functional information and the target field corresponding to the target text block. The query unit is used to, upon receiving functional query content related to components, perform a query in the structured data corresponding to each functional information based on the functional query content to obtain the target query result; The second generation unit is used to generate the target document corresponding to the function query content based on the target query result.

9. A document generation device, characterized in that, include: At least one communication interface; At least one bus connected to the at least one communication interface; at least one processor connected to the at least one bus; At least one memory connected to the at least one bus, wherein the processor is configured to: Retrieve multiple source documents; According to the preset text segmentation rules, each source document is divided into at least one text block; Each text block is analyzed to determine the target fields and functional information corresponding to each text block. The target fields are used to indicate the process condition type to which the corresponding text block belongs. For each type of functional information, structured data corresponding to the functional information is generated based on the target text block corresponding to the functional information and the target field corresponding to the target text block; Upon receiving a function query related to a component, the system queries the structured data corresponding to each function information to obtain the target query result. The target document corresponding to the function query content is generated based on the target query results.

10. A 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 according to any one of claims 1 to 7.