An excel data knowledge question and answer method based on table structure semantic cooperation
Patent Information
- Application Number
- CN202610848815.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-12
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2046-06-12
AI Technical Summary
面对来源多样、格式动态变化的外部Excel文件时,部署成本高、维护复杂,难以实现普适化应用
(1)将表格文本语义与结构关系协同建模,显著提升对Excel数据真实语义的表达能力。本发明并非将Excel表格简单转写为零散文本片段,而是构建同时包含文本语义表示和结构关系表示的双表达知识体,使单元格值与其所属行表头、列表头、工作表、文件主题之间的关联被显式建模。该方式能够更准确地恢复表格中数据的原始上下文语义,显著提升复杂表格场景下的数据理解能力。
Smart Images

Figure CN122390090B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of intelligent question answering technology, and in particular to an Excel data knowledge question answering method based on semantic collaboration of table structure. Background Technology
[0002] In scenarios such as financial analysis, government statistics, corporate operations, scientific research management, and educational evaluation, a large amount of business data is stored in Excel spreadsheets for a long time. Although this type of data has a certain structure, in practical applications, it often suffers from problems such as inconsistent formatting, complex header hierarchy, scattered data across tables, non-standard field naming, and some cells requiring context to express their full semantics. Traditional data query methods mainly rely on manual review, filtering, pivot table analysis, or pre-built database query interfaces, which not only have a high barrier to entry but also fail to meet the needs of ordinary users to directly access data through natural language.
[0003] In recent years, to achieve intelligent question answering of structured data, existing technologies have mainly adopted the following types of solutions: Firstly, there are methods based on semantic parsing. These methods typically convert the user's natural language question into a structured query language before executing the query on the database. Such solutions usually require a stable underlying data schema, standardized field naming, and a pre-established, explicit table structure mapping. However, they often struggle when dealing with external Excel files from complex sources and with varying formats.
[0004] Secondly, there are methods based on rule templates or keyword matching. These methods involve manually designing question-and-answer templates, rule expressions, or keyword-triggered logic to achieve data queries in specific scenarios. While this approach has low implementation costs, its generalization ability is poor. When user question expressions change, table formats change, or query logic becomes more complex, it is prone to insufficient recall or matching errors.
[0005] Thirdly, there are methods based on vector retrieval and large language model generation. These methods typically first convert the table content into text fragments, then achieve semantic recall through vectorization, and finally input the recall results into a large language model to generate answers. While this approach has good natural language adaptability, it still suffers from problems such as insufficient utilization of structural information, instability in numerical reasoning, susceptibility to errors in complex calculations, and lack of evidentiary constraints on the answers when dealing with Excel spreadsheet data. Existing technologies have at least the following shortcomings:
[0006] (1) Insufficient adaptability to external heterogeneous Excel data.
[0007] Many existing technologies rely on manual preprocessing, such as standardizing field naming, establishing data dictionaries, and manually configuring relationships between tables. When faced with external Excel files from diverse sources and with dynamically changing formats, deployment costs are high, maintenance is complex, and it is difficult to achieve universal application.
[0008] (2) Insufficient use of semantics in table structure.
[0009] Most methods simply flatten the Excel content into text or fragments for retrieval, failing to explicitly model the hierarchical and relational relationships between "file-worksheet-header-data cell". This makes it difficult for the system to effectively understand the true semantic source of the cells, affecting retrieval accuracy and reasoning ability in complex query scenarios.
[0010] (3) The retrieval process lacks task-driven dynamic adaptation capabilities.
[0011] Existing solutions typically employ a fixed retrieval process, such as vector recall followed by keyword filtering, without dynamically adjusting the retrieval path based on the location, structure, and task constraints contained in the user's question. For complex problems such as comparison, aggregation, proportion, year-on-year comparison, and cross-table joins, incomplete candidate data or irrelevant data may easily occur.
[0012] (4) Insufficient ability in complex numerical calculations and logical reasoning.
[0013] In scenarios requiring comparison, sorting, proportion, trend analysis, and multi-condition combination filtering, relying solely on large language models for answer generation can easily lead to numerical errors, logical jumps, or inconsistencies between conclusions and the original data, making it difficult to meet high accuracy requirements.
[0014] (5) The answer lacks verifiability and self-correction ability.
[0015] Existing question-answering systems typically output the answer directly after generation, lacking a mechanism to verify entities, numerical values, calculation results, and constraint coverage. When the retrieval is insufficient or the generated results deviate from the original data, the system cannot automatically detect errors and perform a re-retrieval and correction, resulting in insufficient reliability.
[0016] Therefore, there is an urgent need for a knowledge-based question-answering method that can automatically perform structured cleaning, structured modeling, constraint parsing, hierarchical hybrid retrieval, explicit reasoning, and answer verification for external heterogeneous Excel spreadsheet data, so as to improve the accuracy, interpretability, and robustness of the system in complex spreadsheet question-answering scenarios. Summary of the Invention
[0017] The purpose of this invention is to provide an Excel data knowledge question answering method based on table structure semantic collaboration, which solves the above-mentioned problems and consists of a collaborative question answering framework composed of structural modeling, constraint parsing, hierarchical hybrid retrieval, executable reasoning, and evidence verification feedback.
[0018] To achieve the above objectives, the technical solution adopted by this invention is as follows: an Excel data knowledge question-answering method based on table structure semantic collaboration, comprising the following steps: S1 defines the hierarchical semantic structure, metadata vocabulary, and task categories of the cell; The hierarchical semantic structure is used for cell location, including file, worksheet, table header, row title, column title, and cell content. The metadata vocabulary contains multiple metadata categories, and the task categories include cross-cell retrieval tasks and independent retrieval tasks. S2, retrieve multiple Excel files related to knowledge Q&A, and process each Excel file into a two-dimensional table; S3, generate collaborative knowledge bodies for each cell in the two-dimensional table and store them in the ChromaDB vector database to obtain a composite knowledge base. The collaborative knowledge body generation method for a cell includes S31~S34. S31, extract the content of the cell-level semantic structure, concatenate it into semantic text u1, and convert it into a high-dimensional vector u2; S32, use the content of the cell hierarchical semantic structure to form structured data u3; S33, generate all metadata tags u4 of semantic text u1, each metadata tag including metadata category and its matching items; S34, (u1, u2, u3, u4) will form a collaborative knowledge body; S4 performs multi-constraint analysis on the user problem, including S41~S42; S41, obtain the user's question, extract all metadata tags contained in the question, and use the matching items in the tags as metadata constraints; S42, classify the problems by task category and use the task category as a task constraint; S5, constraint-driven hierarchical hybrid retrieval, including S51~S53; S51, Select collaborative knowledge bodies containing all matching items in the metadata constraints from the composite knowledge base to form a candidate set; S52, transform the user's question into a question vector, calculate the semantic similarity with the high-dimensional vector of each collaborative knowledge body in the candidate set, recall the K collaborative knowledge bodies with the highest semantic similarity, and form an evidence set; S53, If task constraint C2 is a cross-cell retrieval task, then for each collaborative knowledge body in the evidence set, add its row and column collaborative knowledge bodies to the evidence set. S6, designed with structured prompts, guides the large language model to generate answers based on evidence sets and user questions; S7: The answer is validated according to the preset validation rules. If the validation passes, the answer is output; otherwise, steps S4 to S6 are repeated.
[0019] As a preferred option, among the task categories... The cross-cell retrieval task includes comparative analysis, sorting and filtering, percentage calculation, year-on-year analysis, month-on-month analysis, statistical analysis, trend analysis, and anomaly detection; The independent retrieval tasks include single-point fact query, single-index retrieval, single-entity query, fixed-value query, and basic information query.
[0020] As a preferred embodiment, in S2, processing each Excel file into a two-dimensional table includes parsing the workbook into a worksheet, expanding merged cells within the worksheet, cleaning the header area and eliminating redundant information, and normalizing data types.
[0021] As a preferred option, in S33, all metadata tags u4 for generating semantic text u1 are specifically: Read each category in the metadata vocabulary sequentially, and use string matching or regular expression matching to search for category matches in the semantic text u1. If n matches are found, generate n metadata tags, each of which includes the category and its match.
[0022] As a preferred approach, a pre-trained Chinese BGE-Large-ZH-v1.5 embedding model is used to transform semantic text or user questions into corresponding high-dimensional vectors or query vectors.
[0023] Preferably, in S6, the large language model is a lightweight large language model.
[0024] Preferably, in S7, the verification rules include entity consistency verification and constraint coverage verification; The entity consistency check is as follows: read all entities in the answer, and if they all appear in a collaborative knowledge body of the evidence set, the entity consistency check is considered to have passed; The constraint coverage check is performed as follows: if all matching items in the user's question appear in the answer, the constraint coverage check passes; otherwise, it fails.
[0025] This invention can automatically complete structure cleaning, structure modeling, constraint parsing, hierarchical hybrid retrieval, explicit reasoning, and answer verification.
[0026] First: Step S2 is used to automatically complete the structure cleaning, the purpose of which is to transform the original Excel tables from different sources and with different formats into a standardized table representation that can be parsed, located, and linked.
[0027] Second: Step S3 is used for structural modeling. The purpose is to generate a collaborative knowledge body for each cell and store it in the ChromaDB vector database. The collaborative knowledge body includes: semantic text u1: content constructed based on the cell-level semantic structure, containing the complete semantics of the cell; high-dimensional vector u2: transformed from semantic text u1; structural data u3 constructed from the cell-level semantic structure content; metadata tag u4: containing all metadata of semantic text u1; u3 and u4 facilitate subsequent retrieval, recall, comparison, etc.
[0028] Third: Step S4 is used for constraint parsing, the purpose of which is to obtain metadata constraints and task constraints from user questions for use in subsequent hierarchical hybrid retrieval.
[0029] Fourth: Step S5 is used for constraint parsing hierarchical hybrid retrieval. The main idea is: (1) Pre-shrinking based on metadata constraints. Select collaborative knowledge bodies containing all matching items in the metadata constraints from the composite knowledge base to form a candidate set; for example, if “2020, Sichuan Province, Miao ethnic group, women” is the metadata constraint, then only if the semantic text contains these 4 words will the corresponding collaborative knowledge body be included in the candidate set. The purpose is to pre-screen and narrow the search scope.
[0030] (2) Semantic similarity recall. Within the candidate set, the user's question is vectorized and semantically similar to the high-dimensional vector in the candidate set. The K collaborative knowledge bodies with the highest semantic similarity are recalled to form the evidence set.
[0031] (3) Task-driven association expansion. If the user question's task constraint is an independent retrieval task, then no further association expansion is needed. If the user question's task constraint is a cross-cell retrieval task, then for each collaborative knowledge body within the evidence set, the collaborative knowledge bodies in the same row and column are automatically expanded to form an evidence set that meets the requirements of subsequent reasoning. Automatic expansion is based on the collaborative knowledge body structure data u3, without needing to read the semantic text u1.
[0032] Fifth: Step S6 is used for explicit reasoning. The evidence set and user question are fed into the large language model, guiding it to generate an answer within the scope of the evidence set.
[0033] Sixth: Step S7 is used for answer verification, including entity consistency verification and constraint coverage verification. Entity consistency verification verifies the correctness of the answer to prevent "creating something out of nothing," while constraint coverage verification verifies the completeness to prevent "answering the wrong question" or omitting core constraints. Only if both verifications pass can the answer pass verification; otherwise, return to step S4, and repeat multi-constraint parsing, hierarchical hybrid retrieval, explicit reasoning, and answer verification until the answer verification passes.
[0034] Compared with the prior art, the advantages of the present invention are as follows: (1) By co-modeling the semantics of table text and structural relationships, the ability to express the true semantics of Excel data is significantly improved. This invention does not simply transcribe Excel tables into fragmented text, but constructs a dual-expression knowledge body that simultaneously includes textual semantic representation and structural relationship representation, so that the association between cell values and their respective row headers, list headers, worksheets, and file topics is explicitly modeled. This approach can more accurately restore the original contextual semantics of data in tables and significantly improve the ability to understand data in complex table scenarios.
[0035] (2) By driving hierarchical hybrid retrieval through multi-constraint parsing, the accuracy and completeness of retrieval under complex problems are improved. This invention decomposes user questions into metadata constraints and task constraints, forming a constraint-based adaptive retrieval process. This process first generates an initial candidate set based on metadata, then filters it again based on semantic similarity to generate an evidence set, and finally expands the evidence set based on task constraints. Compared with a fixed retrieval process, this invention can reduce irrelevant recall by utilizing metadata and task categories, and can supplement the data required for complex calculations through task-driven association expansion. Therefore, it is particularly suitable for multi-step question-answering scenarios such as comparison, proportion, ranking, and trend.
[0036] (3) Construct a closed-loop verification and self-correction mechanism for evidence to improve the credibility of the answer. This invention does not output the answer directly after it is generated, but further performs entity consistency and constraint coverage verification; when insufficient evidence or answer deviation is found, it automatically backtracks to the retrieval and reasoning stage for correction, thereby significantly reducing illusion questions and irrelevant answers in the question-answering system.
[0037] (4) It has higher robustness and versatility to external heterogeneous Excel data. Through standardized table cleaning, automatic header parsing, metadata extraction and structural semantic modeling, this invention can adapt to Excel files from different sources, in different formats and with different business themes, reduce the need for manual pre-configuration, and facilitate rapid deployment in multiple scenarios such as finance, government affairs, education, scientific research and enterprise management.
[0038] (5) It has both high interpretability and engineering application value. This invention can output the basis of the answer, the location of the data source and the explanation of the calculation process, so that the question and answer results have strong auditability and verifiability, and are suitable for business scenarios with high requirements for accuracy and traceability. Attached Figure Description
[0039] Figure 1 This is a flowchart of the present invention; Figure 2 This is a schematic diagram of the process in Example 2. Detailed Implementation
[0040] The present invention will be further described below with reference to the embodiments and accompanying drawings.
[0041] Example 1: See Figure 1 and Figure 2 An Excel data knowledge question answering method based on semantic collaboration of table structure includes the following steps: S1 defines the hierarchical semantic structure, metadata vocabulary, and task categories of the cell; The hierarchical semantic structure is used for cell location, including file, worksheet, table header, row title, column title, and cell content. The metadata vocabulary contains multiple metadata categories, and the task categories include cross-cell retrieval tasks and independent retrieval tasks. S2, retrieve multiple Excel files related to knowledge Q&A, and process each Excel file into a two-dimensional table; S3, generate collaborative knowledge bodies for each cell in the two-dimensional table and store them in the ChromaDB vector database to obtain a composite knowledge base. The collaborative knowledge body generation method for a cell includes S31~S34. S31, extract the content of the cell-level semantic structure, concatenate it into semantic text u1, and convert it into a high-dimensional vector u2; S32, use the content of the cell hierarchical semantic structure to form structured data u3; S33, generate all metadata tags u4 of semantic text u1, each metadata tag including metadata category and its matching items; S34, (u1, u2, u3, u4) will form a collaborative knowledge body; S4 performs multi-constraint analysis on the user problem, including S41~S42; S41, obtain the user's question, extract all metadata tags contained in the question, and use the matching items in the tags as metadata constraints; S42, classify the problems by task category and use the task category as a task constraint; S5, constraint-driven hierarchical hybrid retrieval, including S51~S53; S51, Select collaborative knowledge bodies containing all matching items in the metadata constraints from the composite knowledge base to form a candidate set; S52, transform the user's question into a question vector, calculate the semantic similarity with the high-dimensional vector of each collaborative knowledge body in the candidate set, recall the K collaborative knowledge bodies with the highest semantic similarity, and form an evidence set; S53, If task constraint C2 is a cross-cell retrieval task, then for each collaborative knowledge body in the evidence set, add its row and column collaborative knowledge bodies to the evidence set. S6 features structured prompts to guide the large language model in generating answers based on evidence sets and user questions. S7: The answer is validated according to the preset validation rules. If the validation passes, the answer is output; otherwise, steps S4 to S6 are repeated.
[0042] In this embodiment, the cross-cell retrieval tasks include comparative analysis, sorting and filtering, percentage calculation, year-on-year analysis, month-on-month analysis, statistical analysis, trend analysis, and anomaly detection; the independent retrieval tasks include single-point fact query, single-indicator retrieval, single-entity query, fixed-value query, and basic information query.
[0043] In S2, processing each Excel file into a two-dimensional table includes parsing the workbook into a worksheet, expanding merged cells within the worksheet, cleaning the header area and eliminating redundant information, and normalizing data types.
[0044] S33, generating all metadata tags u4 for semantic text u1 specifically: Read each category in the metadata vocabulary sequentially, and use string matching or regular expression matching to search for category matches in the semantic text u1. If n matches are found, generate n metadata tags, each of which includes the category and its match.
[0045] This embodiment uses a pre-trained Chinese BGE-Large-ZH-v1.5 embedding model to transform semantic text or user questions into corresponding high-dimensional vectors or query vectors.
[0046] In S6, the large language model is a lightweight large language model.
[0047] In S7, the verification rules include entity consistency verification and constraint coverage verification. The entity consistency verification is as follows: if all entities in the answer appear in a collaborative knowledge body of the evidence set, the entity consistency verification is considered to pass. The constraint coverage verification is as follows: if all matching items in the user's question appear in the answer, the constraint coverage verification is passed; otherwise, it fails.
[0048] Example 2: See Figure 1 and Figure 2 Based on Example 1, the specific operation flow of step S2 is given, which can be divided into the following steps: (1) Workbook parsing and worksheet recognition. The table parsing engine reads each worksheet in the target Excel file, identifies the valid data area, header area and table header area of each worksheet, and records basic information such as file name, worksheet name and table coordinate range.
[0049] (2) Merged cell expansion and content inheritance filling. For a merged cell range, retrieve the content of its top-left cell and unmerge it. Then, fill the original value into each cell in the merged range, so that the semantic relationship that originally relied on visual layout is transformed into explicit cell content.
[0050] (3) Header area cleaning and redundancy elimination. Automatically identify descriptive rows, duplicate rows, blank rows and formatted redundancy areas in the table, and remove or mark data areas that do not participate in semantic expression to reduce subsequent parsing noise.
[0051] (4) Data type normalization processing. Data types such as numbers, dates, text, percentages, and currency symbols are uniformly identified and standardized, and null values, outliers, and non-standard format values are marked to improve the stability of subsequent retrieval and calculation.
[0052] Example 3: See Figure 1 and Figure 2 Based on Example 1, a specific operation example is given for step S3, which generates a collaborative knowledge body for each cell in the two-dimensional table: For example, a file named "Population of all ethnic groups in the province aged 3 and above by gender and education level (townships).xlsx" contains a worksheet titled "Township Population Data". Its row heading is "Ethnicity", further subdivided into Han, Hui, Tibetan, etc., and its column heading is "Gender - Education Level", further subdivided into "Male - Primary School", "Male - Middle School", "Female - Undergraduate", etc. A cell located in row 5, column 8 of this worksheet has the row heading "Han" and the column heading "Male - Undergraduate", and its content is the value 85620. The following procedure should be followed: S31, including S31-1 to S31-3: S31-1, Extract the semantic structure of the cell hierarchy: File = Population of people aged 3 and above by gender and education level in all ethnic groups of the province (towns).xlsx, Worksheet = Town population data, Header = Population of people aged 3 and above (towns), Row header = Han nationality, Column header = Male - Undergraduate; Cell content: 85620; S31-2 generates semantic text u1 as "In the 'Town Population Data' worksheet of the file 'Population of all ethnic groups in the province by gender and education level (towns).xlsx,' the number of Han male college graduates aged 3 and above is 85,620." S31-3 uses the pre-trained Chinese BGE-Large-ZH-v1.5 embedding model to transform the semantic text u1 into a high-dimensional vector u2; S32, constituting structural data u3: u3={, File Name: "Population of all ethnic groups in the province, categorized by gender and education level, aged 3 and above (townships).xlsx" Worksheet Name: "Township Population Data" Main header: "Number of people aged 3 and above (town)" Line heading (Ethnicity): "Han Nationality", Column header (Gender-Education Level): "Male-Undergraduate", Cell value (population): "85620" }, S33, Generate metadata tag u4. u4={, "Ethnicity": "Han nationality" Gender: Male "Education Level": "Undergraduate Degree" Age: 3 years and above }, S34, finally (u1,u2,u3,u4) will form a collaborative knowledge body.
[0053] Example 4: Based on Example 1, a specific operation example is given for performing multi-constraint analysis on the user problem in step S4: For example, a user's question is "What was the number of Miao women in Sichuan Province in 2020?".
[0054] (1) Metadata constraints: Extract all metadata tags as: Year=2020, Region=Sichuan Province, Ethnicity=Miao, Gender=Female. Then “2020, Sichuan Province, Miao, Female” constitutes the metadata constraints.
[0055] (2) Task Constraints: Since this task only requires querying the value of a single cell and does not require comparison or analysis, it is determined to be an independent retrieval task, and "independent retrieval task" is set as the task constraint. Task classification can be performed as follows: First, the system scans user questions according to a pre-defined task vocabulary. "How much," "What is," and "Query" are classified as fact queries; "Compare" and "Difference" are classified as comparative analysis; "Top N," "Ranking," "Most," and "Minimum" are classified as sorting and filtering; "Percentage," "Ratio," and "Proportion" are classified as percentage calculations; "Year-on-Year" and "Compared to the Same Period Last Year" are classified as year-on-year analysis; "Month-on-Month" and "Compared to the Previous Period" are classified as month-on-month analysis; "Total," "Amount," "Average," "Maximum," and "Minimum" are classified as statistical analysis; "Trend," "Change," and "Fluctuation" are classified as trend analysis; and "Abnormal," "Outlier," and "Investigate" are classified as anomaly detection. Second, the system determines the main task type according to a fixed priority. Then, if the main task is a fact query... If a query contains only one time, one region, one object, and one indicator, the system classifies it as a single-point query. In this case, it does not perform additional searches for multiple similar data, nor does it perform continuous time searches or cross-table joins. Instead, it directly locates the target data based on existing conditions and returns the result. If the main task is comparative analysis, sorting and filtering, percentage calculation, year-on-year analysis, month-on-month analysis, statistical analysis, trend analysis, or anomaly detection, or if it is a factual query but also contains multiple times, regions, objects, or indicators, the system classifies it as a complex query. It automatically supplements the query by finding a set of basic data related to the query and then sends this set of data to subsequent sorting, percentage calculation, difference calculation, statistical summary, or trend analysis steps. Through this processing, the system can clearly distinguish between "questions that only require finding one data point" and "questions that require finding a set of data before further processing," thereby avoiding overloading simple questions and preventing incomplete data retrieval for complex questions.
[0056] Example 5: Based on Example 1, the answer is validated according to the preset validation rules in step S7, and a specific operation example is given: Case 1: Suppose the user's question is "What will the temperature in Beijing be in 2025?"
[0057] The answer generated by the large language model is "The temperature in Beijing in 2025 is 15℃".
[0058] Entity consistency check: The entity to be read in the answer is based on keyword recognition or named entity recognition, including: 2025, Beijing, temperature, 15℃; if “2025, Beijing, temperature, 15℃” appears in a collaborative knowledge body in the evidence set, the entity consistency check passes.
[0059] Constraint coverage check: Read all matching items in the user's question, including "2025, Beijing, temperature". If the answer contains "2025, Beijing, temperature", the constraint coverage check is considered to have passed.
[0060] Case 2: The user's question was, "What will the temperature in Beijing be in 2025?"
[0061] If the answer generated by the large language model is "The temperature in Beijing in 2026 is 20℃".
[0062] Entity consistency check: The entities for extracting the answer include "2026, Beijing, temperature, 20℃". If there are no relevant records for 2026 in the collaborative knowledge body in the evidence set, the check will fail.
[0063] If the answer generated by the large language model is "Beijing temperature 15℃", then the constraint coverage check is missing 2025, and the check fails.
[0064] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for Excel data knowledge question answering based on semantic collaboration of table structure, characterized in that, Includes the following steps: S1 defines the hierarchical semantic structure, metadata vocabulary, and task categories of the cell; The hierarchical semantic structure is used for cell location, including file, worksheet, table header, row title, column title, and cell content. The metadata vocabulary contains multiple metadata categories, and the task categories include cross-cell retrieval tasks and independent retrieval tasks. S2, retrieve multiple Excel files related to knowledge Q&A, and process each Excel file into a two-dimensional table; S3, generate collaborative knowledge bodies for each cell in the two-dimensional table and store them in the ChromaDB vector database to obtain a composite knowledge base. The collaborative knowledge body generation method for a cell includes S31~S34. S31, extract the content of the cell-level semantic structure, concatenate it into semantic text u1, and convert it into a high-dimensional vector u2; S32, use the content of the cell hierarchical semantic structure to form structured data u3; S33, generate all metadata tags u4 of semantic text u1, each metadata tag including metadata category and its matching items; S34, (u1, u2, u3, u4) will form a collaborative knowledge body; S4 performs multi-constraint analysis on the user problem, including S41~S42; S41, obtain the user's question, extract all metadata tags contained in the question, and use the matching items in the tags as metadata constraints; S42, classify the problems by task category and use the task category as a task constraint; S5, constraint-driven hierarchical hybrid retrieval, including S51~S53; S51, Select collaborative knowledge bodies containing all matching items in the metadata constraints from the composite knowledge base to form a candidate set; S52, transform the user's question into a question vector, calculate the semantic similarity with the high-dimensional vector of each collaborative knowledge body in the candidate set, recall the K collaborative knowledge bodies with the highest semantic similarity, and form an evidence set; S53, If the task constraint is a cross-cell retrieval task, then for each collaborative knowledge body in the evidence set, add the collaborative knowledge bodies in the same row and column to the evidence set. S6, designed with structured prompts, guides the large language model to generate answers based on evidence sets and user questions; S7: The answer is validated according to the preset validation rules. If the validation passes, the answer is output; otherwise, steps S4 to S6 are repeated.
2. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, In the task categories, The cross-cell retrieval task includes comparative analysis, sorting and filtering, percentage calculation, year-on-year analysis, month-on-month analysis, statistical analysis, trend analysis, and anomaly detection; The independent retrieval tasks include single-point fact query, single-index retrieval, single-entity query, fixed-value query, and basic information query.
3. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, In S2, processing each Excel file into a two-dimensional table includes parsing the workbook into a worksheet, expanding merged cells within the worksheet, cleaning the header area and eliminating redundant information, and normalizing data types.
4. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, S33, generating all metadata tags u4 for semantic text u1 specifically: Read each category in the metadata vocabulary sequentially, and use string matching or regular expression matching to search for category matches in the semantic text u1. If n matches are found, generate n metadata tags, each of which includes the category and its match.
5. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, The pre-trained Chinese BGE-Large-ZH-v1.5 embedding model transforms semantic text or user questions into corresponding high-dimensional vectors or query vectors.
6. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, In S6, the large language model is a lightweight large language model.
7. The Excel data knowledge question-answering method based on table structure semantic collaboration according to claim 1, characterized in that, In S7, the verification rules include entity consistency verification and constraint coverage verification; The entity consistency check is as follows: read all entities in the answer, and if they all appear in a collaborative knowledge body of the evidence set, the entity consistency check is considered to have passed; The constraint coverage check is performed as follows: if all matching items in the user's question appear in the answer, the constraint coverage check passes; otherwise, it fails.
Citation Information
Patent Citations
Industrial table data identification method for large model knowledge enhancement and program product
CN118799895A
Power grid field table data reasoning and question answering method based on code enhancement framework
CN120671849A