Table data processing method and device, electronic equipment and storage medium
By converting the header matrix of tabular data into a header combination matrix and generating prompt words, the problem of large language model learning performance and task execution accuracy is solved, effective processing of tabular data and model parameter generation are achieved, improving learning performance and Task performance accuracy.
Patent Information
- Application Number
- CN202410800227.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-06
AI Technical Summary
Existing technology is difficult to effectively process tabular data, causing the learning performance and task execution accuracy of large language models to be affected.
By converting the header matrix of the table data into a header combination matrix, and combining it with the table body matrix to generate prompt words, the word embedding algorithm is used to obtain the model processing parameters, which are then processed by the large language model to generate appropriate learning samples.
It improves the learning performance and task execution accuracy of large language models, represents the content of table data through rich semantic information, and generates appropriate learning samples.
Smart Images

Figure CN118607494A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method and device for processing table data, an electronic device, and a computer-readable storage medium. Background Art
[0002] Tabular data is data expressed in a table, including table headers and table bodies. Tabular data can be obtained through rich text documents (such as Word), HTML (Hyper Text Markup Language) pages, text files (Comma-Separated Values, CSV), and images. Tabular data can be used as learning samples for large language models, thereby obtaining large language models that can handle question-answering tasks.
[0003] For large language models, the way of processing tabular data to obtain learning samples can greatly affect the learning performance and the accuracy of subsequent task execution. In view of this, a reasonable tabular data processing method is urgently needed to generate suitable learning samples. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method and device for processing tabular data, an electronic device, and a storage medium, which are used to generate suitable learning samples based on tabular data to improve the learning performance of a large language model and the accuracy of task execution.
[0005] On the one hand, the present application provides a method for processing table data, comprising:
[0006] Converting a header matrix of the table data into a header combination matrix; wherein the header matrix includes header information of each header cell in the table data;
[0007] Based on the table header combination matrix and the table body matrix of the table data, a plurality of prompt words are obtained by combination; wherein the table body matrix includes table body information of each table body cell in the table data;
[0008] Process each prompt word separately to obtain corresponding model processing parameters, and obtain a number of model processing parameters;
[0009] The plurality of model processing parameters are handed over to a preset large language model for processing.
[0010] In one embodiment, before converting the header matrix of the table data into a header combination matrix, the method further includes:
[0011] According to a data extraction strategy corresponding to the target file, table data is extracted from the target file; wherein the table data includes a table name, a table header matrix and a table body matrix.
[0012] In one embodiment, converting the header matrix of the table data into a header combination matrix includes:
[0013] For each table body cell in the table body matrix of the table data, search the column where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the column dimension, and construct the at least one table header information of the column dimension into a column dimension character string according to the search order;
[0014] Searching the row where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the row dimension, and constructing the at least one table header information of the row dimension into a row dimension character string according to the search order;
[0015] Construct the column dimension string and row dimension string corresponding to each table body cell into a table header combination string corresponding to the table body cell;
[0016] A header combination matrix is constructed according to the header combination character strings corresponding to all the table body cells in the table body matrix.
[0017] In one embodiment, before converting the header matrix of the table data into a header combination matrix, the method further includes:
[0018] Determine whether the header cells in the table data are aligned, and if not, perform alignment processing according to the position of the header cells.
[0019] In one embodiment, the combination of the table header combination matrix and the table body matrix of the table data to obtain a plurality of prompt words includes:
[0020] Each header combination character string in the header combination matrix is combined with the table body information in the table body cell corresponding to the header combination character string in the table body matrix into a prompt word to obtain a plurality of prompt words.
[0021] In one embodiment, the step of combining each header combination string in the header combination matrix with the table body information in the table body cell corresponding to the header combination string in the table body matrix into a prompt word includes:
[0022] For each header combination character string in the header combination matrix, the header combination character string is combined with the table body information in the table body cell corresponding thereto in the table body matrix according to a preset prompt word template to obtain a prompt word.
[0023] In one embodiment, each prompt word is processed separately to obtain corresponding model processing parameters, and several model processing parameters are obtained, including:
[0024] Use the word embedding algorithm to convert each prompt word and obtain the corresponding word vector;
[0025] The obtained word vectors are used as model processing parameters.
[0026] In one embodiment, after processing each prompt word to obtain corresponding model processing parameters and obtaining a plurality of model processing parameters, the method further includes:
[0027] The table name of the table data, the plurality of prompt words and the model processing parameters corresponding to each prompt word are stored in association.
[0028] In one embodiment, the method further comprises:
[0029] Obtain a target question, and input the target question into a trained large language model to obtain an output result;
[0030] The output result is returned to the source of the target question.
[0031] In one embodiment, the large language model is LightGBM or XGBoost.
[0032] On the other hand, the present application provides a table data processing device, comprising:
[0033] A conversion module, used for converting a header matrix of the table data into a header combination matrix; wherein the header matrix includes header information of each header cell in the table data;
[0034] A combination module, used for combining the table header combination matrix and the table body matrix of the table data to obtain a plurality of prompt words; wherein the table body matrix includes table body information of each table body cell in the table data;
[0035] A determination module is used to process each prompt word to obtain corresponding model processing parameters, thereby obtaining a plurality of model processing parameters;
[0036] The processing module is used to pass the plurality of model processing parameters to a preset large language model for processing.
[0037] Furthermore, the present application provides an electronic device, the electronic device comprising:
[0038] processor;
[0039] a memory for storing processor-executable instructions;
[0040] Wherein, the processor is configured to execute the above-mentioned table data processing method.
[0041] In addition, the present application provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by a processor to complete the above-mentioned table data processing method.
[0042] The present application scheme converts the header matrix into a header combination matrix, and then combines the header combination matrix with the table body matrix into a number of prompt words. The content of the table data can be represented by the rich semantic information of the prompt words, and the model processing parameters are determined by the prompt words. Suitable learning samples for the large language model can be obtained, thereby improving the learning performance and the accuracy of subsequent task execution. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings required for use in the embodiments of the present application are briefly introduced below.
[0044] Figure 1 A schematic diagram of an application scenario of a method for processing table data provided in an embodiment of the present application;
[0045] Figure 2 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application;
[0046] Figure 3 A flowchart of a method for processing table data provided in an embodiment of the present application;
[0047] Figure 4 An embodiment of the present application provides Figure 3 Detailed flow chart of step 310;
[0048] Figure 5 A block diagram of a device for processing table data provided in one embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.
[0050] Similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings. At the same time, in the description of this application, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0051] Figure 1 Schematic diagram of an application scenario of the method for processing table data provided in the embodiment of the present application. Figure 1As shown, the application scenario includes a client 20 and a server 30; the client 20 can be a user terminal such as a host, a mobile phone, or a tablet computer, and is used to provide a target file containing table data to the server 30; the server 30 can be a host, a server, a server cluster, or a cloud computing center, and can extract table data from the target file and process the table data.
[0052] like Figure 2 As shown, this embodiment provides an electronic device 1, including: at least one processor 11 and a memory 12, Figure 2 A processor 11 is taken as an example. The processor 11 and the memory 12 are connected via a bus 10. The memory 12 stores instructions that can be executed by the processor 11. The instructions are executed by the processor 11 so that the electronic device 1 can execute all or part of the process of the method in the following embodiment. In one embodiment, the electronic device 1 can be the above-mentioned server 30, which is used to execute the method for processing table data.
[0053] The memory 12 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable red-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, disk or optical disk.
[0054] The present application also provides a computer-readable storage medium, which stores a computer program. The computer program can be executed by the processor 11 to complete the table data processing method provided in the present application.
[0055] See also Figure 3 , is a flow chart of a method for processing table data provided in an embodiment of the present application, such as Figure 3 As shown, the method may include the following steps 310 to 340.
[0056] Step 310: Convert the header matrix of the table data into a header combination matrix; wherein the header matrix includes the header information of each header cell in the table data.
[0057] Table data can include table name, table header matrix and table body matrix. Here, table data can be recorded as {TableName, TableHead, TableBody}, where TableName is the table name, TableHead is the table header matrix, and TableBody is the table body matrix. The table header matrix and the table body matrix are of the same type. The element HeadCell in the table header matrix TableHead i,j , represents the header information of the header cell in the i-th row and j-th column of the table data. The non-header information in the table data is represented by 0 in the header matrix. The element BodyCell in the table body matrix TableBody i,j , represents the table body information of the table body cell in the i-th row and j-th column in the table data. The non-table body information in the table data is represented by 0 in the table body matrix.
[0058] For example, the following table 1 is a table of regional temperature data:
[0059] temperature humidity Shanghai 20 10 Beijing 30 5
[0060] Table 1
[0061] For Table 1, TableName is "Regional Temperature Data Table", and the header matrix TableHead The table body matrix TableBody is Here, 0 in the matrix means the element is empty.
[0062] In one embodiment, before executing step 310, it may be determined whether the header cells in the table data are aligned, wherein the header cell alignment means that any header cell corresponds to a unique row and a unique column of the table.
[0063] On the one hand, if so, step 310 can be directly executed to use the table data recorded in the header cells as the header information, thereby obtaining a header matrix, and converting the header matrix into a header combination matrix.
[0064] On the other hand, if not, the alignment can be performed based on the position of the header cell. For more complex table data, the header matrix needs to be converted accordingly based on the position of the header in the header data. For example, the following Table 2 is a coffee sales data table:
[0065]
[0066] Table 2
[0067] Since the header cells cannot be aligned, Table 2 is processed to obtain Table 3:
[0068]
[0069]
[0070] Table 3
[0071] After the header cells are aligned, the table data recorded in the header cells are used as the header information to obtain the header matrix. For example, the header matrix can be extracted from Table 3 as the header matrix of Table 2.
[0072] For the header matrix in the table data, the header information of each header cell can be combined to obtain a number of header combination strings, so as to construct a header combination matrix according to the number of header combination strings.
[0073] Step 320: Based on the table header combination matrix and the table body matrix of the table data, a plurality of prompt words are combined; wherein the table body matrix includes table body information of each table body cell in the table data.
[0074] Each header combination string in the header combination matrix is combined with each table body information in the table body matrix. A header combination string and a table body information can form a prompt word. By combining several words, several prompt words can be obtained.
[0075] Step 330: Process each prompt word separately to obtain corresponding model processing parameters, thereby obtaining a plurality of model processing parameters.
[0076] Step 340: Submitting a number of model processing parameters to a preset large language model for processing.
[0077] The large language model can be configured according to the needs of the application scenario. For example, the large language model can be LightGBM (Light Gradient Boosting Machine), XGBoost (eXtreme Gradient Boosting), etc.
[0078] After obtaining several prompt words, the prompt words can be processed according to the requirements of the output parameters of the large language model to obtain model processing parameters. In one embodiment, the large language model can directly process natural language. In this case, the prompt words can be directly used as model processing parameters.
[0079] After the prompt words are converted into model processing parameters, all the converted model processing parameters can be handed over to the large language model for processing, so that the large language model can perform ensemble learning based on the model processing parameters.
[0080] Through the above measures, the header matrix is converted into a header combination matrix, and then the header combination matrix and the body matrix are combined into several prompt words. The content of the table data can be represented by the rich semantic information of the prompt words, and then the model processing parameters are determined by the prompt words. Suitable learning samples for the large language model can be obtained, thereby improving the learning performance and the accuracy of subsequent task execution.
[0081] In one embodiment, before executing step 310, table data may be extracted from the target file according to a data extraction strategy corresponding to the target file, wherein the table data includes a table name, a table header matrix, and a table body matrix.
[0082] Here, the target file is a structured file (such as an Excel table) or an unstructured file (such as text, image, XML, HTML, video, etc.) that records table data. Each type of target file is pre-configured with a corresponding data extraction strategy, which is used to indicate the implementation method of extracting data from the target file and organizing it into a table form. For example, for a picture, the data extraction strategy can indicate to perform OCR (Optical Character Recognition) on the picture and determine the position information of each recognized string in the picture. Based on the recognized strings and the position information corresponding to the strings, the table data can be constructed.
[0083] Through the above measures, based on the targeted data extraction strategy, the table data can be effectively extracted from the target file to be processed.
[0084] In one embodiment, see Figure 4 , provided in one embodiment of the present application Figure 3 The detailed flow chart of step 310 is as follows: Figure 4 As shown, when executing step 310, the following steps 311 to 314 may be specifically executed.
[0085] Step 311: For each table body cell in the table body matrix of the table data, search the column where the table body cell is located in the table header matrix to obtain at least one header information of the table body cell in the column dimension, and construct the at least one header information of the column dimension into a column dimension string according to the search order.
[0086] Specifically, for any body cell BodyCell in the body matrix i,j , you can search the jth column corresponding to the table body cell in the table header matrix to obtain at least one table header information of the table body cell in the column dimension. i,j, refers to a non-zero element in the table body matrix used to represent the table body information. Exemplarily, the search may be started from the first row of the jth column, and the number of rows may be increased successively, so as to obtain at least one table header information. Exemplarily, the search may also be started from the last row in the jth column header matrix where the table header information exists (for example: the i-1th row contains the table header information, and the search may be started from the i-1th row), and the number of rows may be decreased successively, so as to obtain at least one table header information.
[0087] After obtaining at least one header information, at least one header information of the column dimension may be sorted according to the search order, thereby constructing a column dimension string. Here, if the search order is an order of increasing the number of rows, the searched header information may be arranged in positive order; if the search order is an order of decreasing the number of rows, the searched header information may be arranged in reverse order.
[0088] Perform the above operation on each table body cell to obtain the column dimension strings corresponding to all table body cells.
[0089] Take the body cell BodyCell in row 4 and column 3 in table 3 4,3 For example, in the third column, in the order of increasing row numbers, starting from the first row, the table header information set that can be searched is [coffee, latte, sales]. Arranged in positive order, BodyCell can be obtained. 4,3 Or, still with the table body cell BodyCell in row 4 and column 3 in table 3 4,3 For example, in the third column, in the order of decreasing number of rows, start searching from the last row of header information in the header matrix of the third column (the third row in Table 3), and the header information set that can be searched is [Sales, Latte, Coffee]. By arranging in reverse order, BodyCell can be obtained. 4,3 The column dimension string "Coffee Latte Sales".
[0090] Step 312: Search the row where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the row dimension, and construct the at least one table header information of the row dimension into a row dimension character string according to the search order.
[0091] Specifically, for any body cell BodyCell in the body matrix i,j , you can search the i-th row corresponding to the table body cell in the table header matrix to obtain at least one table header information of the table body cell in the row dimension. i,j, refers to a non-zero element in the table body matrix used to represent the table body information. Exemplarily, the search may be started from the first column of the i-th row, and the number of columns may be increased successively, so as to obtain at least one table header information. Exemplarily, the search may be started from the last column of the table header matrix in the i-th row where the table header information exists (for example: the table header information exists in the j-1th column, and the search may be started from the j-1th column), and the number of columns may be decreased successively, so as to obtain at least one table header information.
[0092] After obtaining at least one header information, at least one header information of the row dimension may be sorted according to the search order, thereby constructing a row dimension string. Here, if the search order is an order of increasing the number of columns, the searched header information may be arranged in positive order; if the search order is an order of decreasing the number of columns, the searched header information may be arranged in reverse order.
[0093] Perform the above operation on each table body cell to obtain the row dimension strings corresponding to all table body cells.
[0094] Take the body cell BodyCell in row 4 and column 3 in table 3 4,3 For example, in the 4th row, in the order of increasing column numbers, starting from the 1st column, the header information set that can be searched is [2022, first quarter]. Arranged in positive order, BodyCell 4,3 Or, still with the table body cell BodyCell in row 4 and column 3 in table 3 4,3 For example, in the 4th row, in the order of decreasing the number of rows, start searching from the last column of the header information in the 4th row header matrix (the 2nd column in Table 3), and the header information set that can be searched is [first quarter, 2022]. By arranging in reverse order, BodyCell 4,3 The row dimension string "2022Q1".
[0095] Step 313: construct the column dimension string and row dimension string corresponding to each table body cell into a table header combination string corresponding to the table body cell.
[0096] After obtaining the column dimension string and row dimension string corresponding to any table body cell, the column dimension string and the row dimension string can be concatenated to obtain the table header combination string corresponding to the table body cell. Here, the concatenation order can be pre-configured to have the column dimension string first or the row dimension string first, or not limited, depending on the application needs.
[0097] For example, the body cell BodyCell in row 4 and column 3 in Table 3 4,3Taking 2022 as an example, the corresponding row dimension string "2022 First Quarter" and column dimension string "Coffee Latte Sales" are concatenated to obtain the header combination string "2022 First Quarter Coffee Latte Sales".
[0098] After constructing the corresponding header combination string for each table body cell, the header combination strings corresponding to all table body cells can be obtained.
[0099] Step 314: construct a header combination matrix according to the header combination character strings corresponding to all the table body cells in the table body matrix.
[0100] After obtaining the table header combination string corresponding to each table body cell, a table header combination matrix can be constructed. The table header combination matrix and the table body matrix are the same type of matrices, the table header combination matrix includes each table header combination string, and the position of each table header combination string in the table header combination matrix can be the same as the position of the table body cell corresponding to the table header combination string in the table body matrix.
[0101] Through the above measures, the header matrix can be converted into a header combination matrix. This process can effectively analyze the multi-level header format, thereby fully extracting the header information in the header matrix.
[0102] In one embodiment, when executing step 320, each header combination string in the header combination matrix and the table body information in the table body cell corresponding to the header combination string in the table body matrix can be combined into a prompt word, thereby obtaining a plurality of prompt words. Here, the header combination string and the table body information can be combined according to a preset prompt word template. Exemplarily, the prompt word template is "A is B", where A is the header combination string and B is the table body information.
[0103] Taking Table 1 as an example, the table body matrix TableBody is The header combination matrix is By combining the combined character strings of each table header with the table body information, we can get the prompt words "Shanghai temperature is 20", "Shanghai humidity is 10", "Beijing temperature is 30", and "Beijing humidity is 5".
[0104] In one embodiment, when executing step 330, each prompt word can be converted using a word embedding algorithm to obtain a corresponding word vector, and then the converted word vectors can be used as model processing parameters. Here, the word embedding algorithm can be adapted to the large language model.
[0105] Through this measure, model processing parameters in the form of word vectors can be generated for the large language model that processes word vectors, so that the word vectors can be handed over to the large language model for processing. After obtaining the word vector, an association relationship can be established between the word vector and its corresponding prompt word, and then the word vector and prompt word with established association relationship can be handed over to the large language model. Alternatively, after obtaining the word vector, only the word vector can be handed over to the large language model, thereby realizing data desensitization and encrypted transmission, ensuring the security of data transmission.
[0106] In one embodiment, after determining the corresponding model processing parameter for each prompt word and obtaining a plurality of model processing parameters, the table name of the table data, the plurality of prompt words, and the model processing parameter corresponding to each prompt word can be stored in association. Here, the data format of the associated storage can be recorded as {Key: TableName, Value: P, VectorValue: V}, where TableName is the table name, P is the prompt word set, and V is the model processing parameter set.
[0107] After the associated storage, if there is a large language model that needs to be trained later, the stored data can be handed over to the large language model for processing, so that the large language model can accurately understand the table information in the table data.
[0108] In one embodiment, after the model processing parameters are handed over to the large language model for processing, the trained large language model can be used to perform the question-answering task. In this case, a target question can be obtained, which can come from a user terminal and can be generated by voice input or text output. The target question is input into the trained large language model to obtain an output result, which can then be returned to the source of the target question.
[0109] For example, the target question is "What is the profit of latte in the first quarter of 2022?" By submitting the target question to a large language model trained with model processing parameters, the output result can be "The profit of coffee latte in the first quarter of 2022 is 100".
[0110] Through this measure, a large language model trained with the model processing parameters provided by this solution can be used to accurately perform question-answering tasks.
[0111] Figure 5 is a block diagram of a table data processing device according to an embodiment of the present invention. Figure 5 As shown, the device may include:
[0112] The conversion module 510 is used to convert the header matrix of the table data into a header combination matrix; wherein the header matrix includes the header information of each header cell in the table data;
[0113] A combination module 520, configured to combine the table header combination matrix and the table body matrix of the table data to obtain a plurality of prompt words; wherein the table body matrix includes table body information of each table body cell in the table data;
[0114] A determination module 530 is used to process each prompt word to obtain corresponding model processing parameters, thereby obtaining a plurality of model processing parameters;
[0115] The processing module 540 is used to send the plurality of model processing parameters to a preset large language model for processing.
[0116] In one embodiment, the apparatus further comprises an extraction module 550, configured to:
[0117] According to a data extraction strategy corresponding to the target file, table data is extracted from the target file; wherein the table data includes a table name, a table header matrix and a table body matrix.
[0118] In one embodiment, the conversion module 510 is further configured to:
[0119] For each table body cell in the table body matrix of the table data, search the column where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the column dimension, and construct the at least one table header information of the column dimension into a column dimension character string according to the search order;
[0120] Searching the row where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the row dimension, and constructing the at least one table header information of the row dimension into a row dimension character string according to the search order;
[0121] Construct the column dimension string and row dimension string corresponding to each table body cell into a table header combination string corresponding to the table body cell;
[0122] A header combination matrix is constructed according to the header combination character strings corresponding to all the table body cells in the table body matrix.
[0123] In one embodiment, the conversion module 510 is further configured to:
[0124] Determine whether the header cells in the table data are aligned, and if not, perform alignment processing according to the position of the header cells.
[0125] In one embodiment, the combination module 520 is further configured to:
[0126] Each header combination character string in the header combination matrix is combined with the table body information in the table body cell corresponding to the header combination character string in the table body matrix into a prompt word to obtain a plurality of prompt words.
[0127] In one embodiment, the combination module 520 is further configured to:
[0128] For each header combination character string in the header combination matrix, the header combination character string is combined with the table body information in the table body cell corresponding thereto in the table body matrix according to a preset prompt word template to obtain a prompt word.
[0129] In one embodiment, the determination module 530 is further configured to:
[0130] Use the word embedding algorithm to convert each prompt word and obtain the corresponding word vector;
[0131] The obtained word vectors are used as model processing parameters.
[0132] In one embodiment, the device further includes a storage module 560, configured to:
[0133] The table name of the table data, the plurality of prompt words and the model processing parameters corresponding to each prompt word are stored in association.
[0134] In one embodiment, the apparatus further comprises a reply module 570, configured to:
[0135] Obtain a target question, and input the target question into a trained large language model to obtain an output result;
[0136] The output result is returned to the source of the target question.
[0137] In one embodiment, the large language model is LightGBM or XGBoost.
[0138] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned table data processing method, which will not be repeated here.
[0139] In several embodiments provided in the present application, the disclosed devices and methods may also be implemented in other ways. The device embodiments described above are merely schematic, for example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and a module, a program segment or a part of a code contains one or more executable instructions for implementing a specified logical function. In some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0140] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0141] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.
Claims
1. A method for processing tabular data, characterized in that: include: Converting a header matrix of the table data into a header combination matrix; wherein the header matrix includes header information of each header cell in the table data; Based on the table header combination matrix and the table body matrix of the table data, a plurality of prompt words are obtained by combination; wherein the table body matrix includes table body information of each table body cell in the table data; Process each prompt word separately to obtain corresponding model processing parameters, and obtain a number of model processing parameters; The plurality of model processing parameters are handed over to a preset large language model for processing.
2. The method according to claim 1, characterized in that Before converting the header matrix of the table data into a header combination matrix, the method further includes: According to a data extraction strategy corresponding to the target file, table data is extracted from the target file; wherein the table data includes a table name, a table header matrix and a table body matrix.
3. The method according to claim 1, characterized in that The step of converting the table header matrix of the table data into a table header combination matrix comprises: For each table body cell in the table body matrix of the table data, search the column where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the column dimension, and construct the at least one table header information of the column dimension into a column dimension character string according to the search order; Searching the row where the table body cell is located in the table header matrix to obtain at least one table header information of the table body cell in the row dimension, and constructing the at least one table header information of the row dimension into a row dimension character string according to the search order; Construct the column dimension string and row dimension string corresponding to each table body cell into a table header combination string corresponding to the table body cell; A header combination matrix is constructed according to the header combination character strings corresponding to all the table body cells in the table body matrix.
4. The method according to claim 1 or 3, characterized in that: Before converting the header matrix of the table data into a header combination matrix, the method further includes: Determine whether the header cells in the table data are aligned, and if not, perform alignment processing according to the position of the header cells.
5. The method according to claim 1, characterized in that The combination matrix based on the table header and the table body matrix of the table data is combined to obtain a plurality of prompt words, including: Each header combination character string in the header combination matrix is combined with the table body information in the table body cell corresponding to the header combination character string in the table body matrix into a prompt word to obtain a plurality of prompt words.
6. The method according to claim 5, characterized in that The step of combining each header combination string in the header combination matrix with the table body information in the table body cell corresponding to the header combination string in the table body matrix into a prompt word includes: For each header combination character string in the header combination matrix, the header combination character string is combined with the table body information in the table body cell corresponding thereto in the table body matrix according to a preset prompt word template to obtain a prompt word.
7. The method according to claim 1, characterized in that The method processes each prompt word to obtain corresponding model processing parameters, and obtains several model processing parameters, including: Use the word embedding algorithm to convert each prompt word and obtain the corresponding word vector; The obtained word vectors are used as model processing parameters.
8. The method according to claim 1 or 7, characterized in that: After the corresponding model processing parameters are obtained by processing each prompt word respectively, and a plurality of model processing parameters are obtained, the method further includes: The table name of the table data, the plurality of prompt words and the model processing parameters corresponding to each prompt word are stored in association.
9. The method according to claim 1, characterized in that: The method further comprises: Obtain a target question, and input the target question into a trained large language model to obtain an output result; The output result is returned to the source of the target question.
10. The method according to claim 1 or 9, characterized in that: The large language model is LightGBM or XGBoost.
11. A device for processing tabular data, characterized in that: include: A conversion module, used for converting a header matrix of the table data into a header combination matrix; wherein the header matrix includes header information of each header cell in the table data; A combination module, used for combining the table header combination matrix and the table body matrix of the table data to obtain a plurality of prompt words; wherein the table body matrix includes table body information of each table body cell in the table data; A determination module is used to process each prompt word to obtain corresponding model processing parameters, thereby obtaining a plurality of model processing parameters; The processing module is used to pass the plurality of model processing parameters to a preset large language model for processing.
12. An electronic device, characterized in that: The electronic device comprises: processor; a memory for storing processor-executable instructions; Wherein, the processor is configured to execute the method for processing tabular data as described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program can be executed by a processor to complete the method for processing table data according to any one of claims 1 to 10.
Citation Information
Cited By
Table image and table LaTeX code generation method and device
CN119089879A
Table identification method, identification model training method and related products
CN119399784A
