Structured table knowledge extraction input optimization method and system, and storage medium

By converting structured tables into key-value pair text and using preset delimiters for priority block division, the method solves the problems of record slicing and category label loss after table to text conversion in the prior art, and improves the effect of entity relationship extraction and record integrity.

CN123140191APending Publication Date: 2026-11-20CHINA THREE GORGES UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611297597.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Existing technologies convert structured record tables into natural paragraph text, but the input text lacks inherent paragraph boundaries. Blocking operations randomly cut the text within the record, resulting in the loss of category labels and field boundaries. Large language models cannot correctly extract entities and relationships, and the quality of graph index construction is affected.

Method used

Each row of the structured record table is converted into key-value pair text, with each field on a separate line. Preset delimiters are used for separation, and a text chunking strategy is configured with the delimiters as the priority dividing boundaries. The text chunk size is greater than the maximum number of tokens in a single record. A large language model is then called to extract entity relationships.

Benefits of technology

It increases the number of entity relationships extracted, improves the problem of record segments, enables convenient injection of classification information, and ensures the integrity of record content and the recognition effect of entity relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123140191A_ABST
    Figure CN123140191A_ABST
Patent Text Reader

Abstract

The application discloses a structured table knowledge extraction input optimization method and system and a storage medium, and belongs to the technical field of natural language processing and knowledge graph. The method converts each row of a structured record type table into a key-value pair text, each field is independent into a row and prefixed with a field name, and a preset delimiter is arranged between records; a blocking strategy is configured, the preset delimiter is preferentially used as a segmentation boundary, and the size of a text block is greater than a maximum token number threshold of a single record; then a large language model is called to perform entity relationship extraction on the blocked text to construct a knowledge graph. The scheme preferentially blocks in the key-value pair format combined with the delimiter, avoids that the records are truncated across blocks, improves the entity recognition and relationship extraction effect, and reduces the interface calling overhead. The application focuses on the quality influencing factors of knowledge extraction on input data structure, and can be suitable for knowledge graph construction work of various structured record type tables.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of natural language processing and knowledge graph construction technology, specifically to a structured table knowledge extraction input optimization method, system, and storage medium. Background Technology

[0002] Transforming structured record-based data into knowledge graphs is a crucial method for intelligent data management and analysis. Current technical approaches typically involve first converting tables into natural paragraph text, then using a knowledge-enhanced retrieval framework to extract entities and relationships from a large language model, ultimately constructing a graph index.

[0003] At the knowledge-enhanced retrieval index level, existing frameworks have proposed a graph index plus two-layer retrieval framework, as well as a graph index scheme based on community discovery. However, both types of frameworks are designed for general unstructured text and do not discuss the impact of the choice of input format from structured tables to text on the quality of downstream knowledge extraction.

[0004] At the table understanding level, existing technologies directly encode the two-dimensional structure of the table using an encoder, jointly modeling cell content and table header position information, achieving good results in table question answering tasks. However, this method relies on column position encoding, cannot be adapted to graph index retrieval frameworks, and has no compensation mechanism for the loss of structural information during the table-to-text conversion process.

[0005] At the evaluation system level, existing work has constructed an automatic evaluation benchmark for retrieval quality, measuring retrieval quality from three dimensions: correctness, completeness, and fidelity. However, it does not include the formatting quality dimension of the input text, and therefore cannot evaluate the systematic impact of different preprocessing strategies on downstream retrieval quality.

[0006] In summary, existing work, in terms of knowledge-enhanced retrieval index construction, table semantic encoding, and retrieval quality assessment, does not address the input optimization problem of converting structured tables to formatted text, nor does it provide a combined design mechanism for formatting and segmentation.

[0007] Converting multi-column structured record tables to natural paragraph text presents three practical problems. First, key relationships are embedded in long strings; geographic entity names are enclosed within location fields exceeding fifty characters, making it difficult for large language models to identify geographic affiliations. Second, classification information is lost; category labels are typically recorded in filenames or external perceptions, and these classification relationships are completely missing from the graph index after conversion to paragraph text. Third, segmentation strategies are mismatched; existing retrieval frameworks segment text according to a fixed number of tokens, failing to recognize paragraph boundaries. In paragraph format, segmentation points often fall within the middle of record fields, resulting in complete record information being scattered across different text blocks.

[0008] Existing test data shows that on a test set of 2,230 records, with the existing configuration of natural paragraph formatting and 1,200-character token-level segmentation, only 21.8% of the company names remained intact and recognizable within the text blocks. The remaining 78.2% of company information could not be indexed due to block truncation. With the same batch of source data, the same model, and the same retrieval parameters, simply changing the input format improved the name recognition rate from 21.8% to 100%, and significantly increased the number of relationships extracted. Summary of the Invention

[0009] The purpose of this invention is to provide a structured table knowledge extraction input optimization method, system, and storage medium to solve the problems in existing technologies where, after converting structured record tables into natural paragraph text, the input text lacks inherent paragraph boundaries, and the block operation randomly cuts the text within the record; in addition, category labels and field boundaries are lost in the paragraph format, large language models cannot correctly extract entities and relationships from fragmented and unstructured labeled input, and the quality of graph index construction is greatly affected.

[0010] To solve the above problems, the technical solution of the present invention is as follows: A structured tabular knowledge extraction input optimization method includes the following steps: Step S1: Convert each row of the structured record table into key-value pair text, where each field is on a separate line and is marked with the field name as a prefix, and all records are separated by a preset delimiter; Step S2: Configure the text segmentation strategy, using the preset delimiter as the priority segmentation boundary, and set the text block size to be greater than the threshold of the maximum number of tokens in a single record; Step S3: Use the large language model to extract entity relationships from the text blocks generated in step S2 and construct a knowledge graph.

[0011] Furthermore, the fields of the key-value pair text in step S1 include at least one of the following three categories: a name field for identifying the record subject; a location field for describing the geographical location of the record subject; and a category field for describing the category to which the record subject belongs.

[0012] Furthermore, it also includes step S0: automatically extracting category tags from the directory structure where the file is located, and writing the file's parent directory name as the category field value of all records in the file into the key-value pair text in step S1.

[0013] Furthermore, the text block size threshold mentioned in step S2 is determined based on the maximum number of tokens in all record texts to ensure that a single record is not truncated across blocks.

[0014] Furthermore, the preset separator inserted between records in step S1 provides a recognizable boundary marker between records for step S2. Step S2 uses the preset separator as the priority dividing boundary to avoid the block operation from destroying the integrity of the single record text generated in step S1.

[0015] Furthermore, before step S1, there is a record deduplication and merging step: the structured table is deduplicated according to the record identifier field, multiple entries of records with the same name are merged into one, ensuring that the same record appears only once in the key-value pair text.

[0016] Furthermore, step S1 also includes column structure compatibility processing: a field mapping dictionary is established by column name rather than column order to be compatible with multiple versions of table export formats with different numbers of columns or different column orders.

[0017] Furthermore, before step S1, there is also an automatic header row detection step: determining whether the first cell in the first row and first column contains disclaimer keywords or whether the cell content length exceeds a preset threshold. If so, the first row is determined to be a non-header row, and the header is positioned in the second row.

[0018] A computer-readable storage medium having a computer program stored thereon that, when executed by a processor, implements a structured tabular knowledge extraction input optimization method.

[0019] A structured table knowledge extraction input optimization system includes: a directory classification extraction module for automatically extracting category tags from the directory structure of the file; a key-value pair conversion module for converting each row of a structured record table into key-value pair text, with records separated by a preset delimiter; a paragraph-aware segmentation module for segmenting text into blocks based on the preset delimiter as the priority segmentation boundary, with the text block size set to a threshold greater than the maximum number of tokens in a single record; and an entity relation extraction module for calling a large language model to extract entity relations from the segmented text and construct a knowledge graph.

[0020] The beneficial effects of this invention are as follows: 1. It helps improve the number of entity relationships extracted. Under the same model and prompt conditions, key-value pairs retain field name tags, allowing the model to distinguish the content corresponding to different fields when reading the text, and fully extract the entity and relationship information contained within the fields. Multiple sets of comparison queries can verify that the basic retrieval capability remains stable, and the performance changes caused by format differences mainly come from the entity relationship extraction level.

[0021] 2. It can improve the problem of record truncation. Simply increasing the text block window and using the ordinary token-level segmentation method still results in record truncation. By adopting the preset delimiter priority segmentation scheme of this invention, records can be avoided from being trunculated internally, ensuring that the record content is completely preserved within the text block.

[0022] 3. Enables convenient injection of category information. Users only need to create a folder and move the files in to complete the injection of category information, without modifying the source table or generating additional configuration files.

[0023] 4. The comparative experiment shows that neither format conversion alone nor delimiter-based segmentation alone can simultaneously achieve optimal performance in relation extraction, record completeness, and API call overhead. Even if delimiter-based segmentation of paragraph text ensures record completeness, the lack of field markers still results in low entity relation recognition output. Performing both format conversion and delimiter-based segmentation simultaneously achieves optimal performance in all three metrics: entity relation extraction output, record completeness, and API call overhead.

[0024] 5. This method re-anchors the bottleneck of knowledge extraction quality from the reasoning ability of large language models to the input data structure level. The completeness of the input structure has a significant impact on the completeness rate of entity relation triple extraction and the name recognition rate within text blocks. When using the same large language model to process the same batch of original data, simply changing the input structure can bring about significant changes in the entity relation extraction and entity recognition results. The input format is a quality impact dimension independent of the model's capabilities. Attached Figure Description

[0025] The invention will be further described below with reference to the accompanying drawings: Figure 1 This is an overall flowchart of the method of the present invention; Figure 2 This is a diagram comparing natural paragraph formatting and key-value pair formatting. Figure 3 A comparison chart of the internal cutoff rate under three different block configurations; Figure 4 A bar chart comparing the hit counts of multiple queries in two different formats; Figure 5 A bar chart comparing the number of entities in the four control experiments. Detailed Implementation

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

[0027] like Figure 1 As shown, a method for optimizing the input format for knowledge extraction from structured tabular data includes the following steps: Step S1: Read the structured record table. Each row of the table corresponds to one business record. Parse each field within the table row by row, outputting each field as a separate line of text. Place the field name at the beginning of the text line as a marker. Insert preset delimiters between the output text of different business records as boundary markers, completing the format conversion. Comparison between the natural paragraph format and the key-value pair format used in this invention is shown below. Figure 2 As shown.

[0028] Step S2: Configure the text chunking processing logic. The chunking process prioritizes retrieving a preset delimiter as the cutting position. The character size that a text block can hold is set to be greater than the maximum token value consumed after a single record is converted, ensuring that no single business record is split into multiple text blocks, thus completing the chunking process. Comparison of record internal severance rates under the three chunking configurations is shown below. Figure 3 As shown.

[0029] Step S3: Submit the segmented text blocks to the large language model. The model reads the text content to perform entity recognition and extract the relationships between entities. Based on the extracted entity and relationship results, a knowledge graph is constructed. Example: Comparison of hit rates for multiple queries in two formats. Figure 4 As shown; the comparison of the number of entities in the four groups of ablation control experiments is as follows. Figure 5 As shown.

[0030] The expression for the function to concatenate key-value pairs into a table is as follows: ; In the formula, the symbol This indicates that the data is concatenated according to the format "field name: field value"; A function to standardize field values, enabling the removal of units from numerical values, standardization of date formats, and removal of watermarks from text. Represents the default delimiter, inserted only between records; when , ;when , Empty.

[0031] Furthermore, during the text conversion process in step S1, one or more of the following fields—name, location, and category—can be selected to generate key-value pairs. The name field carries text content that uniquely identifies the subject of the business record; the location field stores information reflecting the geographical affiliation of the subject; and the category field records the business category to which the subject belongs. Each selected field is output independently on a separate line, with the field name written at the beginning of each line. When the large language model reads the text, it can directly distinguish the content corresponding to different attributes, facilitating the discovery of various relationships between different entities.

[0032] Furthermore, before executing step S1, step S0 is executed. The program traverses the directory path where the table file is stored, reads the name of the direct parent directory corresponding to the table file, and uses the read directory name as the value of the category field for all records in the table. This value is then written to the key-value pair text line corresponding to each record. The entire process can supplement category information without modifying the original table file. If the table file is placed directly in the root directory and there is no parent business category subdirectory, then the category field is not appended to the corresponding record in that file.

[0033] Furthermore, when configuring the text block size threshold in step S2, the token values ​​consumed by each record after converting all records into key-value pairs are pre-calculated. The maximum value among all record token values ​​is taken, and the threshold for the size that the text block can accommodate is set to be greater than this maximum value. Thus, all the text content corresponding to any complete record can be completely contained within the same text block, and there will be no situation where a single record is split into two different text blocks.

[0034] Block-based solution is a constrained minimization problem, with the following mathematical constraints: ; ; ; ; In the formula, For the entire set of records, For the first Each text block For token estimation function, The target size is the text block size. Constraints include: all records must be completely covered; blocks must be non-overlapping; the total number of tokens in each block must not exceed the upper limit; each complete record can belong to only one block; and cross-block splitting is prohibited. This can be approximated using a greedy algorithm, scanning each record only once. Under these constraints, the internal truncation rate of a record is always zero.

[0035] Furthermore, in step S1, a uniform preset delimiter is written between the output text of two adjacent business records. This character sequence serves as a boundary marker between different records. After reading the converted text in step S2, the preset delimiter is identified first as the text cutting position. When the cumulative text content read is about to reach the upper limit of the text block size, the processing logic falls back to the most recently identified preset delimiter position to complete the segmentation.

[0036] If only step S1 is executed, using the standard token-driven segmentation logic, the total number of text blocks will increase significantly, and the number of API calls will increase accordingly. If only step S2 is executed, the original input is ordinary paragraph text, and there are no field name markers within the text. Even if the complete record is stored in a single text block, the large language model will have difficulty recognizing the entities and relationships contained within the fields. Executing these two processes together ensures that each business record's text remains intact and is not segmented, while also improving the extraction of entity relationships by leveraging field prefix markers. Simultaneously, it controls the overall number of text blocks, keeping API call overhead within a reasonable range.

[0037] To quantify the improvement in entity relation extraction quality caused by input format, a format improvement factor is defined: ; In the formula, This represents the total amount of relation extraction under key-value pair format. Extract the total amount of paragraph formatting relationships under the same conditions.

[0038] The record truncation rate is defined to measure the degree of damage caused by partitioning to a record: ; In the formula, The total number of original records. This represents the number of records in all blocks that can be fully identified and restored.

[0039] Define an interaction effect discriminant to determine whether there is a non-independent interaction relationship between two processing steps: ; In the formula, These correspond to the evaluation index values ​​of the four experimental groups A, B, C, and D, respectively. This indicates that the two technical factors act independently of each other; This indicates that there is an interaction effect between the two technological factors.

[0040] Further define the knowledge graph comprehensive evaluation function to quantify the overall performance of multi-dimensional solutions: ; In the formula, The relation density is equal to the number of relations divided by the number of records. Name completeness rate; The number of blocks; the weighting coefficients satisfy... ; This represents the maximum relation density. This is the minimum number of blocks, used for index normalization.

[0041] The table below compares the operating costs of the four experimental groups: Table 1 Comparison of the Four Schemes

[0042] Note: Fees are based on deepseek. ChatAPI cost is estimated at approximately 0.004 yuan per thousand tokens, with each call using approximately 3500 tokens. Group A's cost is 38% of Group B's and 43% of Group D's, while generating 3.95 times the number of relationships as Group C.

[0043] Furthermore, before performing table format conversion in step S1, record deduplication and merging are performed. The record identifier field is selected as the comparison criterion. All rows of data in the table are traversed. When the content of the record identifier field is the same in different rows, it is determined to belong to the same business record, and multiple original entries are merged into one record for output. Tag-type fields are incrementally appended, and other business fields prioritize the non-empty content obtained from the first read. In the final output key-value pair text, only one copy of each business record is retained to avoid generating duplicate entity nodes when building the knowledge graph later.

[0044] Furthermore, during the table processing in step S1, column structure compatibility processing is performed, and a field mapping dictionary is established. This dictionary uses column name strings as the retrieval index, rather than reading the column number of the cell. In different versions of exported tables, the column number of the same business field may change. The field mapping dictionary relies on matching column names to the corresponding cell data, eliminating the need to modify the processing script for different versions of the table. This allows for the extraction of field content and adapts to various exported table files with differences in the number of columns or changes in column order.

[0045] Furthermore, during step S1 when reading the original table content, automatic header row detection is performed. The content of the first cell in the first row and first column of the table is read, and it is determined whether the cell text contains keywords related to disclaimers or whether the cell character length exceeds a preset threshold. If either condition is met, the row is considered not to be a business header, and the header row is moved to the next row of the table; if the condition is not met, the first row of the table is used as the header row. Some data source exported files may include explanatory text at the beginning; this processing logic can skip these non-business content rows to ensure correct header identification.

[0046] This embodiment provides a computer-readable storage medium, which can be a USB flash drive, a portable hard drive, a read-only memory, a random access memory, a magnetic disk, or an optical disk. The medium stores computer program code, and the device processor reads and runs the program code to execute all the above-described method steps.

[0047] This implementation provides a knowledge extraction input format optimization system for structured tabular data. The system includes a directory classification extraction module, a key-value pair conversion module, a paragraph-aware segmentation module, and an entity relation extraction module. The directory classification extraction module reads the file system directory structure, obtains the parent directory name, and gets the category label; the key-value pair conversion module reads the tabular file, converts each row of the table into key-value pair text, and writes preset delimiters between records; the paragraph-aware segmentation module reads the converted text, prioritizes the preset delimiters as the segmentation positions, and the upper limit of the text block is greater than the maximum token of a single record; the entity relation extraction module calls a large language model to read the segmented text, extracts entities and relations, and builds a knowledge graph. Each module can be deployed and run independently. When the hardware conditions are met, ordinary consumer-grade graphics processing devices can handle all inference operations.

[0048] An Excel spreadsheet containing enterprise business information is selected as the input data source. The spreadsheet includes multiple business fields such as enterprise name, city, district / county, registered address, legal representative, registered capital, establishment date, enterprise size, industry classification, and enterprise profile. This provides a detailed description of the complete implementation process of this patent. The Excel file is placed in a folder named "Cross-border E-commerce Seller." The program traverses the file directory tree, reads the folder name, and uses it as the industry classification value for all records in the file. The first cell of the first row and first column of the Excel spreadsheet contains explanatory text attached to the data source. Since the character length exceeds a preset threshold, the first row is determined to be a disclaimer row, and the second row is identified as the header row. All column name strings in the header are read to establish a field mapping dictionary. Data content of each cell is extracted based on the column name strings. The registered capital field is stripped of its currency unit, retaining only the numerical value. The establishment date is uniformly adjusted to YYYY. MM The DD standard format removes redundant explanatory text from the company profile field. It iterates through all rows of the table, using the company name as the record identifier field, merging multiple original entries with identical company names. Tag-type fields are appended and merged, while other fields retain only the first non-empty occurrence. After processing, each field of each company record is output as a separate text line in the format "field name:field content," with double line breaks inserted between every two company records as a preset separator. The total number of tokens consumed after the conversion of all company records is calculated, yielding the maximum total token value. The maximum character limit for a text block is set to 3,000 characters, exceeding the aforementioned maximum token value. The block processing program reads complete key-value pair text. When the accumulated characters approach 3,000, it retrieves the nearest double line break and performs text splitting at that position. Each text block contains one or more complete company records; company records are not split into different text blocks. Each text block is sequentially submitted to the large language model. The model reads the text content marked with field names, identifies entities and their relationships among enterprises, individuals, and regions, and outputs entity-relationship triples. These triples are then imported into a graph database to complete the knowledge graph construction. To evaluate the processing effect, four control experiments were set up: Group A used both key-value pair transformation and preset delimiter-based segmentation; Group B only performed key-value pair transformation and used ordinary fixed token segmentation; Group C converted tables into ordinary paragraph text and used preset delimiter-based segmentation; Group D converted tables into ordinary paragraph text and used ordinary fixed token segmentation. All four experiments used the same batch of 2,230 enterprise records and the same large language model parameters for testing. Group A yielded 8,765 entity relationships and 258 text blocks, with all enterprise records completely preserved within each text block. Group B had 11,986 entity relationships and 679 text blocks. Group C had 2,218 entity relationships, with no record slicing. Group D had 2,760 entity relationships, but only 21.8% of the enterprise names could be fully identified. This processing flow can also be applied to other structured record tables such as medical institution registration data, academic paper metadata, product catalog data, and real estate registration data. Only the corresponding business field names need to be adjusted to complete the knowledge graph construction.

[0049] The embodiments described in this specification are merely examples of implementations of the inventive concept. The scope of protection of this invention should not be considered as limited to the specific forms stated in the embodiments. The scope of protection of this invention also extends to equivalent technical means that can be conceived by those skilled in the art based on the inventive concept.

Claims

1. A method for optimizing input for structured tabular knowledge extraction, characterized in that, Includes the following steps: Step S1: Convert each row of the structured record table into key-value pair text, where each field is on a separate line and is marked with the field name as a prefix, and all records are separated by a preset delimiter; Step S2: Configure the text segmentation strategy, using the preset delimiter as the priority segmentation boundary, and set the text block size to be greater than the threshold of the maximum number of tokens in a single record; Step S3: Use the large language model to extract entity relationships from the text blocks generated in step S2 and construct a knowledge graph.

2. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, The key-value pair text fields mentioned in step S1 include at least one of the following three categories: a name field used to identify the record subject; a location field used to describe the geographical location of the record subject; and a category field used to describe the category to which the record subject belongs.

3. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, It also includes step S0: automatically extracting category labels from the directory structure where the file is located, and writing the file's parent directory name as the category field value of all records in the file into the key-value pair text in step S1.

4. The structured tabular knowledge extraction input optimization method according to claim 1, characterized in that, The text block size threshold mentioned in step S2 is determined based on the maximum number of tokens in all record texts to ensure that a single record is not truncated across blocks.

5. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, The preset separator inserted between records in step S1 provides a recognizable boundary marker between records for step S2. Step S2 uses the preset separator as the priority dividing boundary to avoid the block operation from destroying the integrity of the single record text generated in step S1.

6. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, Before step S1, there is also a record deduplication and merging step: the structured table is deduplicated according to the record identifier field, multiple entries of records with the same name are merged into one, ensuring that the same record appears only once in the key-value pair text.

7. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, Step S1 also includes column structure compatibility processing: a field mapping dictionary is created by column name rather than column order to be compatible with multiple versions of table export formats with different numbers of columns or different column orders.

8. The structured table knowledge extraction input optimization method according to claim 1, characterized in that, Before step S1, there is also an automatic header row detection step: determine whether the first cell of the first row and first column contains disclaimer keywords or the cell content length exceeds a preset threshold. If so, determine that the first row is not a header row and position the header to the second row.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the structured tabular knowledge extraction input optimization method as described in any one of claims 1 to 8.

10. A structured tabular knowledge extraction input optimization system, characterized in that, include: The directory category extraction module is used to automatically extract category tags from the directory structure where the files are located; The key-value pair conversion module converts each row of a structured record table into key-value pair text, with records separated by a preset delimiter; the paragraph-aware segmentation module segments the text into blocks based on the preset delimiter as the priority segmentation boundary, with the text block size set to a threshold greater than the maximum number of tokens in a single record; and the entity relation extraction module calls a large language model to extract entity relations from the segmented text and construct a knowledge graph.