Header column recognition method based on deep semantics and context adaptation
Through deep semantic and context-adaptive header column recognition methods, the problems of low accuracy and weak generalization ability in complex header recognition are solved, and high-precision header semantic classification is achieved, which is suitable for business scenarios such as financial auditing, tax compliance, and supply chain management.
Patent Information
- Application Number
- CN202510686107.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-27
- Publication Date
- 2025-09-09
- Estimated Expiration
- 2045-05-27
AI Technical Summary
Existing technologies have low recognition accuracy and weak generalization capabilities when dealing with complex and changeable header recognition tasks, especially when faced with tabular data with diverse structures, irregular naming, semantic ambiguity, and long-tail distribution, making it difficult to meet the needs of high-precision data processing and intelligent analysis.
A header column recognition method based on deep semantics and context adaptation is adopted. The header text and table structure features are obtained through a table parsing tool. Feature encoding and fusion are combined with a pre-trained language model to build a header semantic classification model. The model is trained using a multi-objective loss function to improve the adaptability and accuracy of the model.
The accuracy of header recognition and the adaptability of the model have been significantly improved. It can automatically understand the deep semantics of the header and accurately determine the actual meaning of the header in different tasks, meeting the actual needs of multiple tasks and multiple fields.
Smart Images

Figure CN120197611B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical fields of artificial intelligence, natural language processing and intelligent analysis of structured data, and more specifically to a table header column recognition method based on deep semantics and context adaptation. Background Art
[0002] In real-world business, spreadsheets (such as Excel and CSV) serve as core data carriers and are widely used in various data collection, statistics, and analysis processes. The header row (or rows) of a table plays a key role in semantically describing the data content of each column, such as fields like "sales," "customer ID," and "order date." This serves as the foundation for subsequent data parsing, classification, and analysis. However, the actual design and expression of header columns varies greatly, primarily in the following aspects:
[0003] 1. Structural complexity: The header may contain complex structures such as multi-level nesting, merged cells, and spanning rows and columns, which increases the difficulty of parsing;
[0004] 2. Random naming: Table headers with the same business semantics may be expressed in a variety of ways, including abbreviations, pinyin, and internal codes, lacking a unified standard.
[0005] 3. Semantic ambiguity: The same header text may have different meanings in different business scenarios or contexts, and needs to be distinguished based on the table content. For example, "balance" can refer to both account balance and inventory balance; "date" can refer to both order date and shipping date.
[0006] 4. Long-tail distribution phenomenon: In addition to common table headers, a large number of table headers belong to the low-frequency, fine-grained "long-tail" category, which is difficult to fully cover with limited samples.
[0007] Traditional table header recognition methods often rely on manual rules, keyword matching, or templates, lacking a deep understanding of table header semantics. While effective in specific formats, these methods suffer from poor generalization and maintenance efficiency when faced with real-world tables with variable structures, diverse naming, and ambiguous semantics (such as multi-level headers and merged cells). Recognition accuracy drops significantly, making it difficult to identify the equivalence between "Sales Amount" and "Sales Amount," or to contextually distinguish the specific meaning of fields like "Address." Furthermore, the high cost of maintaining and expanding rule systems makes it difficult to adapt to complex cross-domain and cross-industry business needs, resulting in poor generalization and sustainability.
[0008] Early machine learning methods (such as feature-engineered classifiers) and some deep learning models (such as basic CNNs / RNNs) have made progress in improving automation, but they still have significant shortcomings in deep semantic understanding, dynamic context modeling, and long-tail category discrimination. These methods are particularly limited in modeling the semantics of table headers. These methods rely on shallow features, making it difficult to capture the deep semantics and fine-grained differences in table header text. They also fail to fully leverage the linguistic knowledge contained in large-scale unlabeled text. This results in limited classification effectiveness when dealing with complex, varied, or semantically similar but categorized table headers, particularly poor performance in long-tail and fine-grained classification scenarios.
[0009] In recent years, pre-trained language models (such as BERT) have been introduced to the field of table header recognition, improving the semantic representation capabilities of table headers through methods such as sequence labeling or text classification. However, existing methods often focus on the table header text itself, failing to fully integrate the overall table content and contextual information. This leads to limitations in handling semantic ambiguity, complex structures, and long-tail categories. Furthermore, the lack of targeted mechanisms to dynamically adapt to different business scenarios and new table header structures affects the model's generalization and practical application effectiveness. For example, it is difficult to distinguish between "order date" and "shipping date" based on "date" alone, while product or logistics information in table data can provide key discriminative clues. Existing models lack mechanisms specifically designed to enhance feature discriminative power when handling semantic ambiguity, long-tail categories, and fine-grained classification. This makes it easy to misclassify rare or ambiguous table headers as common categories, resulting in reduced classification accuracy.
[0010] Furthermore, some technologies conflate header row location with header column semantic classification, focusing on identifying the boundaries of the header region while neglecting the in-depth identification of the specific semantics of each column within it. While multi-task or multi-agent learning paradigms can improve model generalization to a certain extent, they still have significant shortcomings in enhancing feature space discrimination and adapting to long-tail distributions and complex business scenarios.
[0011] Therefore, how to deeply understand the semantics of header columns, make full use of the contextual information of table content, and improve robustness to achieve new types of automated header column recognition and classification for naming diversity, semantic ambiguity, and long-tail distribution, so as to meet the actual needs of high-precision data processing and intelligent analysis, especially in application requirements in high-standard scenarios such as evaluation and review, is an issue that technical personnel in this field urgently need to solve. Summary of the Invention
[0012] In view of the above problems, the present invention provides a table header column recognition method based on deep semantics and context adaptation to at least solve some of the technical problems mentioned in the above background technology.
[0013] In order to achieve the above object, the present invention adopts the following technical solutions:
[0014] The header column recognition method based on deep semantics and context adaptation includes the following steps:
[0015] Use a table parsing tool to perform structural analysis on the target table file to obtain the target table header text, target table body text and target table structure corresponding to the target table file;
[0016] Performing feature encoding on the target header text to obtain target header features;
[0017] Extracting features from the target table body text and the target table structure to obtain target scene context features;
[0018] Fusing the target header feature and the target scene context feature to generate a target comprehensive feature;
[0019] The target comprehensive features are input into the trained header semantic classification model, the probability distribution of each category corresponding to the target table file is output, and the category with the largest probability is taken as the final header semantic classification result.
[0020] Furthermore, the feature encoding of the target header text to obtain target header features specifically includes:
[0021] Performing word segmentation on the target header text, and after standardization, inputting the segmented words into the fine-tuned pre-trained language model to obtain target header features;
[0022] For multi-line or multi-level target header texts, after obtaining the target header features of each target header text, the obtained multiple target header features are embedded, spliced or weightedly fused to obtain the final target header features.
[0023] Furthermore, the feature extraction of the target table main text and the target table structure to obtain the target scene context features specifically includes:
[0024] Extract the target table's main text, convert the extracted target table content into a standardized Markdown format, and then input it into a pre-trained open source large language model text encoder as content features to obtain target scene context features.
[0025] If target table structure information exists, the target table structure is encoded as an additional feature and input into the pre-trained open source large language model text encoder together with the content feature to obtain the target scene context feature.
[0026] Furthermore, the training steps of the header semantic classification model include:
[0027] Constructing a table header semantic classification dataset; the table header semantic classification dataset includes multiple table header texts, and table body text, table structure and category labels corresponding to each of the table header texts;
[0028] Performing feature encoding on each of the header texts to obtain header features;
[0029] Extracting features from each table body text and the corresponding table structure to obtain scene context features;
[0030] Fusing the corresponding header features and scene context features to generate comprehensive features;
[0031] The comprehensive features are used as input and combined with the corresponding category labels to train the header semantic classification model.
[0032] Furthermore, the steps of constructing the header semantic classification dataset include:
[0033] Perform structural analysis on the obtained multiple original table files to obtain the header area, table body text and table structure of each original table file;
[0034] Locating candidate header cells from the header area, and preliminarily classifying the candidate header texts therein;
[0035] Based on the table body text, verify the preliminary classification result of each candidate header text to obtain a category label for each candidate header text;
[0036] Based on the candidate header texts with existing category labels, sample clustering and expansion are performed to obtain the expanded table texts and their category labels;
[0037] All candidate header texts and expanded table texts are taken as the final header texts. All header texts and their category labels, as well as the corresponding table body texts and table structures are summarized to form a header semantic classification dataset.
[0038] Furthermore, the step of locating candidate header cells in the header area and preliminarily classifying the candidate header texts therein specifically includes:
[0039] Based on the table structure information, locating a cell corresponding to a candidate header in the header area;
[0040] After regularizing the candidate header texts in the candidate headers, the candidate header texts are preliminarily classified using the preset domain knowledge base;
[0041] The basis for the preliminary classification includes: if the candidate header text matches an entry in the preset domain knowledge base, then directly using the entry as the category label of the candidate header text; if not, then marking the category of the candidate header text as pending.
[0042] Furthermore, based on the table body text, the preliminary classification result of each candidate header text is verified to obtain a category label of each candidate header text; specifically, the process includes:
[0043] For the candidate header text marked as pending, the candidate header text and the table body text are combined to extract the context text and construct the input sample;
[0044] Input the input sample into the pre-trained large language model in a standardized format and output a classification proposal and a confidence score;
[0045] If the confidence score is greater than or equal to the threshold, the classification suggestion output by the large language model is used as the category label of the candidate header text to be determined;
[0046] If the confidence score is less than the threshold, the input sample is added to the manual review queue and manually annotated as the category label of the candidate header text to be determined.
[0047] Furthermore, the candidate header texts based on the existing category labels are clustered and expanded to obtain the expanded table texts and their corresponding category labels, specifically including:
[0048] For candidate header texts with existing category labels, extract their text embedding vectors;
[0049] Clustering the text embedding vectors using a clustering algorithm to obtain fine-grained categories and long-tail categories;
[0050] For fine-grained categories or long-tail categories whose number of cluster center samples is lower than the preset value, synonyms and near-synonymous phrases are generated, or sample clustering expansion is achieved through data augmentation to obtain expanded table text and its category labels.
[0051] Furthermore, the candidate header text and its category label are used as the original sample;
[0052] The expanded table text and its category labels are used as expanded samples;
[0053] Using the contrastive learning method, the expanded samples and the original samples are combined into positive and negative sample pairs to guide the training of the header semantic classification model.
[0054] Furthermore, the multi-objective loss function of the header semantic classification model during the training process includes a semantic classification loss function, a contrast loss function, and a context consistency loss function; it is expressed as:
[0055]
[0056]
[0057]
[0058]
[0059] in, represents the multi-objective loss function; represents the semantic classification loss function; represents the contrast loss function; represents the context consistency loss function; Represents the weight of the semantic classification loss function; Represents the weight of the contrast loss function; Represents the weight of the context consistency loss function; K represents a total of K categories; represents the true label of the k-th category; represents the predicted label probability of the kth category; z represents the current sample feature, z + represents the positive sample feature, z − represents the negative sample feature, τ is the temperature parameter; N represents the number of sample logarithms; and are the predicted label probabilities of the header text in the i-th pair of samples under different contexts; D KL represents KL divergence, that is, relative entropy.
[0060] It can be seen from the above technical solutions that, compared with the prior art, the present invention discloses a table header column recognition method based on deep semantics and context adaptation, which has the following beneficial effects:
[0061] The present invention can not only automatically extract and understand the deep semantics of the table header, but also make full use of the contextual information of the table content and business scenarios to accurately determine the actual meaning of the table header in different tasks, thereby significantly improving the recognition accuracy and adaptability of the model.
[0062] This paper fine-tunes a pre-trained deep network model to perform feature encoding on the header text, accurately capturing the semantic information of the header. The low-rank adaptive fine-tuning method effectively reduces the risk of overfitting, improves model training efficiency, and supports efficient optimization for specific tasks with small amounts of annotated data, eliminating the need for tedious manual feature design.
[0063] The present invention integrates table content, structure and business scenario information, and uses a large language model to perform comprehensive semantic analysis of table headers and their contexts. It can identify the ambiguity of the same table header in different scenarios, ensure the accuracy and consistency of the classification results, and meet the actual needs of multiple tasks and multiple fields.
[0064] The technical solution of the present invention is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0066] Figure 1 A flowchart of a table header column recognition method based on deep semantics and context adaptation is provided in an embodiment of the present invention.
[0067] Figure 2 A schematic diagram of the process of constructing a header semantic classification dataset provided by an embodiment of the present invention.
[0068] Figure 3 Schematic diagram of the training steps of the header semantic classification model provided in an embodiment of the present invention.
[0069] Figure 4 Schematic diagram of the multi-objective header semantic classification loss function optimization process provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0070] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0071] This invention aims to provide a table header column recognition method based on deep semantics and contextual adaptation. It is specifically designed to address the core challenges of existing technologies, such as low recognition accuracy, weak generalization, and insufficient processing of fine-grained and long-tail categories in complex spreadsheet scenarios with diverse formats, non-standard naming, semantic ambiguity, and strong contextual dependencies. This method is designed for intelligent parsing and semantic normalization of large-scale, heterogeneous tabular data, and is widely applicable to business scenarios such as financial auditing, tax compliance, supply chain management, and enterprise data governance that require extremely high data structure and semantic consistency. Figure 1As shown, the following steps are included:
[0072] S1. Use a table parsing tool to perform structural parsing on the target table file to obtain the target table header text, target table body text and target table structure corresponding to the target table file;
[0073] S2. Feature encode the target header text to obtain target header features;
[0074] S3, extracting features from the target table main text and target table structure to obtain target scene context features;
[0075] S4, fuse the target header features and the target scene context features to generate the target comprehensive features;
[0076] S5 inputs the target comprehensive features into the trained header semantic classification model, outputs the probability distribution of each category corresponding to the target table file, and takes the category with the highest probability as the final header semantic classification result.
[0077] The above-mentioned marks S1-S5 are only for the convenience of explanation and do not limit the execution order of each step.
[0078] This method supports full-process automation, eliminating the need for manual rule configuration, template maintenance, or manual proofreading, greatly improving the efficiency and consistency of understanding table header semantics. It is particularly suitable for scenarios that require processing massive amounts of heterogeneous table data, such as financial audits, tax compliance checks, supply chain data analysis, and enterprise-level data integration and governance. It helps support data asset standardization, intelligent management, and high-quality analytical decision-making. It not only significantly improves the intelligence level and business applicability of table header column semantic classification, but also provides solid technical support for enterprises to achieve efficient and low-cost data governance and intelligent analysis. Next, each of the above steps will be explained.
[0079] In the above step S1, a table parsing tool is used to perform structural parsing on the target table file to obtain the target table header text, target table body text and target table structure corresponding to the target table file; specifically:
[0080] After performing structured parsing on the target table file using a table parsing tool (such as pandas, openpyxl, etc.), the target header area, target data area, and target table structure (such as cell merge relationships) are automatically identified; then, the target header text and target table body text are extracted from the target header area and target data area respectively.
[0081] In the above step S2, the target header text is feature-encoded to obtain the target header features; specifically:
[0082] Perform word segmentation on the target header text, standardize the segmented words, and then input them into a fine-tuned pre-trained language model (such as the BERT model) to obtain the target header features;
[0083] For multi-line or multi-level target header texts, after obtaining the target header features of each target header text, the obtained multiple target header features are embedded, spliced or weightedly fused to obtain the final target header features.
[0084] In the above step S3, feature extraction is performed on the target table main text and the target table structure to obtain the target scene context features; specifically:
[0085] Extract the target table's main text (such as the first few rows of data, table title, and related descriptions) and convert the extracted target table content into a standardized Markdown format. This content is then fed into the text encoder of a pre-trained open-source large language model (such as the Qwen2.5 model) as content features to obtain the target scene context features.
[0086] If there is target table structure information (such as grouping and merging cells), the target table structure is encoded as an additional feature and input into the pre-trained open source large language model text encoder together with the content features to obtain the target scene context features.
[0087] In the above step S4, the target header features and the target scene context features are fused by splicing, weighted averaging or attention mechanism to generate target comprehensive features;
[0088] In the above step S5, the target comprehensive features are input into the trained header semantic classification model. In the header semantic classification model, the probability distribution of each category corresponding to the target table file is output through a multi-layer perceptron or a softmax classification head, and the category with the largest probability is taken as the final header semantic classification result.
[0089] Next, the training process of the header semantic classification model will be described in detail. Specifically, the training process of the header semantic classification model includes a header semantic classification dataset construction phase and a header semantic classification model training phase.
[0090] 1. The stage of constructing the header semantic classification dataset can be found in Figure 2 As shown:
[0091] In an embodiment of the present invention, a table header semantic classification dataset needs to be constructed for training a subsequent table header semantic classification model; the constructed table header semantic classification dataset includes multiple table header texts, as well as table body text, table structure, and category labels corresponding to each table header text;
[0092] The specific construction process is as follows:
[0093] (1) Perform structural analysis on the multiple original table files obtained to obtain the header area, table body text and table structure of each original table file; specifically:
[0094] ① Automatically batch-collect original spreadsheet files from multiple source business systems (such as finance, tax, supply chain, etc.), supporting multiple formats such as Excel, CSV, and database export;
[0095] ② Use table parsing tools (such as pandas, openpyxl, etc.) to perform structural analysis on table files, automatically identify the header area, data area and table structure (such as cell merge relationships); the table body text can be extracted from the data area;
[0096] ③ Standardize the analysis results into a unified data structure for easy subsequent processing.
[0097] (2) Locate candidate header cells in the header area and preliminarily classify the candidate header texts therein; specifically:
[0098] ① Based on the table structure information (such as the first row, merged cells, bold font, etc.), automatically locate the cell corresponding to the candidate header in the header area;
[0099] ② After regularizing the candidate header text (such as removing spaces, unifying capitalization, and removing special symbols), the candidate header text is preliminarily classified using the preset domain knowledge base;
[0100] The basis for preliminary classification includes: if the candidate header text matches an entry in the preset domain knowledge base, the entry is directly used as the category label of the candidate header text; if it does not match, the category of the candidate header text is marked as pending.
[0101] (3) Based on the main text of the table, verify the preliminary classification results of each candidate header text to obtain the category label of each candidate header text; specifically:
[0102] ① For the candidate header text marked as pending, combine the candidate header text and the table body text to extract the context text (such as adjacent fields, table title, partial data samples) and construct the input sample;
[0103] ② Input the input sample in a standardized format (such as JSON or Markdown) into a pre-trained large language model (such as the Qwen2.5 model), and output classification suggestions and confidence scores;
[0104] If the confidence score is greater than or equal to a threshold (e.g., 0.8), the classification suggestion output by the large language model is used as the category label of the candidate header text to be determined;
[0105] If the confidence score is less than the threshold, the input sample is added to the manual review queue and manually annotated as the category label of the candidate header text to be determined.
[0106] ③ For multiple occurrences of the same header in different tables, the consistency of the classification suggestions output by the large language model is counted. If the consistency is lower than the set ratio (such as 80%), the manual review process is automatically triggered;
[0107] For example, for the table header "Sales," the system collects all category labels assigned by the large language model. If statistics show that the combined frequency of occurrence of mainstream category labels (such as "Sales Revenue" or "Total Sales") falls below a set threshold (for example, 70%), the system automatically marks "Sales" as requiring manual review, requiring human intervention to determine its actual meaning in each table.
[0108] This preliminary classification allows us to accurately map various table header columns (such as "Order Amount," "Customer Name," and "Shipping Date") to standardized business semantic categories or knowledge ontologies. This allows for highly accurate and fine-grained semantic classification, even for synonymous terms (such as "sales amount" and "sales amount") or polysemy (such as "address" and "date," which require contextual analysis).
[0109] By deeply integrating the main text information of the table and dynamically resolving semantic ambiguity in the header, we ensure that the classification results are highly consistent with the actual business context of the table, breaking through the limitations of isolated analysis relying solely on header text and significantly improving the model's adaptability to complex business scenarios.
[0110] (4) Based on the candidate header texts with existing category labels, perform sample clustering and expansion to obtain the expanded table texts and their category labels;
[0111] ① For candidate header texts with existing category labels, extract their text embedding vectors (which can be obtained using models such as BERT);
[0112] ② Use a clustering algorithm (such as K-means or DBSCAN) to cluster the text embedding vectors to obtain fine-grained categories (i.e., more specific or detailed semantic categories) and long-tail categories (i.e., header types that appear less frequently in the dataset);
[0113] ③ For fine-grained categories or long-tail categories where the number of cluster center samples is lower than a preset value (e.g., 10), generate synonyms, near-synonymous phrases, or implement sample cluster expansion through data augmentation (e.g., spelling variants, context substitution), and obtain expanded table text and its category labels;
[0114] This step can effectively handle complex structured tables such as multi-level headers and merged cells, as well as long-tail header columns with irregular naming and extremely low frequency of occurrence, significantly reducing the risk of misclassification and missed classification, and improving the stability and reliability of overall recognition.
[0115] (5) All candidate header texts and expanded table texts are taken as the final header texts, and all header texts and their category labels, as well as the corresponding table body texts and table structures, are summarized to form a header semantic classification dataset; specifically:
[0116] ① Summarize all table headers and their labels that have been automatically annotated, manually reviewed, and clustered to form a structured training dataset;
[0117] ② Perform deduplication, outlier detection, and label consistency verification on the data set to ensure data quality;
[0118] ③ Output high-quality header semantic classification dataset that can ultimately be used for model training.
[0119] In summary, in the embodiments of the present invention, in response to the practical problems of data scarcity, high annotation costs, and long-tail category distribution in the task of semantic classification of table headers, the present invention proposes an end-to-end automatic dataset construction and intelligent annotation system. First, the system automatically extracts candidate header columns from massive heterogeneous tables through a rule-guided weak supervision method and an active learning mechanism, and performs preliminary semantic classification in combination with the domain knowledge base. Subsequently, a large language model (LLM) is used to perform semantic consistency verification and automatic annotation of the table header and its contextual content, significantly improving the annotation efficiency and accuracy. In order to further enhance the coverage of long-tail categories, the system introduces a sample expansion strategy based on clustering and contrastive learning to automatically discover and supplement low-frequency, fine-grained category samples to ensure the representativeness and diversity of the dataset. The entire dataset construction process is highly automated and can dynamically adapt to different business scenarios and table structures, providing a high-quality, low-bias data foundation for subsequent model training.
[0120] 2. Training phase of the header semantic classification model; see Figure 3 As shown:
[0121] (1) Extract multiple header texts from the constructed header semantic classification dataset, as well as the table body text, table structure and category labels corresponding to each header text;
[0122] (2) Encode the features of each header text to obtain the header features; specifically:
[0123] ① Segment the header text, standardize the segmented words, and input them into a fine-tuned pre-trained language model (such as the BERT model) to obtain header features;
[0124] ② For multi-line or multi-level header texts, after obtaining the header features of each header text, embedding and splicing or weighted fusion of the obtained multiple header features are performed to obtain the final header features;
[0125] (3) Extract features from each table’s main text and corresponding table structure to obtain scene context features; specifically:
[0126] ① Extract the main text of the table (such as the first few rows of data, table title, and related descriptions), convert the extracted table content into a standardized Markdown format, and input it as content features into a pre-trained open source large language model (such as the Qwen2.5 model) to obtain scene context features;
[0127] ② If there is table structure information (such as grouping and merging cells), the table structure is encoded as an additional feature and input into the pre-trained open source large language model together with the content features to obtain scene context features.
[0128] (4) Fuse the corresponding header features and scene context features to generate comprehensive features; specifically:
[0129] ① The header features and scene features are fused through splicing, weighted averaging or attention mechanism to generate comprehensive features;
[0130] ② If the attention mechanism is used, the table header is used as the query, the scene features are used as the key and value, and the attention weight is calculated to increase attention to key context.
[0131] (5) Take the comprehensive features as input and combine them with the corresponding category labels to train the header semantic classification model; specifically:
[0132] ① Initialize the feature memory pool to store the representative header text and category labels of each category;
[0133] ②After each round of training, the mean of the header features of each category in the current batch is updated to the memory pool;
[0134] ③ During the training process, the current sample features are compared with the similar / different features in the memory pool for subsequent loss calculation.
[0135] In summary, in an embodiment of the present invention, a multi-level, cross-modal deep neural network architecture is adopted at the model level to integrate multi-source information of header text, table structure and table content to achieve refined semantic modeling of header columns. The core model is based on a fine-tuned pre-trained language model (such as BERT, RoBERTa, etc.), combined with a table structure encoder and a context-aware module, which can dynamically capture the semantic association between the header and the main content of the table. In order to improve the adaptability of the model to complex structures and long-tail categories, the system introduces a feature memory pool mechanism to continuously store and retrieve historical feature-label pairs to achieve feature enhancement for low-frequency categories. At the same time, the model supports end-to-end input and output processes, automatically completes header positioning, feature extraction and semantic classification, greatly reduces manual intervention, and improves the automation and generalization capabilities of the system.
[0136] This embodiment of the present invention utilizes a large language model to deeply analyze the contextual information of table content, achieving semantic understanding during the header recognition process. By analyzing specific business scenarios (such as finance and taxation) through contextual information, the system accurately identifies the header content, ensuring high accuracy in the recognition process. This process enables the system to better handle complex table data, improving recognition accuracy and robustness.
[0137] In another embodiment, further comprising:
[0138] The candidate header text and its category label are used as the original sample; the expanded table text and its category label are used as the expanded sample; using contrastive learning methods (such as SimCLR), the expanded sample and the original sample are combined into positive and negative sample pairs, thereby guiding the training of the header semantic classification model. In another embodiment, the multi-objective header semantic classification loss function design method that takes into account both the main task and long-tail adaptation is as follows: Figure 4 Specifically, the multi-objective loss function of the above-mentioned header semantic classification model during the training process includes the semantic classification loss function, the contrast loss function, and the context consistency loss function; specifically, they include:
[0139] 1. Semantic classification loss function:
[0140] For each training sample, the cross entropy loss function is used as the semantic classification loss function, which is expressed as:
[0141]
[0142] in, Represents the semantic classification loss function; K represents a total of K categories; represents the true label of the k-th category; represents the predicted label probability of the kth category;
[0143] 2. InfoNCE Loss
[0144] (1) For each training batch, sample positive sample pairs (same category) and negative sample pairs (different categories), and calculate the cosine similarity between the feature vectors respectively;
[0145] (2) Calculate the contrast loss function, expressed as:
[0146]
[0147] in, represents the contrast loss function; z represents the current sample feature, z + represents the positive sample feature, z − represents the negative sample feature, τ is the temperature parameter;
[0148] 3. Context consistency loss function:
[0149] (1) For multiple samples with the same header in different contexts, calculate the category probability distribution of their model outputs respectively;
[0150] (2) Use KL divergence or mean square error to constrain the output distribution of the same header in different contexts to remain consistent; expressed as:
[0151]
[0152] in, represents the context consistency loss function; N represents the number of sample pairs; and are the predicted label probabilities of the header text in the i-th pair of samples under different contexts; D KL Represents KL divergence, that is, relative entropy, which is used to measure the distance between distributions.
[0153] 4. Joint optimization objectives and model training:
[0154] (1) The multi-objective loss function is a weighted combination of multiple objectives; it is expressed as:
[0155]
[0156] in, represents the multi-objective loss function; Represents the weight of the semantic classification loss function; Represents the weight of the contrast loss function; represents the weight of the context consistency loss function;
[0157] (2) Using optimizers such as Adam, perform backpropagation and parameter updates based on the final loss function until the loss converges.
[0158] In summary, in order to solve the problems of fine-grained discrimination and long-tail distribution in the semantic classification of headers, the embodiment of the present invention innovatively designs a loss function system for multi-objective joint optimization. In addition to the traditional cross-entropy loss, the system introduces a discriminant loss based on contrastive learning, which effectively improves the model's discrimination ability in fine-grained categories and long-tail categories by maximizing the consistency of similar header features and minimizing the similarity of heterogeneous header features. The feature memory pool and contrast loss work together to enable the model to continuously optimize the feature space structure during training and enhance the generalization ability for new and rare headers. In addition, context consistency constraints are embedded in the loss function to ensure the semantic adaptability and robustness of the model in different business scenarios.
[0159] Next, to further illustrate the practical application effect of the present invention, the following two specific examples are given in combination with the model training and testing process:
[0160] Example 1: Training and testing of a header recognition model based on financial statements; specifically:
[0161] In this embodiment, approximately 5,000 financial tables are first collected from public data sources such as annual reports and quarterly reports of listed companies, covering various types such as balance sheets, income statements, and cash flow statements. By combining automated annotation tools and manual review, the header cells are annotated with semantic labels such as "total assets", "total liabilities", and "operating income" to form a structured training header semantic data set. The model uses a fine-tuned BERT large language model, inputs the header text and the content of its adjacent cells, and performs feature encoding and semantic classification. During the training process, cross-entropy loss and contrast loss are used for joint optimization to improve the recognition ability of mainstream categories and long-tail categories. After training, the model was evaluated on an independent test set of 1,000 financial statements, and the model header recognition accuracy reached 96.2%, significantly higher than the 82.5% of the traditional rule-based method.
[0162] Example 2: Training and testing of header recognition models for supply chain management; specifically:
[0163] In this embodiment, a total of 3,000 supply chain-related forms such as purchase orders, inventory sheets, and delivery notes from 10 manufacturing companies were collected. Using an automated labeling system, combined with the enterprise business knowledge base, semantic annotations are performed on header cells such as "material code", "supplier name", and "warehousing date". During the model training phase, the context-awareness mechanism is integrated to input the header text, adjacent cell content, and table structure information into the fine-tuned RoBERTa model. A multi-objective loss function is used during training, taking into account both the accuracy of the main task and the ability to distinguish long-tail categories. During the testing phase, header recognition was performed on 500 unseen supply chain forms, and the model accuracy reached 93.8%. It can adapt to forms of different companies and formats, and accurately classify various business fields.
[0164] In summary, the embodiments of the present invention systematically improve the automation, accuracy, and adaptability of header column semantic classification through automated dataset construction, highly integrated deep model architecture, and innovative multi-objective loss function design, providing a solid technical foundation for intelligent analysis and high-quality data governance of large-scale, heterogeneous tabular data.
[0165] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0166] The above description of the disclosed embodiments is intended to enable one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be readily apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention is not limited to the embodiments shown herein but is intended to conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A table header column recognition method based on deep semantics and context adaptation, characterized by: The steps include: Use a table parsing tool to perform structural analysis on the target table file to obtain the target table header text, target table body text and target table structure corresponding to the target table file; Performing feature encoding on the target header text to obtain target header features; Extracting features from the target table body text and the target table structure to obtain target scene context features; Fusing the target header feature and the target scene context feature to generate a target comprehensive feature; Input the target comprehensive features into the trained header semantic classification model, output the probability distribution of each category corresponding to the target table file, and take the category with the highest probability as the final header semantic classification result; performing feature encoding on the target header text to obtain target header features; Specifically include: Performing word segmentation on the target header text, and after standardization, inputting the segmented words into the fine-tuned pre-trained language model to obtain target header features; For multi-line or multi-level target header texts, after obtaining the target header features of each target header text, embedding and splicing or weighted fusion are performed on the obtained multiple target header features to obtain the final target header features; The feature extraction of the target table main text and the target table structure to obtain the target scene context features specifically includes: Extract the target table's main text, convert the extracted target table content into a standardized Markdown format, and then input it into a pre-trained open source large language model text encoder as content features to obtain target scene context features. If target table structure information exists, the target table structure is encoded as an additional feature and input into the pre-trained open source large language model text encoder together with the content feature to obtain the target scene context feature.
2. The method for identifying table header columns based on deep semantics and context adaptation according to claim 1, characterized in that: The training steps of the header semantic classification model include: Constructing a table header semantic classification dataset; the table header semantic classification dataset includes multiple table header texts, and table body text, table structure and category labels corresponding to each of the table header texts; Performing feature encoding on each of the header texts to obtain header features; Extracting features from the main text of each table and the corresponding table structure to obtain scene context features; Fusing the corresponding header features and scene context features to generate comprehensive features; The comprehensive features are used as input and combined with the corresponding category labels to train the header semantic classification model.
3. The method for identifying table header columns based on deep semantics and context adaptation according to claim 2, characterized in that: The steps for constructing the header semantic classification dataset include: Perform structural analysis on the obtained multiple original table files to obtain the header area, table body text and table structure of each original table file; Locating candidate header cells from the header area, and preliminarily classifying the candidate header texts therein; Based on the table body text, verify the preliminary classification result of each candidate header text to obtain a category label for each candidate header text; Based on the candidate header texts with existing category labels, sample clustering and expansion are performed to obtain the expanded table texts and their category labels; All candidate header texts and expanded table texts are taken as the final header texts. All header texts and their category labels, as well as the corresponding table body texts and table structures are summarized to form a header semantic classification dataset.
4. The method for identifying table header columns based on deep semantics and context adaptation according to claim 3, characterized in that: The step of locating candidate header cells in the header area and preliminarily classifying the candidate header texts therein specifically includes: Based on the table structure information, locating a cell corresponding to a candidate header in the header area; After regularizing the candidate header texts in the candidate headers, the candidate header texts are preliminarily classified using the preset domain knowledge base; The basis for the preliminary classification includes: if the candidate header text matches an entry in the preset domain knowledge base, then directly using the entry as the category label of the candidate header text; if not, then marking the category of the candidate header text as pending.
5. The method for identifying table header columns based on deep semantics and context adaptation according to claim 4, characterized in that: The method of verifying the preliminary classification result of each candidate header text based on the table body text to obtain a category label of each candidate header text specifically includes: For the candidate header text marked as pending, the candidate header text and the table body text are combined to extract the context text and construct the input sample; Input the input sample into the pre-trained large language model in a standardized format and output a classification proposal and a confidence score; If the confidence score is greater than or equal to the threshold, the classification suggestion output by the large language model is used as the category label of the candidate header text to be determined; If the confidence score is less than the threshold, the input sample is added to the manual review queue and manually annotated as the category label of the candidate header text to be determined.
6. The method for identifying table header columns based on deep semantics and context adaptation according to claim 4, characterized in that: The sample clustering expansion based on the candidate header text with existing category labels to obtain the expanded table text and its corresponding category label specifically includes: For candidate header texts with existing category labels, extract their text embedding vectors; Clustering the text embedding vectors using a clustering algorithm to obtain fine-grained categories and long-tail categories; For fine-grained categories or long-tail categories whose number of cluster center samples is lower than the preset value, synonyms and near-synonymous phrases are generated, or sample clustering expansion is achieved through data augmentation to obtain expanded table text and its category labels.
7. The method for identifying table header columns based on deep semantics and context adaptation according to claim 3, characterized in that: Take the candidate header text and its category label as the original sample; The expanded table text and its category labels are used as expanded samples; Using the contrastive learning method, the expanded samples and the original samples are combined into positive and negative sample pairs to guide the training of the header semantic classification model.
8. The method for identifying table header columns based on deep semantics and context adaptation according to claim 7, characterized in that: The multi-objective loss function of the header semantic classification model during training includes a semantic classification loss function, a contrast loss function, and a context consistency loss function; it can be expressed as: in, represents the multi-objective loss function; represents the semantic classification loss function; represents the contrast loss function; represents the context consistency loss function; λ1 represents the weight of the semantic classification loss function; λ2 represents the weight of the contrast loss function; λ3 represents the weight of the context consistency loss function; K represents a total of K categories; y k represents the true label of the k-th category; represents the predicted label probability of the kth category; z represents the current sample feature, z + represents the positive sample feature, z - represents the negative sample feature, τ is the temperature parameter; N represents the number of sample logarithms; and are the predicted label probabilities of the header text in the i-th pair of samples under different contexts; D KL represents KL divergence, that is, relative entropy.
Citation Information
Patent Citations
Meter header identification method and device based on large language model, equipment and medium
CN118052213A
Cross-page table discrimination method based on double semantics
CN119202813A