Report generation method and apparatus, electronic device, and storage medium
By identifying and constructing structured data, this method addresses the problem of insufficient automated processing capabilities for unstructured data in existing technologies. It achieves fully automated conversion from raw inputs of various types of elements to standardized reports, improving efficiency and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE GROUP DESIGN INST
- Filing Date
- 2026-01-13
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, report generation tools lack the ability to automate the processing of unstructured or semi-structured raw data, making them difficult to apply directly to real and complex business data. They require that the input information be pre-organized and highly structured data.
By identifying document elements of various element types, the system employs corresponding information extraction strategies to extract content and attribute information, determines the relationships between elements, constructs structured data, and generates report content by combining a professional knowledge base and a template.
It achieves fully automated transformation from raw input of various types of elements to standardized, directly usable final reports, significantly improving the efficiency, accuracy, and practicality of processing complex business data.
Smart Images

Figure CN122113883A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text processing technology, and in particular to a report generation method, apparatus, electronic device, and storage medium. Background Technology
[0002] In technology-intensive fields such as data centers and building engineering, preparing feasibility study reports is a routine but crucial task. These reports require the integration of data from various sources, including project surveys, equipment selection, and financial calculations. This data is often presented in different formats such as presentations, spreadsheets, and text documents. Traditionally, the writing of these reports relied entirely on manual work by domain experts, a tedious, time-consuming, and error-prone process.
[0003] Currently, some technologies have attempted to automate this process, such as using template-based document generation tools. These tools typically allow users to predefine report templates and then manually or through simple scripts fill in the prepared data into the corresponding locations in the template, thereby generating a document with a fixed format.
[0004] However, the relevant technical solutions require that the input information must be pre-organized and highly structured data. They cannot directly understand and process the original unstructured or semi-structured source files containing complex layouts and mixed content (such as text, tables, and images). Therefore, the degree of automation is low and it is difficult to apply them directly to real and complex business data. Summary of the Invention
[0005] This application provides a report generation method, apparatus, electronic device, and storage medium to solve the problem in related technologies that the input information must be pre-organized, highly structured data, which has a low degree of automation and is difficult to apply directly to real and complex business data.
[0006] Firstly, this application provides a report generation method, including: Retrieves document elements of various element types from the input file; For document elements of each element type, an information extraction strategy corresponding to the element type is adopted to obtain the content information and attribute information of the document element. Based on the attribute information of each document element, the association relationship between each document element is determined; Based on the content information, the attribute information, and the relationships between document elements, structured data is constructed; Based on a predefined professional knowledge base and report generation template, the structured data is processed to generate report content data; A report document is generated based on the data in the report.
[0007] In one possible implementation, obtaining document elements of multiple element types from the input file includes: Identify the format type of the input file; Determine the document parsing strategy based on the format type; The document parsing strategy is used to parse the input file to identify the individual document elements that make up the input file.
[0008] In one possible implementation, for each type of document element, an information extraction strategy corresponding to that element type is used to obtain the content information and attribute information of the document element, including: When the element type is a table, the internal data structure of the document element is parsed to extract the cell content and cell merging information as the content information, and the position information of the document element in the input file is extracted as the attribute information. When the element type is an image, the text contained in the document element is extracted as content information using optical character recognition technology, and the position information of the document element in the input file is recorded as attribute information. When the element type is text, the string of the document element is extracted as content information, and the visual style information of the document element and the position information of the document element in the input file are extracted as attribute information.
[0009] In one possible implementation, determining the association between document elements based on the attribute information of each document element includes: Calculate the spatial relationships between document elements based on their position information; Based on the visual style information of text-type document elements, determine the logical hierarchy between each text-type document element; Based on the spatial relationships and logical hierarchical relationships, a relationship is constructed that represents the structural and reading order among document elements.
[0010] In one possible implementation, constructing structured data based on the content information, the attribute information, and the relationships between document elements includes: A data node is created for each document element, and the content information, attribute information and element type identifier of the corresponding document element are stored in each data node; For each data node, based on the relationships between document elements, determine and record the parent node reference relationship and child node reference relationship of the document element corresponding to the data node; All the data nodes are associated and integrated to form the structured data.
[0011] In one possible implementation, the report content data includes calculated and populated data; the process of processing the structured data based on a predefined professional knowledge base and a report generation template to generate the report content data includes: Based on the report generation template, identify multiple target fields in the report text that need to be filled with the calculation results; For each target field, retrieve the input parameters that are semantically associated with the target field from the structured data; Match the predefined calculation rules corresponding to the target field from the professional knowledge base; The predefined calculation rules are executed based on the input parameters to obtain the calculation results; The calculation result is written as the filling content into the target field to obtain the calculated filling data.
[0012] In one possible implementation, the professional knowledge base further includes multiple pre-configured candidate technical solutions, the report content data further includes solution recommendation text, and the method further includes: Based on the calculation results, key evaluation indicators are generated; Based on the key evaluation indicators, a multi-dimensional comprehensive evaluation of multiple candidate technical solutions is conducted to obtain a comprehensive score. The recommended solution is determined from the multiple candidate technical solutions based on the comprehensive score; Based on the description of the recommended scheme and the analysis of the key evaluation indicators, the recommended scheme text is generated.
[0013] Secondly, this application provides a report generation apparatus, comprising: The first acquisition module is used to acquire document elements of various element types from the input file; The second acquisition module is used to acquire the content information and attribute information of the document element for each type of document element by adopting an information extraction strategy corresponding to the element type. The determination module is used to determine the association relationship between document elements based on the attribute information of each document element; The construction module is used to construct structured data based on the content information, the attribute information, and the relationships between document elements; The processing module is used to process the structured data based on a predefined professional knowledge base and report generation template to generate report content data; The generation module is used to generate a report document based on the report content data.
[0014] In one possible implementation, the first acquisition module is specifically used for: Identify the format type of the input file; Determine the document parsing strategy based on the format type; The document parsing strategy is used to parse the input file to identify the individual document elements that make up the input file.
[0015] In one possible implementation, the second acquisition module is specifically used for: When the element type is a table, the internal data structure of the document element is parsed to extract the cell content and cell merging information as the content information, and the position information of the document element in the input file is extracted as the attribute information. When the element type is an image, the text contained in the document element is extracted as content information using optical character recognition technology, and the position information of the document element in the input file is recorded as attribute information. When the element type is text, the string of the document element is extracted as content information, and the visual style information of the document element and the position information of the document element in the input file are extracted as attribute information.
[0016] In one possible implementation, the determining module is specifically used for: Calculate the spatial relationships between document elements based on their position information; Based on the visual style information of text-type document elements, determine the logical hierarchy between each text-type document element; Based on the spatial relationships and logical hierarchical relationships, a relationship is constructed that represents the structural and reading order among document elements.
[0017] In one possible implementation, the building module is specifically used for: A data node is created for each document element, and the content information, attribute information and element type identifier of the corresponding document element are stored in each data node; For each data node, based on the relationships between document elements, determine and record the parent node reference relationship and child node reference relationship of the document element corresponding to the data node; All the data nodes are associated and integrated to form the structured data.
[0018] In one possible implementation, the report content data includes calculated and populated data; the processing module is specifically used for: Based on the report generation template, identify multiple target fields in the report text that need to be filled with the calculation results; For each target field, retrieve the input parameters that are semantically associated with the target field from the structured data; Match the predefined calculation rules corresponding to the target field from the professional knowledge base; The predefined calculation rules are executed based on the input parameters to obtain the calculation results; The calculation result is written as the filling content into the target field to obtain the calculated filling data.
[0019] In one possible implementation, the professional knowledge base further includes multiple pre-configured candidate technical solutions, the report content data further includes solution recommendation text, and the processing module is further configured to: Based on the calculation results, key evaluation indicators are generated; Based on the key evaluation indicators, a multi-dimensional comprehensive evaluation of multiple candidate technical solutions is conducted to obtain a comprehensive score. The recommended solution is determined from the multiple candidate technical solutions based on the comprehensive score; Based on the description of the recommended scheme and the analysis of the key evaluation indicators, the recommended scheme text is generated.
[0020] Thirdly, this application provides an electronic device, including: a processor and a memory, wherein the processor is configured to execute a report generation program stored in the memory to implement the report generation method described in any one of the first aspects.
[0021] Fourthly, this application provides a storage medium storing one or more programs that can be executed by one or more processors to implement the report generation method described in any one aspect.
[0022] Compared with the prior art, the technical solution provided in this application has the following advantages: The method provided in this application first identifies document elements of various types to achieve a preliminary analysis of the internal structure of the source file. Then, it adopts corresponding information extraction strategies for different types of document elements to extract their content and attribute information, thereby overcoming the problem of mixed content and difficulty in unified extraction in the original data. Based on this, it determines the relationships between document elements based on the extracted attribute information, and constructs structured data by combining content information, attribute information, and relationships, transforming the unstructured original content into a structured form that can be deeply processed by machines. Finally, it processes the structured data and generates a report document. Thus, it achieves fully automated conversion from raw input containing multiple types of elements to a standardized, directly usable final report, significantly improving the efficiency, accuracy, and practicality of processing complex business data. Attached Figure Description
[0023] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0024] To more clearly illustrate the technical solutions in the embodiments of this application 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.
[0025] 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.
[0026] Figure 1 A flowchart illustrating an embodiment of a report generation method provided in this application; Figure 2 A flowchart illustrating an embodiment of another report generation method provided in this application; Figure 3 A flowchart illustrating another embodiment of the report generation method provided in this application; Figure 4 A flowchart illustrating another embodiment of the report generation method provided in this application; Figure 5 This is a flowchart illustrating the overall process from multiple input sources to the generation of the final report. Figure 6 A block diagram illustrating an embodiment of a report generation apparatus provided in this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] 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.
[0028] The following disclosure provides numerous different embodiments or examples for implementing various structures of this application. 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 this application. 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.
[0029] To address the technical problem that existing technologies require pre-organized, highly structured data as input, resulting in low automation and difficulty in directly applying it to real and complex business data, this application provides a report generation method that automates the entire process from raw input containing various types of elements to a standardized, directly usable final report, significantly improving the efficiency, accuracy, and practicality of processing complex business data.
[0030] Figure 1 This is a flowchart illustrating an embodiment of a report generation method provided in this application. Figure 1 As shown, the method includes the following steps: Step 101: Obtain document elements of various element types from the input file.
[0031] Input files: These refer to the data source files used to generate the report. They come in various formats, including but not limited to presentations, spreadsheets, and text documents.
[0032] Document element: refers to the smallest processable unit with independent content and / or attributes identified by parsing an input file. Its specific form varies depending on the file format. For example, in a presentation, it is a shape within a slide (such as a text box or chart box); in a spreadsheet, it is a cell or a defined area; and in a text document, it is a paragraph or a text area with a specific style.
[0033] Element type: refers to the classification of document elements according to their form, function and role in professional documents, such as headings, body text, lists, tables, images, native charts, etc.
[0034] In this embodiment, after receiving an input file, the system first parses it to identify the individual document elements that constitute the file. This process includes understanding the overall structure of the file and locating and initially classifying the discrete content units within it. Based on a predefined classification system, the system assigns an element type identifier to each identified document element. This step completes the transformation from the original composite file to a series of classified, discrete information objects, providing a foundation for subsequent differentiated processing based on type.
[0035] Step 102: For document elements of each element type, adopt the information extraction strategy corresponding to the element type to obtain the content information and attribute information of the document element.
[0036] Information extraction strategy: refers to a set of differentiated processing rules or technical means based on the element type, used to obtain its specific content and characteristics.
[0037] Content information: refers to the substantive data or semantic content carried by document elements.
[0038] Attribute information: refers to characteristic information that describes how document elements are presented, their spatial location, or their intrinsic metadata.
[0039] In this embodiment, for the document elements identified and classified in step 101, the system selects and executes corresponding information extraction strategies based on their element types. This strategy aims to accurately extract two types of key information from the elements: first, their content information, i.e., the main data contained within the element; and second, their attribute information, i.e., the feature data describing how the element is presented or where it is located. Different types of elements have different content and attribute compositions, therefore requiring different technical means or parsing rules for extraction. This step ensures that the substantive content and key features of various elements are effectively transformed into structured, computable data forms.
[0040] Step 103: Determine the association between document elements based on the attribute information of each document element.
[0041] Association: refers to the organization, connection or subordinate relationship between multiple document elements in terms of logical hierarchy, semantic association or spatial layout, such as parent-child relationship or sequence relationship.
[0042] In this embodiment, the system comprehensively utilizes attribute information extracted from all document elements, and infers and establishes the relationships between these elements through calculation, comparison, or application of predefined rules. These relationships aim to reflect the inherent organizational logic of the components in the original document, such as hierarchical structure, reading order, citation relationships, or spatial layout connections. Through this step, scattered elements are associated into a network or topology that reflects the overall logic of the original document.
[0043] Step 104: Construct structured data based on the content information, the attribute information, and the relationships between document elements.
[0044] Structured data refers to data that encodes and organizes information and its relationships in a unified, explicit, machine-readable format (such as JSON objects).
[0045] In this embodiment, the system integrates and encodes the content information, attribute information, and relationships obtained in the preceding steps to construct a unified structured data. This structured data organizes information in a clear format (such as a graph or tree composed of interconnected data nodes), enabling the content, attributes, and relationships of each document element with other elements to be clearly represented and accessed. The output of this step is a semantically and structurally rich information model, providing a high-quality data foundation for subsequent knowledge-based automated processing.
[0046] Step 105: Based on the predefined professional knowledge base and report generation template, process the structured data to generate report content data.
[0047] Professional knowledge base: refers to a pre-generated and stored structured collection containing knowledge rules for a specific domain, such as the formula library (which has compiled more than 500 power supply professional formulas) and the solution library (which has multiple pre-set standardized equipment configuration solutions) in the data center feasibility study report.
[0048] Report generation template: refers to a predefined framework that specifies the chapter structure and content requirements (including placeholders for data to be filled) of the target report.
[0049] Report content data: refers to the core materials of the report that have been filled with specific calculation data, solution conclusions and descriptive text, and meet the requirements of the template chapters.
[0050] In this embodiment, the system processes the structured data generated in step 104 based on the structure and requirements defined in the report generation template and in conjunction with domain knowledge stored in the professional knowledge base. This processing may include, but is not limited to: locating the content to be generated or filled according to the template; querying, filtering, or deriving the required information from the structured data; calling rules or models from the professional knowledge base for calculation, judgment, or decision-making; and organizing the results into coherent content according to the template specifications. The output of this step is report content data that conforms to the domain requirements and template specifications.
[0051] Step 106: Generate a report document based on the report content data.
[0052] Report document: refers to the final output, complete report document that is available for review and delivery.
[0053] In this embodiment, the system performs necessary post-processing and format conversion on the report content data to generate the final report document. Post-processing may include text polishing, format adjustment, and consistency verification, aiming to improve the readability and professionalism of the report. Format conversion is responsible for rendering the content data into a specific file format. This step delivers a directly usable automated generation result.
[0054] The technical solution provided in this application first achieves a preliminary analysis of the internal structure of the source file by identifying document elements of various types. Then, it employs corresponding information extraction strategies for different types of document elements to extract their content and attribute information, thereby overcoming the challenge of uniformly extracting mixed content from the original data. Based on this, it determines the relationships between document elements using the extracted attribute information, and constructs structured data by combining content information, attribute information, and relationships, transforming the unstructured original content into a structured form that can be deeply processed by machines. Finally, it processes this structured data and generates a report document. Thus, it achieves fully automated conversion from raw input containing multiple types of elements to a standardized, directly usable final report, significantly improving the efficiency, accuracy, and practicality of processing complex business data.
[0055] Figure 2 A flowchart illustrating an embodiment of another report generation method provided in this application. Figure 2 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 201: Identify the format type of the input file.
[0056] Format type: refers to the document category to which the input file belongs based on its file extension, internal data structure, or specific identifier.
[0057] In this embodiment, after receiving an uploaded file, the system performs automated format recognition. Specifically, a preliminary judgment can be made by parsing the file extension (e.g., ".pptx", ".xlsx", ".docx"). To ensure accuracy, further verification can be performed by reading and analyzing specific header byte sequences or internal structure identifiers of the file. For example, the file can be identified as belonging to a major category such as "presentation format", "spreadsheet format", or "text document format". This recognition result serves as the entry point and key basis for all subsequent differentiated processing logic, ensuring that the system can correctly call the parsing tools and methods that match the format characteristics.
[0058] Step 202: Determine the document parsing strategy based on the format type.
[0059] Document parsing strategy: refers to a complete processing scheme pre-configured for a specific format type, used to deeply read, deconstruct and access the internal data and organizational structure of the file in that format. It includes the selected parsing library, access interface and corresponding parsing process.
[0060] In this embodiment, the system maintains an internal mapping table between format types and parsing strategies. Based on the specific format type identified in step 201, the system retrieves and determines the corresponding parsing strategy from this mapping table. For example, when the format type is "presentation format" (e.g., .pptx), the determined parsing strategy is "to use the python-pptx library to parse its native Extensible Markup Language structure." This strategy aims to directly obtain shape, text, chart data, and position information by accessing the XML within the slide package. When the format type is "spreadsheet format" (e.g., .xlsx), the determined parsing strategy is "to use the python-pandas library for intelligent table area recognition, or to use the openpyxl library to traverse cells." When the format type is "text document format" (e.g., .docx), the determined parsing strategy is "to use the corresponding library (e.g., python-docx) to extract all content and retain its original paragraph, heading, list, and other formatting information." This step enables intelligent switching of the processing engine.
[0061] Step 203: Use the document parsing strategy to parse the input file to identify the various document elements that constitute the input file.
[0062] In this embodiment, the system loads and fully executes the document parsing strategy determined in step 202 to perform deep parsing of the input file. Specifically: for presentation files using the "python-pptx parsing" strategy, the system unzips the .pptx file package, traverses files such as "slide*.xml" within it, parses Extensible Markup Language nodes, and thus identifies each independent "shape." These shapes are identified as different types of document elements, such as text, tables, images, or charts, based on their content or attributes. For spreadsheet files using the "pandas or openpyxl parsing" strategy, the strategy either intelligently locates the table area by analyzing the cell data type and positional relationship, or directly traverses all non-empty cells and their ranges, treating each identified coherent data area (or the entire worksheet) as a document element (especially a table element). For text documents, the parsing strategy traverses according to the document object model, identifying each paragraph, heading block, and list item with independent style or semantics as an independent document element. In this way, files of different formats are uniformly deconstructed into a set of "document elements" that carry preliminary type and location information parsed from their original format, providing direct input for subsequent unified and typified fine information extraction.
[0063] Figure 2The process described above, through a progressive approach of identifying format types, mapping parsing strategies, and performing deep parsing, enables the system to automatically adapt to and accurately interpret input files with different structures (such as PPT, Excel, and Word), reliably identifying the basic units (document elements) that make up the file. This effectively solves the technical obstacle of existing template-based automation tools, which struggle to directly process raw business data due to their inability to understand the internal structure of multi-format files. It provides standardized, high-quality element input for subsequent processes, serving as a key foundation for achieving full-process automation.
[0064] In one embodiment, to achieve targeted information extraction, step 102 performs the following operations based on different element types: when the element type is a table, the internal data structure of the document element is parsed to extract cell content and cell merging information as the content information, and the position information of the document element in the input file is extracted as the attribute information; when the element type is an image, the text contained in the document element is extracted using optical character recognition technology as the content information, and the position information of the document element in the input file is recorded as the attribute information; when the element type is text, the string of the document element is extracted as the content information, and the visual style information of the document element and the position information of the document element in the input file are extracted as the attribute information.
[0065] Internal data structure: refers to the inherent way document elements store and organize data in their original file format. Examples include Extensible Markup Language (XML) nodes in tables in presentations, and "cell merging information," which refers to the row and column span data recorded in a single cell spanning multiple rows or columns in a table. Optical Character Recognition (OCR): a technology that converts text images in pictures into machine-coded text. Visual style information: refers to the formatting attributes used by text elements when they are presented, such as font, font size, color, bold, italics, alignment, and indentation.
[0066] In this embodiment, for document elements identified as "table" type, the text content of each cell and the information indicating the row and column spans of merged cells are accurately extracted by parsing their internal data structure (such as XML in a PPTX file) as core content information. Simultaneously, the coordinate position of the table on the page is obtained as attribute information. For "image" type elements, the optical character recognition engine is called to process the image, extracting all the text contained within as content information, and its position coordinates are also recorded as attribute information. For "text" type elements, their string is directly read as content information, and their visual style information (such as font, font size, and alignment) and position coordinates are comprehensively extracted, together serving as attribute information describing their presentation characteristics.
[0067] This solution employs differentiated information extraction strategies targeting three core element types: tables, images, and text. It accurately captures the complex structural data of tables, hidden text in images, and the formatting and positional features of text. This effectively solves the technical challenges of heterogeneous data types, high structural complexity, and diverse information carriers encountered when uniformly extracting information from mixed content. It lays a solid and reliable data foundation for subsequently building high-quality structured data and achieving accurate data-report linkage, significantly improving the accuracy, completeness, and automation of information extraction.
[0068] Based on the element attribute information extracted through the differentiation strategy, step 103 may specifically include the following steps: calculating the spatial relationship between document elements based on the position information of each document element; determining the logical hierarchy relationship between text-type document elements based on the visual style information of text-type document elements; and constructing an association relationship representing the structure and reading order between document elements based on the spatial relationship and the logical hierarchy relationship.
[0069] Spatial relationships: These refer to the relative positional relationships calculated based on the coordinates of document elements (such as bounding boxes), including containment, adjacency, and vertical order. Logical hierarchical relationships: These refer to the semantic organizational relationships inferred from the formatting characteristics of text elements, such as the subordination between headings and body text, or the parent-child relationship in a list. Structure and reading order: Here, it refers to the overall organizational framework formed by document elements and its linear order that conforms to human reading habits.
[0070] In this embodiment, the system first uses positional information (usually bounding box coordinates) extracted from all document elements to analyze the relative layout between elements through geometric calculations. For example, it determines whether an image is below a paragraph of text or whether a text box completely contains another, thereby calculating the spatial relationships that characterize their physical layout. Secondly, specifically for text elements, the system analyzes their visual style information (e.g., extra-large centered fonts may identify headings, indentation and bullet points may identify list items) and applies predefined rules (e.g., "text elements located at the top of the slide, with a font size greater than 32 points, and aligned centered or left-aligned, are identified as first-level headings") to infer their logical hierarchical relationships. Finally, the system integrates the above spatial and logical hierarchical relationships to construct a unified relational network. This network not only records parent-child references between elements (e.g., parent / children fields) but also characterizes the reading flow of the entire document. For example, it determines that the body paragraphs following the headings should be read before reading the adjacent tables. This process is essentially "hierarchical reconstruction based on bounding boxes and parent-child relationships."
[0071] This embodiment uses a progressive method that first calculates the spatial layout, then infers the semantic hierarchy, and finally integrates and constructs the relationships. This method restores the hierarchical structure and reading order of elements such as titles, paragraphs, and lists from the original file without clear structural labels. This allows the structured data constructed subsequently to fully preserve and accurately reflect the semantic organization and visual layout of the original document, providing a crucial structured foundation for generating logically coherent and accurately cited reports.
[0072] Figure 3 A flowchart illustrating another embodiment of a report generation method provided in this application. Figure 3 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 301: Create a data node for each document element, and store the content information, attribute information and element type identifier of the corresponding document element in each data node.
[0073] Data node: refers to a data structure unit created in memory or storage, used to centrally store all information related to a document element.
[0074] Element type identifier: refers to a label or code used to uniquely distinguish different element types (such as "heading", "table", "image").
[0075] In this embodiment, the system instantiates an independent data node for each document element identified in step 101. Within this data node, the system encapsulates and stores the element's content information (such as text strings and table cell data), attribute information (such as coordinates and font styles), and element type identifier (such as "title" or "table") extracted in step 102. For example, for a table element, its node may store unique fields such as rows, cols, and cells; for an image element, the node may store text extracted through optical character recognition. This step encapsulates scattered information into self-contained information packages with type semantics.
[0076] Step 302: For each data node, determine and record the parent node reference relationship and child node reference relationship of the document element corresponding to the data node based on the relationship between the document elements.
[0077] Parent node reference relationship: refers to the link or identifier recorded in the current data node that points to the data node corresponding to its logical or layout parent element.
[0078] Child node reference relationship: refers to the list of links or identifiers recorded in the current data node that point to the data nodes corresponding to its logical or layout child elements.
[0079] In this embodiment, the system traverses each data node and, based on the relationships (such as parent-child hierarchy and adjacent order) determined in step 103, establishes links in the node network for the document element represented by the current node. Specifically, the system parses the relationships; if the current element is a child element of another element, the node identifier (such as a unique ID) of its parent element is recorded in the parent field of the current node; conversely, if the current element contains child elements, the list of node identifiers of all its child elements is recorded in the children field of the current node. For example, the children field of a "section title" node will reference multiple "paragraph" nodes under it; the parent field of an "image" node will reference its "description text box" node. This step establishes a bidirectional reference link between independent nodes based on logical relationships.
[0080] Step 303: Connect and integrate all the data nodes to form the structured data.
[0081] Association integration: refers to the process of connecting and organizing independent data nodes through the reference relationships recorded between them to form a unified and interconnected data whole.
[0082] Structured data: Specifically refers to a data set formed in the above manner, consisting of interconnected data nodes, that can fully express the content, attributes, and logical relationships of the original document.
[0083] In this embodiment, the system performs an association and integration operation, assembling all data nodes created in step 301 as a whole. Each node's logical connections to other nodes are clearly defined by the `parent` (parent node reference) and `children` (child node reference list) fields recorded in step 302. Based on these reference relationships, the system weaves all nodes into a coherent network or tree-like topology, i.e., structured data. This structure fully preserves the hierarchy, order, and spatial relationships parsed from the original document.
[0084] This structured data can be physically instantiated using a hierarchical, generic data exchange format (such as JSON). For example, its top level could be a root object representing the entire document, containing a `slides` array (corresponding to the slides in a presentation; for other file formats, this could be `pages` or `sheets`). Each array item (representing a page) contains an `elements` array, whose members are the corresponding data node objects. Each node object encapsulates all the information of a document element, with typical fields including: a unique identifier (ID), element type (category), position bounding box (bbox), content hash (contentHash), parent node identifier (parent), and a list of child node identifiers (children).
[0085] Figure 3 The process illustrated, by creating data nodes that encapsulate complete information and establishing bidirectional references between nodes based on logical relationships, ultimately integrates them into a unified graph-like data structure, successfully simulating and solidifying the complex internal logic of the original document. This solves the core problems of isolated information, obscure relationships, and difficulty in programmatic utilization in original data. The generated structured data not only completely preserves the original information but also clarifies the semantic relationships between information, providing a high-quality, directly operable data foundation for subsequent knowledge-based automated processing (such as precise retrieval, intelligent computing, and report generation), which is key to achieving intelligent document understanding and generation.
[0086] Figure 4 A flowchart illustrating another embodiment of the report generation method provided in this application. Figure 4 The process shown is in Figure 1 Based on the illustrated process, the following steps are included: Step 401: Based on the report generation template, identify multiple target fields in the report text for which calculation results need to be filled.
[0087] Report generation template: refers to a predefined document blueprint that specifies the report's chapter structure, content framework, and includes specific placeholders.
[0088] Target field: refers to the blank space or placeholder marked in the report generation template where specific calculation data or conclusions need to be filled in, such as "---kW", "---within", etc. in the text.
[0089] In this embodiment, the system loads a predefined report generation template (such as a "Data Center Feasibility Study Report Template"). This template not only defines the title and chapters but also clearly marks the locations in the text where specific calculated values need to be referenced; these locations are the target fields. The system parses the template and locates all such target fields by recognizing specific markup syntax (such as variable names enclosed in double curly braces {{}}), regular expression matching, or natural language processing techniques. For example, it identifies the placeholders in the statements "Total IT load is approximately ___ kW" and "PUE value controlled within ___" in the template as two independent target fields that need to be filled.
[0090] Step 402: For each target field, retrieve the input parameters that are semantically associated with the target field from the structured data.
[0091] Semantic relevance: This refers to the fact that the business meaning or context expressed by the target field has a matching or mapping relationship with the meaning represented by a certain part of the information in the structured data.
[0092] Input parameters: These refer to the raw data values required to perform the calculations. These values are derived from the structured data that has already been constructed.
[0093] In this embodiment, for each identified target field, the system analyzes its contextual semantics (such as field description and adjacent keywords). Based on this semantics, the system queries and retrieves data from the structured data constructed in step 104. For example, for the target field "total IT load is approximately ___kW", the system determines through semantic understanding that it requires two input parameters: "single rack power consumption" and "total number of racks". Subsequently, the system locates the nodes storing these parameter values in the node network of the structured data (e.g., extracting them from the tabular data nodes corresponding to the "device parameter table"), and retrieves the specific values as input parameters. This step establishes a semantic bridge between the reporting requirements and the original data source.
[0094] Furthermore, during the search, the most suitable input parameters can be selected and determined by combining the specific business requirement rules followed by the current report (such as "using data from the first phase of the project" or "prioritizing the latest measured values"). For example, if both "design power consumption" and "operating power consumption" exist, and the business requirement is "compiling a planning report," then "design power consumption" should be selected as the input parameter.
[0095] Step 403: Match the predefined calculation rules corresponding to the target field from the professional knowledge base.
[0096] Predefined computation rules: These are executable knowledge units that are pre-structured and stored in a professional knowledge base, encapsulating computational logic or business rules specific to a particular domain. Each rule is associated with a set of structured attributes for identification, invocation, and execution, including but not limited to: a unique formula identifier (formula_id), formula name, mathematical expression or logical definition (expression), a list of keywords used to trigger matching (trigger_keywords), a list of input parameter fields required to perform the computation (input_fields), and the output field corresponding to the computation result (output_field).
[0097] In this embodiment, the system analyzes the semantic context and extracts key features for each target field identified in step 401. Subsequently, the system performs retrieval and matching in the formula library of the professional knowledge base. The matching process mainly compares the semantic features of the target field with the trigger_keywords of each predefined calculation rule. When multiple candidate rules are found to be matching (for example, for the "total investment" field, both "item summation" and "unit cost estimation" rules may be matched simultaneously), the system does not select randomly but introduces predefined business requirement rules as the decision-making basis. Based on the current report's business scenario or preferences (such as "precision priority" or "using standard algorithms"), the system evaluates and optimizes the candidate rules, ultimately determining the predefined calculation rule that best fits the business objective. For example, in a planning report, the rule with formula_id F002 and name "Total Investment Calculation Based on Item Summation" may be selected as the final matching result. This step ensures the intelligence and business adaptability of the calculation logic selection, rather than simply keyword matching.
[0098] Step 404: Execute the predefined calculation rules based on the input parameters to obtain the calculation results.
[0099] In this embodiment, the system obtains the specific values of the input parameters determined in step 402 according to the business requirement rules, and substitutes them into the mathematical expressions or logic defined by the selected target predefined calculation rules in step 403 for calculation. This step transforms the raw data that conforms to the business background into calculation results with clear business significance through the selected domain knowledge model.
[0100] Step 405: Write the calculation result as the filling content into the target field to obtain the calculated filling data.
[0101] Calculated and populated data: This refers to the complete report text content formed after all target fields are filled with their corresponding calculation results.
[0102] In this embodiment, the system uses the calculation result obtained in step 404 as the specific filling content and backfills it into the location of the original target field identified in step 401 (i.e., the placeholder in the template). Once all target fields have been filled with their corresponding calculation results generated by business requirement rules, this text block containing complete, accurate, and business-oriented calculation content constitutes the calculation filling data.
[0103] Figure 4 The process shown automatically identifies the data entry requirements through templates, intelligently retrieves input data and matches calculation rules based on business rules, and automatically performs calculations and backfilling. This ensures the accuracy, consistency, and business relevance of the core data in the generated report, effectively replacing the tedious and error-prone process of manually searching for, calculating, and filling in data, and significantly improving the efficiency and reliability of report generation.
[0104] Furthermore, in another embodiment, the professional knowledge base also includes a plurality of pre-configured candidate technical solutions, and the report content data further includes solution recommendation text. The method may further include the following steps: generating key evaluation indicators based on the calculation results; performing multi-dimensional comprehensive evaluation on the plurality of candidate technical solutions according to the key evaluation indicators to obtain a comprehensive score; determining a recommended solution from the plurality of candidate technical solutions according to the comprehensive score; and generating the solution recommendation text according to the description information of the recommended solution and the analysis content of the key evaluation indicators.
[0105] Candidate technical solutions: These refer to multiple complete technical configurations and implementation paths pre-designed and stored in the knowledge base to meet project requirements, such as different cooling system architectures (air cooling, water cooling) or different UPS (Uninterruptible Power Supply) configurations for data centers. Key evaluation indicators: These are core performance and benefit parameters derived from the aforementioned calculations, used to quantitatively measure and compare the merits of different solutions, such as total power consumption, predicted PUE (Power Usage Effectiveness) value, and static payback period. Multi-dimensional comprehensive evaluation: This refers to the process of comprehensively examining and quantitatively scoring solutions from multiple predefined evaluation perspectives, including technical performance, economics, and scalability. Solution recommendation text: This refers to an analytical descriptive paragraph automatically generated by the system, containing the conclusion of the optimal solution and its key arguments.
[0106] In this embodiment, after completing data calculation and filling (steps 401-405 above), the system further derives key evaluation indicators for decision-making using the obtained calculation results (such as total power consumption and annual power consumption). The system then calls a pre-set quantitative evaluation model in the professional knowledge base. This model defines multiple evaluation dimensions (such as energy efficiency, cost, and reliability) and the weights of each dimension. These weights can be dynamically configured based on user input or preset business bias strategies. Using the key evaluation indicators as input, the system scores each candidate technical solution pre-configured in the knowledge base, calculates the scores for each dimension, and summarizes them according to their weights to obtain a comprehensive score for each solution. Afterward, the system sorts or compares solutions based on the comprehensive scores and automatically determines the recommended solution. Finally, the system combines the detailed description of the recommended solution (such as an equipment list and architecture diagram) with the comparative analysis of the key evaluation indicators, and automatically organizes the language to generate a logically clear and well-supported solution recommendation text according to a preset writing template, and includes this text as part of the report content data.
[0107] This embodiment, building upon automated data calculation, further realizes intelligent comparison and recommendation content generation of technical solutions. It transforms calculation results into evaluation indicators, uses a pre-set quantitative model to objectively and comprehensively score multiple candidate solutions, automatically selects the optimal solution, and finally generates a data-supported recommendation conclusion text. This model and automates the decision-making logic of domain experts, solving the problems of large workload, strong subjectivity, and difficulty in quantifying conclusions in manual solution comparison. The resulting feasibility study report not only contains accurate data but also provides in-depth and credible decision-making suggestions, significantly improving the report's decision support value and overall automation level.
[0108] Furthermore, in another embodiment of this application, step 106 may specifically include the following steps: generating an initial report text based on the report content data; performing text quality verification and repair processing on the initial report text to obtain optimized text, and generating the report document based on the optimized text.
[0109] Initial report text: refers to the initial draft of natural language text generated by the system based on the report content data. While the content is correct, it may contain flaws in expression. Text quality verification and repair: refers to the process of scanning, analyzing, and correcting quality issues in the text using a series of automated rules and algorithms. Optimized text: refers to the text version obtained after verification and repair, which has been improved in terms of completeness, coherence, and conciseness.
[0110] After obtaining the structured report content data, this embodiment first generates a coherent initial report text using text synthesis techniques (such as calling a large language model or template-based rendering). Subsequently, the system performs a set of text quality verification and repair processes on the initial report text, deviating from the original generation path and based on rule-based and deterministic algorithms. This processing specifically includes a combination of one or more of the following methods: (1) Duplicate content detection: Generate semantic feature fingerprints for each statement in the initial report text; divide the statements in the initial report text into different candidate sets based on the similarity of the semantic feature fingerprints; calculate the difference measure between the semantic feature fingerprints of statements in the same candidate set; when the difference measure is lower than the preset duplicate determination threshold, determine that the statements in the candidate set have duplicate content and perform deduplication operation.
[0111] Semantic fingerprint: A fixed-length numerical or encoded summary of a text generated using a specific algorithm (such as SimHash) that reflects its core semantic content. Candidate set: A preliminary grouping of multiple sentences in a text into the same category based on the similarity of their semantic fingerprints, using clustering or grouping algorithms (such as Locality Sensitive Hashing). Dissimilarity metric: A numerical value used to quantify the degree of difference between two semantic fingerprints, such as the Hamming distance; a smaller value indicates greater semantic similarity.
[0112] In this scheme, the system first calculates the semantic feature fingerprint for each sentence in the initial report text. This fingerprint encapsulates the core meaning of the sentence. Then, the system quickly groups sentences based on the similarity of these fingerprints, classifying potentially similar sentences into the same candidate set. For sentences within the same set, the system further calculates a precise difference metric between each pair of sentence fingerprints. When this metric value is below a pre-set duplication threshold, the two or more sentences are determined to be semantically substantial duplications. The system then performs a deduplication operation, typically retaining the most representative or informative sentence while deleting other duplicate sentences, thereby improving the information density and conciseness of the text.
[0113] (2) Paragraph rationality detection: Calculate the semantic similarity between adjacent sentences in the initial report text; when the semantic similarity is lower than the first preset threshold, it is determined that there is a lack of semantic coherence between the adjacent sentences and they should be segmented; when the semantic similarity is higher than the second preset threshold, it is determined that the adjacent sentences are semantically repetitive and information fusion processing is performed on the adjacent sentences.
[0114] Semantic similarity: refers to a quantitative indicator used to measure how close two texts are in meaning. Its value is usually between 0 and 1 (or -1 to 1). The higher the value, the more similar the meaning. It can be obtained by calculating cosine similarity through sentence embedding models (such as Sentence-BERT).
[0115] In this scheme, the system calculates the semantic similarity between each pair of adjacent sentences in the initial report text. When the similarity is below a first preset threshold (e.g., 0.3), it indicates a large semantic jump and lack of coherence between the two sentences. The system determines that these sentences should be segmented, i.e., paragraph separators should be inserted to conform to reading habits. When the similarity is above a second preset threshold (e.g., 0.85, and higher than the first threshold), it indicates that although the two sentences are different, their meanings highly overlap, and the system determines this as semantic redundancy. In this case, the system does not simply delete one sentence, but instead initiates information fusion processing, attempting to merge the effective information from the two sentences into a more concise and complete statement to avoid information loss and improve text quality.
[0116] (3) Completeness and Redundancy Detection: Check whether the sentences in the initial report text are closed with preset ending punctuation and / or whether they are missing necessary sentence components; match the statements in the initial report text with a predefined redundant phrase library and delete the successfully matched redundant phrases.
[0117] Redundant phrase library: refers to a collection of commonly used phrases and clichés that are collected and organized in advance and do not usually add information or can be deleted in the context of professional reports, such as "generally speaking", "it can be considered" and "from a certain perspective".
[0118] In this solution, integrity detection identifies and prompts for sentence repair by checking whether sentences end with appropriate punctuation such as periods or question marks, and by performing simple syntactic analysis to determine whether they possess necessary components such as subject, verb, and object. Redundancy detection, on the other hand, identifies invalid introductory or modifier phrases such as "generally speaking" or "it is worth noting" by matching sentences in the text against a predefined library of redundant phrases. For successfully matched redundant phrases, the system deletes them, resulting in a more direct and professional expression in the main text.
[0119] (4) Information gain-based sentence fusion method: For the first and second sentences that are determined to be semantically repetitive, calculate the information gain of the words in the second sentence on the first sentence; words whose information gain exceeds the preset gain threshold are incorporated into the first sentence as modifying or supplementing information to form the fused sentence.
[0120] Information gain refers to the increase in semantic similarity between the new sentence and the second sentence after adding a candidate word (from the second sentence) to the first sentence, relative to the semantic similarity between the first and second sentences without the addition. Its quantification formula can be expressed as: Gain = Similarity(New sentence, Second sentence) - Similarity(First sentence, Second sentence).
[0121] In this scheme, when two sentences are determined to be semantically redundant, the system does not immediately delete one of them. Instead, it calculates the information gain of each word (or phrase) in the second sentence when added to the first sentence. Specifically, the system adds candidate words to the first sentence to form a temporary new sentence, calculates the similarity between the new sentence and the second sentence, and the similarity between the original first sentence and the second sentence; the difference between the two is the gain value of that word. When the gain of a word exceeds a preset gain threshold (e.g., 0.05), it is considered that the word brings new and valuable information to the second sentence. The system then uses this word as a modifier, adverbial, or other modifier, or integrates it into the first sentence through syntactic adjustments, thereby generating a richer and more accurate fused sentence that integrates the key information from both sentences, replacing the original two redundant sentences.
[0122] (5) Reverse order repair execution strategy: Sort all identified text quality problems in descending order according to the end position of their corresponding text segments in the initial report text; according to the descending order, perform the repair operation corresponding to each text quality problem in sequence from the end of the initial report text to the beginning.
[0123] In this solution, after completing the various quality issue detections mentioned above, the system collects all the problem points to be repaired. Each problem point is associated with its specific position in the original text (such as the start and end character indices). The system sorts the text segments corresponding to each problem point in descending order (i.e., starting from the last problem in the text). Then, strictly following this sorting, it applies repair operations such as deletion, replacement, and insertion sequentially from the end of the text towards the beginning. This reverse-order execution strategy is crucial; it avoids the character indices of all subsequent positions being shifted due to modifications at earlier positions (such as deleting a piece of text), thus preventing repair misalignment or operational errors and ensuring the accuracy and reliability of complex batch repairs.
[0124] Figure 5 A flowchart illustrating the overall process from multiple input sources to the generation of the final report, such as Figure 5 As shown, the specific steps include: In a complete scenario of automatically generating a feasibility study report, the user first uploads original disclosure materials in various formats, including PPT presentations, Word documents, and Excel spreadsheets, through the system's input and parsing module. The system then initiates a file type recognition process, automatically distinguishing and routing different file types: for recognized PPT and Word documents, the system uses structure recognition and text block splitting functions to parse their content into hierarchical structured text blocks (such as chapter titles, body paragraphs, and key point lists); for recognized Excel files, it uses table recognition and data verification functions to extract the table areas and convert them into machine-readable, validated structured table data. Simultaneously, the system also performs text content extraction from all documents, and this text information, along with the table data, is integrated into a structured data pool, forming the raw materials for report generation.
[0125] Subsequently, the system enters the core content organization and generation module. The table and text linkage generation submodule works first, intelligently associating, sorting, and initially integrating structured text blocks and structured table data from different sources according to preset association rules, forming the logical framework and content fragments of the report draft. Next, the large model-driven generation submodule is activated. Based on the aforementioned organized structured information, it drives the large language model to write complete report chapters, ensuring the professionalism and coherence of the language. The generated content is immediately sent to the large model generation quality verification submodule, which performs multiple rounds of review and iterative correction on the logical consistency of the text, the accuracy of data citations, and the standardization of the language.
[0126] Finally, all report components, after verification and optimization, are automatically compiled and formatted by the system's report synthesis and output module, generating a final feasibility study report that is formatted correctly, data accurate, and argumentative. The entire process achieves fully automated and intelligent conversion from multi-source, heterogeneous, and unstructured input materials to high-quality, structured output documents, significantly improving the efficiency and reliability of report preparation.
[0127] Figure 6 This is a block diagram illustrating an embodiment of a report generation apparatus provided in this application. Figure 6 As shown, the device includes: The first acquisition module 61 is used to acquire document elements of various element types from the input file; The second acquisition module 62 is used to acquire the content information and attribute information of the document element for each type of document element by adopting an information extraction strategy corresponding to the element type. The determination module 63 is used to determine the association relationship between document elements based on the attribute information of each document element; Construction module 64 is used to construct structured data based on the content information, the attribute information, and the relationships between document elements; Processing module 65 is used to process the structured data based on a predefined professional knowledge base and report generation template to generate report content data; The generation module 66 is used to generate a report document based on the report content data.
[0128] In one possible implementation, the first acquisition module is specifically used for: Identify the format type of the input file; Determine the document parsing strategy based on the format type; The document parsing strategy is used to parse the input file to identify the individual document elements that make up the input file.
[0129] In one possible implementation, the second acquisition module is specifically used for: When the element type is a table, the internal data structure of the document element is parsed to extract the cell content and cell merging information as the content information, and the position information of the document element in the input file is extracted as the attribute information. When the element type is an image, the text contained in the document element is extracted as content information using optical character recognition technology, and the position information of the document element in the input file is recorded as attribute information. When the element type is text, the string of the document element is extracted as content information, and the visual style information of the document element and the position information of the document element in the input file are extracted as attribute information.
[0130] In one possible implementation, the determining module is specifically used for: Calculate the spatial relationships between document elements based on their position information; Based on the visual style information of text-type document elements, determine the logical hierarchy between each text-type document element; Based on the spatial relationships and logical hierarchical relationships, a relationship is constructed that represents the structural and reading order among document elements.
[0131] In one possible implementation, the building module is specifically used for: A data node is created for each document element, and the content information, attribute information and element type identifier of the corresponding document element are stored in each data node; For each data node, based on the relationships between document elements, determine and record the parent node reference relationship and child node reference relationship of the document element corresponding to the data node; All the data nodes are associated and integrated to form the structured data.
[0132] In one possible implementation, the report content data includes calculated and populated data; the processing module is specifically used for: Based on the report generation template, identify multiple target fields in the report text that need to be filled with the calculation results; For each target field, retrieve the input parameters that are semantically associated with the target field from the structured data; Match the predefined calculation rules corresponding to the target field from the professional knowledge base; The predefined calculation rules are executed based on the input parameters to obtain the calculation results; The calculation result is written as the filling content into the target field to obtain the calculated filling data.
[0133] In one possible implementation, the professional knowledge base further includes multiple pre-configured candidate technical solutions, the report content data further includes solution recommendation text, and the processing module is further configured to: Based on the calculation results, key evaluation indicators are generated; Based on the key evaluation indicators, a multi-dimensional comprehensive evaluation of multiple candidate technical solutions is conducted to obtain a comprehensive score. The recommended solution is determined from the multiple candidate technical solutions based on the comprehensive score; Based on the description of the recommended scheme and the analysis of the key evaluation indicators, the recommended scheme text is generated.
[0134] like Figure 7 As shown in the figure, this application provides a device including a processor 111, a communication interface 112, a memory 113, and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114. Memory 113 is used to store computer programs; In one embodiment of this application, when the processor 111 executes a program stored in the memory 113, it implements the report generation method provided in any of the foregoing method embodiments, including: Retrieves document elements of various element types from the input file; For document elements of each element type, an information extraction strategy corresponding to the element type is adopted to obtain the content information and attribute information of the document element. Based on the attribute information of each document element, the association relationship between each document element is determined; Based on the content information, the attribute information, and the relationships between document elements, structured data is constructed; Based on a predefined professional knowledge base and report generation template, the structured data is processed to generate report content data; A report document is generated based on the data in the report.
[0135] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the report generation method provided in any of the foregoing method embodiments.
[0136] 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.
[0137] 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.
[0138] 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, and “a plurality,” “multiple,” etc., may include the singular 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 specific order as described or illustrated, unless the order of performance is explicitly indicated. It should also be understood that additional or alternative steps may be used.
[0139] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. 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 this application. Therefore, this application 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 report generation method, characterized in that, The method includes: Retrieves document elements of various element types from the input file; For document elements of each element type, an information extraction strategy corresponding to the element type is adopted to obtain the content information and attribute information of the document element. Based on the attribute information of each document element, the association relationship between each document element is determined; Based on the content information, the attribute information, and the relationships between document elements, structured data is constructed; Based on a predefined professional knowledge base and report generation template, the structured data is processed to generate report content data; A report document is generated based on the data in the report.
2. The method according to claim 1, characterized in that, The process of obtaining document elements of various element types from the input file includes: Identify the format type of the input file; Determine the document parsing strategy based on the format type; The document parsing strategy is used to parse the input file to identify the individual document elements that make up the input file.
3. The method according to claim 1, characterized in that, For each document element of a specific element type, an information extraction strategy corresponding to that element type is employed to obtain the content and attribute information of the document element, including: When the element type is a table, the internal data structure of the document element is parsed to extract the cell content and cell merging information as the content information, and the position information of the document element in the input file is extracted as the attribute information. When the element type is an image, the text contained in the document element is extracted as content information using optical character recognition technology, and the position information of the document element in the input file is recorded as attribute information. When the element type is text, the string of the document element is extracted as content information, and the visual style information of the document element and the position information of the document element in the input file are extracted as attribute information.
4. The method according to claim 3, characterized in that, Determining the association between document elements based on their attribute information includes: Calculate the spatial relationships between document elements based on their position information; Based on the visual style information of text-type document elements, determine the logical hierarchy between each text-type document element; Based on the spatial relationships and logical hierarchical relationships, a relationship is constructed that represents the structural and reading order among document elements.
5. The method according to claim 1, characterized in that, The step of constructing structured data based on the content information, the attribute information, and the relationships between document elements includes: A data node is created for each document element, and the content information, attribute information and element type identifier of the corresponding document element are stored in each data node; For each data node, based on the relationships between document elements, determine and record the parent node reference relationship and child node reference relationship of the document element corresponding to the data node; All the data nodes are associated and integrated to form the structured data.
6. The method according to claim 1, characterized in that, The report content data includes calculated and populated data; the process of processing the structured data based on a predefined professional knowledge base and report generation template to generate report content data includes: Based on the report generation template, identify multiple target fields in the report text that need to be filled with the calculation results; For each target field, retrieve the input parameters that are semantically associated with the target field from the structured data; Match the predefined calculation rules corresponding to the target field from the professional knowledge base; The predefined calculation rules are executed based on the input parameters to obtain the calculation results; The calculation result is written as the filling content into the target field to obtain the calculated filling data.
7. The method according to claim 6, characterized in that, The professional knowledge base also includes multiple pre-configured candidate technical solutions, and the report content data further includes solution recommendation text. The method also includes: Based on the calculation results, key evaluation indicators are generated; Based on the key evaluation indicators, a multi-dimensional comprehensive evaluation of multiple candidate technical solutions is conducted to obtain a comprehensive score. The recommended solution is determined from the multiple candidate technical solutions based on the comprehensive score; Based on the description of the recommended scheme and the analysis of the key evaluation indicators, the recommended scheme text is generated.
8. A report generation device, characterized in that, The device includes: The first acquisition module is used to acquire document elements of various element types from the input file; The second acquisition module is used to acquire the content information and attribute information of the document element for each type of document element by adopting an information extraction strategy corresponding to the element type. The determination module is used to determine the association relationship between document elements based on the attribute information of each document element; The construction module is used to construct structured data based on the content information, the attribute information, and the relationships between document elements; The processing module is used to process the structured data based on a predefined professional knowledge base and report generation template to generate report content data; The generation module is used to generate a report document based on the report content data.
9. An electronic device, characterized in that, include: A processor and a memory, the processor being configured to execute a report generation program stored in the memory to implement the report generation method of any one of claims 1-7.
10. A storage medium, characterized in that, The storage medium stores one or more programs, which can be executed by one or more processors to implement the report generation method according to any one of claims 1-7.