A method, system, device and storage medium for LLM table prompt enhancement

By converting tables into Markdown format and performing processing and merging operations, the problem of parsing errors and information loss in the knowledge base Q&A system when processing diverse table formats is solved, the parsing and utilization capabilities of tables are improved, and system performance and user experience are optimized. .

CN118410782BActive Publication Date: 2024-10-22BEIJING BAOLANDE SOFTWARE CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410446975.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-15
Publication Date
2024-10-22
Estimated Expiration
2044-04-15

AI Technical Summary

Technical Problem

Existing knowledge base Q&A systems are prone to problems such as parsing errors, information loss, ignoring useful information, increased processing complexity, and insufficient semantic understanding when processing diverse table formats, resulting in reduced system performance and poor user experience.

Method used

By converting the preprocessed tables into Markdown format and processing and merging the Markdown tables, the tables in Markdown format can adapt to various table structures, improve the integrity and accuracy of the data, and thereby improve the parsing and analysis of the tables. Take advantage of capabilities.

Benefits of technology

It achieves accurate parsing and utilization of diverse tables, reduces parsing errors and information loss, overcomes the problems of ignoring potentially useful information and increasing processing complexity, and improves system performance and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118410782B_ABST
    Figure CN118410782B_ABST
Patent Text Reader

Abstract

The present invention relates to a method, system, device and storage medium for enhancing LLM table prompts, and the method comprises the following steps: S1, document table parsing preprocessing; S2, locating merged cells; S3, locating table header positions; S4, merging tables in Markdown format; S5, constructing table adaptation prompts. The present invention converts the preprocessed table into a Markdown table in Markdown format, so that the table in Markdown format can adapt to various table structures. At the same time, by constructing a table adaptation prompt, a unified and reliable input is provided for a large language model LLM, and the parsing and utilization capabilities of the knowledge base question and answer system for the table are effectively improved, and the problems of parsing errors and information loss are reduced. At the same time, the problems of ignoring potential useful information, increasing processing complexity and insufficient semantic understanding are overcome, so that through the method, users can more conveniently call LLM to perform document question and answer tasks, and improve the performance of the system and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of knowledge base question and answer based on a large language model of computer software in the field of computer technology, and in particular to a method, system, device and storage medium for enhancing LLM table prompts. Background Art

[0002] With the development and application of large language models, knowledge base question answering systems have gradually become one of the important ways for people to obtain information. However, the current large language models are prone to hallucinations when generating text, which means that the generated content may lack reliable knowledge background support. Therefore, it is necessary to interact with external knowledge bases to improve the factuality and rationality of the generated content. The tabular data contained in the document has become one of the important sources of information. However, the problem of diverse forms and inconsistent formats of tables in documents has become one of the challenges faced by current knowledge base question answering systems.

[0003] For the above challenges, the current main solutions are mainly focused on single parsing or filtering tables, including the following aspects:

[0004] Single parsing: One of the current mainstream solutions is to use a single parsing method, that is, directly read the table content in the document and perform simple parsing and splicing. Although this method is simple and direct, it often does not work well for tables with irregular formats or special structures, and is prone to parsing errors or information loss.

[0005] Filtering tables: Another common solution is to filter the tables in the document and select only those that meet specific format or structure requirements for parsing and utilization. This method can reduce the difficulty and error rate of parsing to a certain extent, but it may also ignore some potentially useful information.

[0006] Format standardization: Some systems attempt to standardize the format by converting tables in documents into a specific format or structure. This can make the table data more standardized and easier to parse, improving the accuracy and efficiency of the system. However, this method requires additional processing steps and may change the original meaning or format of the table in some cases.

[0007] Semantic parsing: In recent years, some researchers have begun to try to use natural language processing and machine learning techniques to perform semantic parsing on tables in documents. This method can better understand the information and structure in the table, thereby improving the accuracy and reliability of the parsing.

[0008] In summary, the main methods for solving the challenge of diverse table formats in documents currently include single parsing and filtering tables. In the future, with the continuous development and improvement of technology, I believe that more and more effective methods will emerge to provide better table parsing and utilization capabilities for knowledge base question answering systems.

[0009] The existing document tables have the following shortcomings in the process of parsing and extracting:

[0010] Parsing is prone to errors or information loss: Although the single parsing method is direct, it is prone to parsing errors or information loss for tables with irregular formats or special structures, which can easily make the information extracted by the system incomplete or erroneous.

[0011] Potentially useful information is easily overlooked: Although the table filtering method can reduce the difficulty of parsing and the error rate, it may ignore some potentially useful information because it only selects tables that meet specific format or structure requirements for parsing and utilization, and some non-standard but valuable information may be ignored.

[0012] Additional processing steps may change the original meaning of the table: The format standardization method requires additional processing steps and may change the original meaning or format of the table in some cases, which increases the complexity of system processing and easily leads to information distortion.

[0013] Insufficient semantic understanding: Current solutions lack semantic understanding of tables in documents. Although some studies have attempted to use natural language processing and machine learning techniques for semantic parsing, there are still challenges in practice, such as limited accuracy and reliability in understanding the information and structure in tables.

[0014] In summary, existing methods are prone to many problems when processing diverse table formats in documents, such as parsing errors, information loss, neglect of useful information, increased processing complexity, and insufficient semantic understanding. This reduces the knowledge base question-answering system's ability to parse and utilize tables, resulting in a decline in system performance and a poor user experience. Summary of the invention

[0015] In order to improve the ability to parse and utilize tables, optimize system performance, and improve user experience, the present invention provides a method, system, device, and storage medium for enhancing LLM table prompts, which converts the preprocessed table into a Markdown table in Markdown format, and processes and merges the Markdown table, so that the Markdown table can adapt to various table structures, improves the integrity and accuracy of the data, thereby improving the ability to parse and utilize tables, optimizing system performance, and improving user experience.

[0016] In a first aspect, the present invention provides a method for enhancing LLM table prompts, which adopts the following technical solution:

[0017] A method for enhancing LLM table prompts, comprising the following steps:

[0018] S1, document table parsing preprocessing, screening out the table and parsing it into a two-dimensional array, preprocessing the two-dimensional array to obtain a preprocessed table;

[0019] S2, locate the merged cells;

[0020] S21, locate the address of the cell, and regard multiple cells with the same address index as candidate merged cells;

[0021] S22, obtaining the table in S112 and extracting the cell information in the table;

[0022] S221, checking the cells in the table one by one by searching in positive order and determining whether the cell appears for the first time in the table;

[0023] If so, record it as the starting position of the merged cell;

[0024] If not, skip it;

[0025] S222, searching the table in reverse order and re-determining whether it is the first appearance of the cell in the table;

[0026] If so, record it as the end position of the merged cell;

[0027] If not, skip it;

[0028] S223, compare the index values ​​of the forward search and the reverse search to determine whether it is a merged cell;

[0029] If so, record the starting row and column coordinates of the starting position of the merged cell and the ending row and column coordinates of the ending position, and convert the starting row and column coordinates and the ending row and column coordinates into XLRD style cell merged row and column information;

[0030] S224, forming a merged cell position information index list in an ungrouped form for the position information of each merged cell, and the merged cell position information index list is used for table data processing or analysis;

[0031] S3, locate the table header position and output the table header position index;

[0032] S4, merge tables in Markdown format;

[0033] S41, converting the preprocessed table into a Markdown table in Markdown format;

[0034] S42, using the merged cell position information index list obtained in step S2 to process the Markdown table, obtain the sub-matrix at the corresponding position of the Markdown table according to the position index, and replace the value in the sub-matrix;

[0035] S43, inserting a Markdown header using the header position index obtained in step S3, and completing Markdown format conversion for each row of elements;

[0036] Get the final form.

[0037] Preferably, the S1 comprises the following steps:

[0038] S11, parsing and reading the paragraph objects of the document one by one, and determining whether the format of each minimum unit is a paragraph or a table;

[0039] S111, if it is a paragraph, ignore and repeat S11;

[0040] S112. If it is a table, parse the table into a two-dimensional array, and then preprocess the two-dimensional array. The preprocessing includes removing line breaks and blank characters in the table to obtain a preprocessed table.

[0041] Preferably, S3 comprises the following steps:

[0042] S31, converting the merged cell position information in the merged cell position information index list in S224 into a data frame object;

[0043] S32, the function analyzes the position information of the merged cell, finds the starting row of the merged cell and uses it as a candidate index for the header position;

[0044] S321. If the index of the starting row is not zero, it is recorded as the header index;

[0045] S322, if the index of the starting row is zero, further check the ending row of the merged cell;

[0046] S323. If the first row of multiple merged cells is the first row, the maximum value of the end row of the merged cells plus 1 is selected as the final header position index;

[0047] S324, if the starting row of multiple merged cells is the first row, output the header index as the final header position index;

[0048] The function returns the determined header position index.

[0049] Preferably, the cell information in S2 includes the total length and number of columns of the table.

[0050] Preferably, S5, constructing a table adaptation prompt;

[0051] Preset prompt words that match tables so that when users ask questions, if the retrieved content is a table, the table content will be presented in Markdown as a background paragraph.

[0052] In a second aspect, the present invention provides a system for enhancing LLM table prompts, which adopts the following technical solution:

[0053] A system for LLM form prompt enhancement, comprising:

[0054] The document table parsing preprocessing module is used to filter out the table and parse it into a two-dimensional array, preprocess the two-dimensional array to obtain a preprocessed table;

[0055] The merged cell positioning module is used to locate the merged cells and obtain the merged cell position information index list;

[0056] The table header position positioning module is used to locate the table header position and output the table header position index;

[0057] The Markdown format table merging module is used to merge tables in Markdown format and obtain the final table.

[0058] In a third aspect, the present invention provides an electronic device for enhancing LLM table prompts, which adopts the following technical solution:

[0059] An electronic device for LLM form prompt enhancement, comprising:

[0060] One or more processors;

[0061] Memory;

[0062] One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute a method for LLM table prompt enhancement according to the above description.

[0063] In a fourth aspect, the present invention provides a computer-readable storage medium, which adopts the following technical solution:

[0064] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the above-mentioned method for enhancing LLM table prompts.

[0065] In summary, the present invention includes the following beneficial technical effects:

[0066] 1. The present invention converts the preprocessed table into a Markdown table in Markdown format, and processes and merges the Markdown table, so that the Markdown table can adapt to various table structures, improves the integrity and accuracy of the data, thereby improving the ability to parse and utilize the table, optimizing the performance of the system, and improving the user experience.

[0067] 2. The present invention performs preprocessing operations such as parsing and reading on tables in documents, so that it can accurately read and parse diverse table information in documents, including tables with irregular formats or special structures, and then converts the parsed table data into a specified Markdown format, so that tables in Markdown format can adapt to various table structures, realize operations such as table merging, and ensure the integrity and accuracy of the data.

[0068] 3. The present invention provides a unified and reliable input for the large language model LLM by utilizing the constructed prompt module, and effectively improves the knowledge base question and answer system's ability to parse and utilize tables, reduces the problems of parsing errors and information loss, and overcomes the problems of ignoring potentially useful information, increasing processing complexity and insufficient semantic understanding. Through this method, users can more conveniently call LLM to perform document question and answer tasks, thereby improving the system's performance and user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0069] Figure 1 It is a flow chart of a method for enhancing LLM table prompts in an embodiment of the present invention.

[0070] Figure 2 It is a table example diagram of a method for enhancing LLM table prompts in an embodiment of the present invention.

[0071] Figure 3 for Figure 2 An example diagram after parsing into a two-dimensional array format.

[0072] Figure 4 This is the form before the table is replaced in step S42.

[0073] Figure 5 This is the form after the table is replaced in step S42.

[0074] Figure 6 This is a sample graph in array form.

[0075] Figure 7 for Figure 6The example diagram in which each line of elements in the example diagram is converted to Markdown format. DETAILED DESCRIPTION

[0076] The present invention is further described in detail below in conjunction with the accompanying drawings.

[0077] The embodiment of the present invention discloses a method for enhancing LLM table prompts, which comprises the following steps:

[0078] S1, document table parsing preprocessing;

[0079] Filter out the table and parse it into a two-dimensional array, preprocess the two-dimensional array to obtain a preprocessed table;

[0080] Specifically, S1 includes the following steps:

[0081] S11. Use Python-docx to parse and read the paragraph objects of the document one by one, and determine whether the format of each minimum unit is a paragraph or a table;

[0082] When processing documents containing tables, the orderliness of the document is improved by using Python-docx to parse and read them paragraph by paragraph.

[0083] S111, if it is a paragraph, ignore and repeat S11;

[0084] S112, if it is a table, extract and parse the table, and preliminarily parse the table into a two-dimensional array format, and then preprocess the two-dimensional array, the preprocessing includes removing noise data such as line breaks and blank characters in the table to obtain a preprocessed table.

[0085] Reference Figure 2 , which is the table in the filtered documents, Figure 3 The two-dimensional array after table conversion.

[0086] The purpose of the above process is to ensure that the table data in the document is extracted and processed accurately, and by removing noise data such as line breaks and empty characters in the table, the accuracy and reliability of subsequent processing are ensured. At the same time, clean and standardized table information can be extracted through preprocessing to prepare for subsequent conversion.

[0087] S2, locate the merged cells;

[0088] Reference Figure 1 In the table shown, there is a cell merging operation in the header part. After being converted into a two-dimensional array, duplicate values ​​appear in the smallest cell in this part. In order to locate the merged cells, step S2 specifically includes the following steps:

[0089] S21, locate the address of the cell, and regard multiple cells with the same address index as candidate merged cells;

[0090] S22, receiving the paragraph object parsed by Python-docx as an input parameter, parsing the paragraph object, and obtaining the table in S112 and extracting cell information in the table, where the cell information includes the total length and number of columns of the table;

[0091] S221, checking the cells in the table one by one by searching in positive order and determining whether the cell appears for the first time in the table;

[0092] If so, record it as the starting position of the merged cell;

[0093] If not, skip processing of the cell;

[0094] S222, searching the table in reverse order and re-determining whether it is the first appearance of the cell in the table;

[0095] If so, record it as the end position of the merged cell;

[0096] If not, skip processing of this cell;

[0097] S223, compare the index values ​​of the forward search and the reverse search to determine whether the cell is a merged cell;

[0098] If so, record the starting row and column coordinates of the starting position of the merged cell and the ending row and column coordinates of the ending position, and convert the starting row and column coordinates and the ending row and column coordinates into XLRD style cell merged row and column information;

[0099] S224. The position information of each merged cell is formed into a merged cell position information index list in an ungrouped form. The merged cell position information index list is used for table data processing or analysis to improve the accuracy and reliability of table data in the document.

[0100] The above steps can effectively extract the merged cell position information in the table in the Word document, thus preparing for the next step of cell merging.

[0101] S3, locate the table header position and output the table header position index;

[0102] This step mainly involves automatically identifying and determining the table header position in order to further process and analyze the table data.

[0103] Specifically, S3 includes the following steps:

[0104] S31, converting the merged cell position information in the merged cell position information index list in S224 into a data frame object;

[0105] S32, the function analyzes the position information of the merged cell, finds the starting row of the merged cell and uses it as a candidate index for the header position;

[0106] S321. If the index of the starting row is not zero, it is recorded as the header index;

[0107] S322, if the index of the starting row is zero, further check the ending row of the merged cell;

[0108] S323. If the first row of multiple merged cells is the first row, the maximum value of the end row of the merged cells plus 1 is selected as the final header position index;

[0109] S324, if the starting row of multiple merged cells is the first row, output the header index as the final header position index;

[0110] The function returns the determined header position index.

[0111] S4, merge tables in Markdown format;

[0112] S41, converting the preprocessed table in the two-dimensional digital format into a Markdown table in the Markdown format;

[0113] As a lightweight markup language, Markdown is not only adaptable, but also highly readable and easy to use when displaying tabular data. Large models are also more adaptable to Markdown-formatted tabular data, which helps improve the efficiency and accuracy of the model in processing tabular data. At the same time, Markdown-formatted tables are more in line with the needs of front-end interface display, and can present a more beautiful and clear table structure, improving user experience.

[0114] S42, using the merged cell position information index list obtained in step S2 to process the Markdown table, obtain the sub-matrix at the corresponding position of the Markdown table according to the position index, and replace the value in the sub-matrix;

[0115] Reference Figure 4 As shown, it is the form before the table is replaced, refer to Figure 5 As shown, it is the form after the table is replaced.

[0116] S43, insert the table header in Markdown format using the table header position index obtained in step S3, and then convert the table into Figure 6 The array form shown, then Figure 6 Each line of elements in the Markdown format is converted to form Figure 7 The format shown is used to obtain the final table.

[0117] S5. Build a table adaptation prompt;

[0118] Preset prompt words that match tables so that when users ask questions, if the retrieved content is a table, the table content will be presented in Markdown as a background paragraph.

[0119] Specifically, in the above-mentioned processing flow of table data, the table in the document is usually converted into a vector representation after parsing and preprocessing, and stored in a special vector library. When a user asks a question to the system, the system will vectorize the question and then retrieve the document content in the knowledge base. If the retrieved content contains table information, the system will present the table content in Markdown format as a background paragraph for further processing by the subsequent large language model. In order to ensure that the model can accurately understand and generate relevant content, prompt words that match the table are designed. By using prompt words, the table information can be better utilized when the model generates text.

[0120] The embodiment of the present invention also discloses a system for enhancing LLM table prompts, which includes the following modules:

[0121] The document table parsing preprocessing module is used to filter out the table and parse it into a two-dimensional array, preprocess the two-dimensional array to obtain a preprocessed table;

[0122] The document table parsing preprocessing module includes a paragraph object parsing and reading module, a paragraph table judgment module, a two-dimensional array conversion module and a removal module.

[0123] The paragraph object parsing and reading module is used to parse and read the paragraph objects in the document one by one;

[0124] The paragraph table judgment module is used to judge whether the paragraph object is a paragraph or a table;

[0125] The two-dimensional array conversion module is used to convert the table into a two-dimensional array format;

[0126] The removal module is used to remove noise data such as line breaks and control characters in the table.

[0127] The merged cell positioning module is used to locate the merged cells and obtain the merged cell position information index list;

[0128] The merged cell positioning module includes a cell address positioning module, a table acquisition module, a forward search module, a start position judgment module, a reverse search module, an end position judgment module, an index value comparison judgment module and an index list generation module;

[0129] The cell address positioning module is used to locate the index address of the cell;

[0130] The table acquisition module is used to obtain the table screened by the paragraph table judgment module;

[0131] The positive sequence search module is used to search the table in positive sequence;

[0132] The starting position determination module is used to determine whether the cell in the positive order search process is the first cell to appear in the table, and record the first cell as the starting position;

[0133] The reverse search module is used to search the table in reverse order;

[0134] The end position judgment module is used to judge whether the cell in the reverse search process is the first cell in the table, and record the first cell as the end position;

[0135] The index value comparison and judgment module is used to compare the index values ​​of the forward search and the reverse search, and determine whether it is a merged cell;

[0136] The index list generating module is used to form a merged cell position information index list in a non-grouped form according to the position information of the merged cells.

[0137] The table header position positioning module is used to locate the table header position and output the table header position index;

[0138] The table position positioning module includes a data frame conversion module, a function analysis module, a starting row index value judgment module, a module for judging whether there are multiple merged cells starting with the first row, and a table header position index output module.

[0139] The data frame conversion module is used to convert the merged cell position information in the merged cell position information index list into a data frame object;

[0140] The function analysis module is used to analyze the position information of the merged cells, find the starting row of the merged cells and use it as a candidate index for the header position;

[0141] The starting row index value judgment module is used to judge whether the index value of the starting row is zero. If it is not zero, it is recorded as the header index and the header position index is output in the header position index output module. If it is zero, the end row of the merged cell is further checked.

[0142] Whether there are multiple merged cells starting in the first row judgment module is used to judge whether the starting row of multiple merged cells is the first row. If so, the maximum value of the ending row of the merged cells plus 1 is selected as the final header position index and output in the header position index output module. If not (none), the header index is output as the final header position index; and output in the header position index output module.

[0143] The header position index output module is used to output the header position index.

[0144] The Markdown format table merging module is used to merge tables in Markdown format and obtain the final table.

[0145] The Markdown format merge table module includes a Markdown format conversion module, a processing module, a replacement module, an insertion module and a Markdown format conversion module.

[0146] The Markdown format conversion module is used to convert the preprocessed table into a Markdown table in Markdown format;

[0147] The processing module is used to process the Markdown table according to the merged cell position information index list generated by the index list generation module, and obtain the sub-matrix of the corresponding position of the Markdown table according to the position index;

[0148] The replacement module is used to replace the values ​​in the sub-matrix in the processing module;

[0149] The insert module is used to insert a Markdown header using the header position index output by the header position index output module;

[0150] The Markdown format conversion module is used to complete the Markdown format conversion of each row element and obtain the final table;

[0151] The table adaptation prompt module is used for users to preset prompt words that match the table in advance, so that when the user asks a question, if the retrieved content is a table, the table content will be presented in Markdown as a background paragraph.

[0152] An embodiment of the present invention also provides an electronic device for LLM table prompt enhancement, the electronic device comprising: a processor and a memory. The processor and the memory are connected, such as through a bus. Optionally, the electronic device may also include a transceiver. It should be noted that in actual applications, the transceiver is not limited to one, and the structure of the electronic device does not constitute a limitation on the embodiment of the present invention.

[0153] The processor may be a CPU central processing unit, a general processor, a DSP data signal processor, an ASIC application specific integrated circuit, an FPGA field programmable gate array or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of the present invention. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0154] The bus may include a path to transmit information between the above components. The bus may be a PCI peripheral component interconnect standard bus or an EISA extended industry standard architecture bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc.

[0155] The memory can be a ROM read-only memory or other types of static storage devices that can store static information and instructions, a RAM random access memory or other types of dynamic storage devices that can store information and instructions, or an EEPROM electrically erasable programmable read-only memory, a CD-ROM read-only disc or other optical disc storage, an optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile discs, Blu-ray discs, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0156] The memory is used to store the application code for executing the solution of the present invention, and the execution is controlled by the processor. The processor is used to execute the application code stored in the memory to implement the content shown in the method for enhancing the prompt of the LLM table disclosed in the above embodiment.

[0157] The electronic devices include, but are not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital TVs, desktop computers, etc. It can also be a server, etc.

[0158] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer-readable storage medium is run on a computer, the computer can execute the corresponding content for LLM table prompt enhancement disclosed in the above embodiment.

[0159] It should be understood that, although the steps in the flowchart of the accompanying drawings are displayed in sequence as indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the sub-steps or stages of other steps.

[0160] The above are all preferred embodiments of the present invention, and are not intended to limit the protection scope of the present invention. Therefore, any equivalent changes made based on the structure, shape, and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for enhancing LLM table prompts, characterized in that: The following steps are involved: S1, document table parsing preprocessing, screening out the table and parsing it into a two-dimensional array, preprocessing the two-dimensional array to obtain a preprocessed table; S2, locate the merged cells; S21, locate the address of the cell, and regard multiple cells with the same address index as candidate merged cells; S22, obtaining the table in S112 and extracting the cell information in the table; S221, checking the cells in the table one by one by searching in positive order and determining whether the cell appears for the first time in the table; If so, record it as the starting position of the merged cell; If not, skip it; S222, searching the table in reverse order and re-determining whether it is the first appearance of the cell in the table; If so, record it as the end position of the merged cell; If not, skip it; S223, compare the index values ​​of the forward search and the reverse search to determine whether it is a merged cell; If so, record the starting row and column coordinates of the starting position of the merged cell and the ending row and column coordinates of the ending position, and convert the starting row and column coordinates and the ending row and column coordinates into XLRD style cell merged row and column information; S224, forming a merged cell position information index list in an ungrouped form for the position information of each merged cell, and the merged cell position information index list is used for table data processing or analysis; S3, locate the table header position and output the table header position index; S4, merge tables in Markdown format; S41, converting the preprocessed table into a Markdown table in Markdown format; S42, using the merged cell position information index list obtained in step S2 to process the Markdown table, obtain the sub-matrix at the corresponding position of the Markdown table according to the position index, and replace the value in the sub-matrix; S43, inserting a Markdown header using the header position index obtained in step S3, and completing Markdown format conversion for each row of elements; Get the final form; S5. Build a table adaptation prompt; Preset prompt words that match tables so that when users ask questions, if the retrieved content is a table, the table content will be presented in Markdown as a background paragraph.

2. A method for enhancing LLM table prompts according to claim 1, characterized in that: The S1 comprises the following steps: S11, parsing and reading the paragraph objects of the document one by one, and determining whether the format of each minimum unit is a paragraph or a table; S111, if it is a paragraph, ignore and repeat S11; S112. If it is a table, parse the table into a two-dimensional array, and then preprocess the two-dimensional array. The preprocessing includes removing line breaks and blank characters in the table to obtain a preprocessed table.

3. A method for enhancing LLM table prompts according to claim 1, characterized in that: The S3 comprises the following steps: S31, converting the merged cell position information in the merged cell position information index list in S224 into a data frame object; S32, the function analyzes the position information of the merged cell, finds the starting row of the merged cell and uses it as a candidate index for the header position; S321. If the index of the starting row is not zero, it is recorded as the header index; S322, if the index of the starting row is zero, further check the ending row of the merged cell; S323. If the first row of multiple merged cells is the first row, the maximum value of the end row of the merged cells plus 1 is selected as the final header position index; S324, if the starting row of multiple merged cells is the first row, output the header index as the final header position index; The function returns the determined header position index.

4. A method for enhancing LLM table prompts according to claim 1, characterized in that: The cell information in S2 includes the total length and number of columns of the table.

5. A system for enhancing LLM table prompts, which is applied to the method for enhancing LLM table prompts according to claim 1, characterized in that it comprises: The document table parsing preprocessing module is used to filter out the table and parse it into a two-dimensional array, preprocess the two-dimensional array to obtain a preprocessed table; The merged cell positioning module is used to locate the merged cells and obtain the merged cell position information index list; The table header position positioning module is used to locate the table header position and output the table header position index; The Markdown format table merging module is used to merge tables in Markdown format and obtain the final table; The table adaptation prompt module is used for users to preset prompt words that match the table in advance, so that when the user asks a question, if the retrieved content is a table, the table content will be presented in Markdown as a background paragraph.

6. An electronic device for LLM table prompt enhancement, characterized in that: include: One or more processors; Memory; One or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to: execute a method for LLM table prompt enhancement according to any one of claims 1 to 4.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for enhancing LLM table prompts as described in any one of claims 1 to 4 is implemented.