Question processing method and related device
By parsing the table data header and converting it into a sequence of header fields, combined with sequence screening using a large language model, we address the issues of low efficiency and low accuracy in generating answers for tabular data in existing technologies, achieving more efficient and accurate answer generation.
Patent Information
- Application Number
- CN202510065243.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-15
- Publication Date
- 2025-09-23
AI Technical Summary
Existing technologies have problems of low efficiency and low accuracy when using large language models to process complex document data. In particular, in the process of generating answers to tabular data, the setting cost of template thinking chains is high and the efficiency is low.
By parsing the table data corresponding to the problem to be processed, building a header tree structure, and converting it into multiple header field sequences, using a large language model to perform sequence screening and screening process extraction, combining the problem to be processed and table data to build prompt information, and output answer generation process information and answers.
This improves the efficiency and accuracy of answer generation, reduces data calculation costs, and enhances the ability of large language models to understand table data.
Smart Images

Figure CN120687544A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a problem handling method and related devices. Background Art
[0002] With the continuous development and promotion of Internet technology, the application scope of document data processing provided by the Internet is becoming wider and wider, covering a wide range of fields such as technical reports and corporate financial reports. The complexity of document data is also increasing. For example, in addition to text data, document data may also contain a large amount of table data. Based on this, the application of large language models provides a feasible means for accurately identifying and understanding document data presented in these fields. However, as the application scope of large language models continues to expand, the requirements for the performance and functions of large language models are also increasing, which brings certain challenges to the application of large language models. Summary of the Invention
[0003] In a first aspect, an embodiment of the present application provides a method for solving a problem, including: Parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences; Inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information; Constructing prompt information based on the problem to be processed, the screening process information and the table data; The prompt information is input into the large language model, and the answer generation process information and the answer to the question to be processed are output.
[0004] It can be seen that in an embodiment of the present application, first, the table data corresponding to the problem to be processed is header parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. In this way, by converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be processed are input into the large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. In this way, the large language model is focused on understanding the header fields through multiple header field sequences, and the meaning of the table data is quickly understood by understanding the header fields. Furthermore, prompt information is constructed in combination with the problem to be processed, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be processed are output. In this way, the screening process information is used to assist in the generation of answers to the problem to be processed, thereby improving the efficiency of answer generation, and improving the accuracy of the answer generation process information and the answer.
[0005] In a second aspect, an embodiment of the present application provides a problem handling device, including: A header parsing module is used to parse the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and convert the header tree structure to obtain multiple header field sequences; a sequence screening module, configured to input the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and output screening process information; An information construction module, configured to construct prompt information based on the problem to be processed, the screening process information and the table data; The information input module is used to input the prompt information into the large language model and output the answer generation process information and the answer to the question to be processed.
[0006] In a third aspect, an embodiment of the present application provides a computer device comprising: a processor; and a memory configured to store computer-executable instructions, wherein the computer-executable instructions, when executed, cause the processor to execute the problem handling method described in the first aspect.
[0007] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium for storing computer-executable instructions, which, when executed by a processor, implement the problem handling method as described in the first aspect.
[0008] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the problem handling method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the embodiments of the present application 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 only some embodiments described in this specification. Those skilled in the art can also derive other drawings based on these drawings without inventive work. Figure 1 A flowchart of a problem-solving method provided in an embodiment of the present application; FIG2( a ) is a schematic diagram of a row header tree structure provided in an embodiment of the present application; FIG2( b ) is a schematic diagram of a column header tree structure provided in an embodiment of the present application; Figure 3 A flowchart of a method for processing questions in a table question-answering scenario provided by an embodiment of the present application; Figure 4A schematic diagram of a problem handling device provided in an embodiment of the present application; Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0010] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.
[0011] This specification provides an embodiment of a problem solving method: At present, in the process of problem handling for pending problems, a template thinking chain is often set up, and the problem, the table data corresponding to the problem and the template thinking chain are input into a preset language model. The template thinking chain used to describe the derivation process of obtaining the answer corresponding to the problem is selected from the template thinking chain through the language model, and the answer is obtained based on the selected template thinking chain. However, the cost of setting up the template thinking chain is high, and the thinking chain is directly determined by the original table data. Since the table data is relatively complex, the efficiency and accuracy of determining the thinking chain are low.
[0012] To this end, the problem handling method provided in this embodiment performs header parsing on the table data corresponding to the problem to be handled to obtain a header tree structure, and converts the header tree structure into multiple header field sequences. By converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be handled are input into the large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. In this way, the large language model focuses on understanding the header fields through multiple header field sequences, and the meaning of the table data can be easily understood by understanding the header fields. Furthermore, prompt information is constructed in combination with the problem to be handled, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be handled are output. In this way, the screening process information is used to assist in the generation of answers to the problem to be handled, improve the efficiency of answer generation, and improve the accuracy of the answer generation process information and the answer.
[0013] The problem handling method provided in this embodiment can be executed by a terminal or a server, wherein the terminal may include a mobile phone, a laptop computer, an intelligent interactive device, etc., and the server may include an independent physical server, a server cluster composed of multiple servers, or a cloud server capable of cloud computing.
[0014] Reference Figure 1 The problem handling method provided in this embodiment specifically includes steps S102 to S108.
[0015] Step S102 : performing header parsing on the table data corresponding to the problem to be processed to obtain a header tree structure, and performing conversion processing on the header tree structure to obtain multiple header field sequences.
[0016] The pending questions described in this embodiment include questions that require answer generation, and the questions can be questions input by the user for dialogue and answering; the pending questions can be questions in any field, and the pending questions can specifically be questions raised for one or more documents, or questions raised for table data contained in one or more documents. For example, the pending questions are questions about table data in a company's financial report, and the pending question is "What is the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2?"
[0017] The table data corresponding to the problem to be processed includes the table data required to generate the answer to the problem to be processed. The table data can be tabular data, and the table data can be table data contained in a document, such as the table data contained in a technical report or the table data contained in an academic paper. In addition, the table data can also be independent table data. Optionally, the table data corresponding to the problem to be processed is extracted from the document based on the problem to be processed. Continuing with the above example, the problem to be processed is "What is the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2?" The corresponding table data is extracted from the company's financial report based on the problem to be processed.
[0018] For example, the table data corresponding to the problem to be processed is shown in Table 1 below:
[0019] Table 1 Among them, in the income and expenditure table, income includes income item 1, income item 2, income item 3 and total income, and expenditure includes expenditure item 1, expenditure item 2, expenditure item 3, expenditure item 4 and total expenditure. xxxxx1 represents the income amount of income item 1 on xx / xx / xx1, and xxxxx2 represents the income amount of income item 1 on xx / xx / xx2. Similarly, income item 2, income item 3 and total income have corresponding income amounts on xx / xx / xx1 and xx / xx / xx2 respectively; xxxxx9 represents the expenditure amount of expenditure item 1 on xx / xx / xx1, and xxxxx10 represents the expenditure amount of expenditure item 1 on xx / xx / xx2. Similarly, expenditure item 2, expenditure item 3, expenditure item 4 and total expenditure have corresponding expenditure amounts on xx / xx / xx1 and xx / xx / xx2 respectively, which will not be repeated here. It should be noted that the table data here is only exemplary. This embodiment does not specifically limit the content and size of the table data, which can be determined based on the actual application scenario.
[0020] The header tree structure includes header data in the table data that is counted in the form of a tree structure. Optionally, the header tree structure includes a header tree structure of a first header category and / or a header tree structure of a second header category. The first header category can be a row header category, that is, the header tree structure of the first header category can be a row header tree structure, and the second header category can be a column header category, that is, the header tree structure of the second header category can be a column header tree structure. For example, the row header tree structure shown in Figure 2 (a) can be a row header tree structure obtained by performing header parsing on the table data shown in Table 1 above, and the root node The point has three leaf nodes: income and expenditure table, income and expenditure. There are leaf nodes for income, namely income item 1, income item 2, income item 3 and total income. There are leaf nodes for expenditure, namely expenditure item 1, expenditure item 2, expenditure item 3, expenditure item 4 and total expenditure. For another example, the column header tree structure shown in Figure 2 (b) can be the column header tree structure obtained by parsing the table data shown in Table 1 above. The root node has two leaf nodes: income and expenditure table and year. There are leaf nodes for year, namely xx / xx / xx1 and xx / xx / xx2.
[0021] Each of the multiple header field sequences may include one or more header fields. The header fields included in each header field sequence may be arranged in the header field sequence in descending order of header hierarchy. For example, the header field sequence obtained by converting the row header tree structure shown in FIG. 2( a ) includes: "Node_Income and Expenditure Table", "Node_Income, Node_Income Item 1", "Node_Income, Node_Income Item 2", "Node_Income, Node_Income Item 3", "Node_Income, Node_Income Total", "Node_Expenditure, Node_Expenditure Item 1", "Node_Expenditure, Node_Expenditure Item 2", "Node_Expenditure, Node_Expenditure Item 3", "Node_Expenditure, Node_Expenditure Item 4", "Node_Expenditure, Node_Expenditure Total", the header level of the header field Node_Expenditure here can be higher than the header level of Node_Expenditure Total, and the hierarchical relationship of the header fields in the remaining header field sequences is similar and will not be repeated here. The header field sequence obtained by converting the column header tree structure shown in Figure 2 (b) includes: "Node_Income and Expenditure Table", "Node_Year, Node_xx1 Year xx Month xx Day", "Node_Year, Node_xx2 Year xx Month xx Day", multiple header field sequences may include a row header field sequence obtained by converting the row header tree structure and / or a column header field sequence obtained by converting the column header tree structure.
[0022] In specific implementation, in the process of processing the problem to be processed, the header of the table data corresponding to the problem to be processed is parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. Specifically, the header of the table data corresponding to the problem to be processed can be parsed to obtain a header tree structure of a first header category and a header tree structure of a second header category, and the header tree structure of the first header category and the header tree structure of the second header category are converted into multiple header field sequences; the first header category here may include a row header category, and the second header category may include a column header category. The header tree structure of the first header category may include a row header tree structure, and the header tree structure of the second header category may include a column header tree structure; in this way, by parsing the table data into a header tree structure and then converting the header tree structure into multiple header field sequences, the complex table structure is converted into a simple field sequence structure, so that the subsequent large language model can conveniently mine the meaning of the table data by understanding the header fields, thereby enhancing the large language model's understanding of the table data.
[0023] In actual applications, in the process of generating answers to the problems to be processed, it may be necessary to combine table data, but the use of table data may only involve a small amount of sub-table data, and the entire table data will not be used. Table data is usually dense and adjacent data have similar meanings. If the answer is generated directly based on the entire table data, there may be data interference, resulting in low accuracy in the answer generation process. In view of this, in order to improve the accuracy of the subsequent large language model in generating answers to the problems to be processed, and to improve the efficiency of answer generation; the table data corresponding to the problem to be processed can be header parsed to obtain a header tree structure. The hierarchical relationship of the table is represented by the header tree structure, which helps to improve the understanding of the meaning of the data in the table, and then accurately locate the sub-table data required for answer generation; and in the process of header parsing of the table data, there may be data of different header categories in the table data, so in order to improve the comprehensiveness of the header parsing; in an optional implementation manner provided by this embodiment, in the process of header parsing of the table data corresponding to the problem to be processed to obtain a header tree structure, the following operations are performed: Determine a table type corresponding to the table data, and extract first sub-table data and second sub-table data from the table data according to an extraction method corresponding to the table type; A header tree structure of a first header category is constructed based on the first sub-table data, and a header tree structure of a second header category is constructed based on the second sub-table data.
[0024] The table type corresponding to the table data includes a table type, such as a three-line table type and / or an SQL (Structured Query Language) table type. Furthermore, the table type may also be other table types. The first sub-table data may include left sub-table data. The left sub-table data may be obtained by extracting columns starting from the first column of the table data according to the number of extracted columns. The number of extracted columns may be any value. For example, the first n columns may be extracted from the table data as the left sub-table data according to the number of extracted columns n. n may be greater than 0. The left sub-table data may have row numbers and / or column numbers. The second sub-table data may include upper sub-table data. The upper sub-table data may be obtained by extracting rows starting from the first row of the table data according to the number of extracted rows. The number of extracted rows may also be any value. The number of extracted rows and the number of extracted columns may be the same or different. For example, the first m rows may be extracted from the table data as the upper sub-table data according to the number of extracted rows m. m may be greater than 0. The upper sub-table data may have row numbers and / or column numbers. The first header category may include a row header category, and the header tree structure of the first header category may be a row header tree structure. The second header category may include a column header category, and the header tree structure of the second header category may be a column header tree structure.
[0025] Specifically, the table type corresponding to the table data can be determined, and the number of rows and columns to be extracted can be determined based on the table type. Columns can be extracted from the table data according to the number of extracted columns to obtain the left sub-table data, and rows can be extracted from the table data according to the number of extracted rows to obtain the upper sub-table data. A row header tree structure can be constructed based on the left sub-table data, and a column header tree structure can be constructed based on the upper sub-table data. Before determining the table type corresponding to the table data, the initial table data can also be serialized to obtain the table data. Specifically, the initial table data can be serialized to obtain the table data. That is, the table data can contain row numbers and / or column numbers. In addition, the original table data can also be converted into initial table data in a specific format, and the initial table data can be serialized, i.e., row numbers and / or column numbers can be marked to obtain the table data. For example, the specific format is Markdown (a lightweight markup language) or Pandas. DataFrame (a data structure) format; this uses serial number markings to help subsequent large language models accurately locate the row range or column range of table data; it should be noted that the table data involved in this embodiment, the table data in the example, and all sub-table data can be in any specific format, such as Markdown format, during the problem processing process.
[0026] Continuing with the above example, based on the table type corresponding to the table data, the number of extracted columns is determined to be 2, and the number of extracted rows is determined to be 5 (the number of extracted rows may or may not include the number of row numbers. Similarly, the number of extracted columns may or may not include the number of column numbers. Here, the number of extracted rows does not include the number of row numbers, and the number of extracted columns does not include the number of column numbers). Then, based on the number of extracted columns being 2, columns are extracted from the table data shown in Table 1, resulting in the left subtable data shown in Table 2 below:
[0027] Among them, 0-13 in the first column of Table 2 represent row numbers, and 0-2 in the first row represent column numbers; income includes income item 1, income item 2, income item 3, and total income; expenditure includes expenditure item 1, expenditure item 2, expenditure item 3, expenditure item 4, and total expenditure; the year includes xx / xx / xx1; xxxxx1 represents the income amount of income item 1 on xx / xx / xx1; similarly, income item 2, income item 3, and total income have corresponding income amounts on xx / xx / xx1; xxxxx9 represents the expenditure amount of expenditure item 1 on xx / xx / xx1; similarly, expenditure item 2, expenditure item 3, expenditure item 4, and total expenditure have corresponding expenditure amounts on xx / xx / xx1; they are not repeated here; According to the number of rows to be extracted, 5, rows are extracted from the table data shown in Table 1, and the upper sub-table data is obtained as shown in Table 3 below:
[0028] Table 3 In Table 3, 0-5 in the first column represent row numbers, and 0-3 in the first row represent column numbers. Years include xx / xx / xx1 and xx / xx / xx2. Income includes income item 1 and income item 2. xxxxx1 represents the income amount of income item 1 on xx / xx / xx1, and xxxxx2 represents the income amount of income item 1 on xx / xx / xx2. Similarly, income item 2 has corresponding income amounts on xx / xx / xx1 and xx / xx / xx2. The row header tree structure constructed based on the left subtable data shown in Table 2 is shown in Figure 2(a), and the column header tree structure constructed based on the upper subtable data shown in Table 3 is shown in Figure 2(b). The row header tree structure shown in Figure 2(a) and the column header tree structure shown in Figure 2(b) have been described in detail above and will not be repeated here.
[0029] In addition, in the process of parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, the first sub-table data and the second sub-table data can also be extracted from the table data according to the preset extraction strategy, and the header tree structure of the first header category can be constructed based on the first sub-table data, and the header tree structure of the second header category can be constructed based on the second sub-table data; the preset extraction strategy here can be a preset number of extracted rows and / or extracted columns; the above-mentioned extraction of the first sub-table data and the second sub-table data from the table data, the construction of the header tree structure of the first header category based on the first sub-table data, and the construction of the header tree structure of the second header category based on the second sub-table data can also be replaced by extracting the first sub-table data or the second sub-table data from the table data, and constructing the header tree structure of the first header category based on the first sub-table data, or constructing the header tree structure of the second header category based on the second sub-table data.
[0030] In practical applications, in the process of parsing the table data corresponding to the problem to be processed to obtain the table header tree structure, in order to improve the accuracy and efficiency of parsing the table data header, a large language model can be introduced to extract the left sub-table data and the upper sub-table data from the table data, and the left sub-table data is input into the large language model to construct the tree structure to obtain the row header tree structure, and the upper sub-table data is input into the large language model to construct the tree structure to obtain the column header tree structure. It should be noted that the specific implementation method of extracting the left sub-table data and the upper sub-table data from the table data can be referred to the above content and will not be repeated here. Specifically, in the process of inputting the left sub-table data into the large language model for tree structure construction to obtain the row header tree structure, and inputting the upper sub-table data into the large language model for tree structure construction to obtain the column header tree structure, the left sub-table data can be written into the first prompt template to obtain the first prompt information, and the first prompt information is input into the large language model for tree structure construction to obtain the row header tree structure, and the upper sub-table data can be written into the second prompt template to obtain the second prompt information, and the second prompt information is input into the large language model for tree structure construction to obtain the column header tree structure; thus, since the row header data is on the left side of the table data, the row header tree structure is constructed by the left sub-table data, which can reduce the interference of the right side data in the table data on the construction of the row header tree structure, thereby improving the convenience and accuracy of the construction of the row header tree structure; similarly, the column header tree structure is constructed by the upper sub-table data, which can reduce the interference of the lower side data in the table data on the construction of the column header tree structure, thereby improving the efficiency and accuracy of the construction of the column header tree structure.
[0031] Among them, the first prompt template can include a node class definition. The node class definition can specifically define a node class. The node class contains three definition statements. The first definition statement defines the node name, the second definition statement defines the row range occupied by the node, and the third definition statement defines the node's subordinate nodes. In addition, the node class can also contain other definition statements. For example, the node class definition using Python language as an example is: define a class named Node (node), initialize instance variables through the constructor of the class (__init__ method), and the constructor receives three parameters: name, span, and children. These parameters are used to initialize the following instance variables respectively: Assign the name parameter (indicating the node name) to the instance variable self.name; Assign the span parameter (representing the row range occupied by the node) to the instance variable self.span; Assign the children parameter (representing the node's subordinate nodes) to the instance variable self.children.
[0032] In addition, the first prompt template may also include an example of table data or left sub-table data of at least one table type, and the first prompt template may also include a row header tree structure corresponding to the example of table data or left sub-table data of at least one table type; it should be noted that the number of examples of table data or left sub-table data of each table type included in the first prompt template may be one or more, and this embodiment does not specifically limit this; Similarly, the second prompt template may also include the above-mentioned node class definition. Different from the node class definition included in the first prompt template, the span parameter indicates the column range occupied by the node. In addition, the second prompt template may also include an example of table data or upper sub-table data of at least one table type, for example, the example of table data or upper sub-table data is: '||0|1|2|3|4|5|6|7|8|\n|---|---|---|---|---|---|---|---|---|---|---|\n|0|[EMPTY]|December31,2013|December 31,2013|December 31,2013|December 31,2013|December 31,2012|December 31,2012|December 31,2012|December 31,2012|\n|1|[EMPTY]|Total|Level1|Level2|Level3|Total|Level1|Level2|level3|\n|2|Revenue|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|\n|3|Revenue Item 1|$3,783|$3,783|[EMPTY]|[EMPTY]|$4,534|$4,534|[EMPTY]|[EMPTY]|'; It should be noted that the number of examples of table data or sub-table data of each table type included in the second prompt template may be one or more.
[0033] The second prompt template may further include a column header tree structure corresponding to the table data of at least one table type or the example of the upper sub-table data. Following the above example, the column header tree structure corresponding to the table data or the example of the upper sub-table data is: Node("root",[0,8],[Node("December 31,2013",[1,4],[Node("Total",[1,1],[]),Node("Level1",[2,2],[]),Node("Level2",[3,3],[]),Node("level3",[4,4],[])]),Node("December 31,2012",[5,8],[Node("Total",[5,5],[]),Node("Level1",[6,6],[]),Node("Level2",[7,7],[]),Node("Level3",[8,8],[])])]).
[0034] A first prompt template is constructed based on an example of table data of at least one table type or left sub-table data and a row header tree structure corresponding to the example. A second prompt template is constructed based on an example of table data of at least one table type or upper sub-table data and a column header tree structure corresponding to the example. For example, the second prompt template is as follows:
{NODE_CLASS} #Read the table row-wise, and find the column structure (not rowstructure) of the data part and represent it using the Node class Table='||0|1|2|3|4|5|6|7|8|\n|---|---|---|---|---|---|---|---|---|---|\n|0|[EMPTY]|December 31,2013|December 31,2013|December 31,2013|December31,2013|December 31,2012|December 31,2012|December 31,2012|December 31,2012|\n|1|[EMPTY]|Total|Level1|Level2|Level3|Total|Level1|Level2|level3|\n|2|Revenue|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|[EMPTY]|\n|3|Revenue Item 1|$3,783|$3,783|[EMPTY]|[EMPTY]|$4,534|$4,534|[EMPTY]|[EMPTY]|' column_tree=Node("root",[0,8],[Node("December 31,2013",[1,4],[Node("Total",[1,1],[]),Node("Level1",[2,2],[]),Node("Level2",[3,3],[]),Node("level3",[4,4],[])]),Node("December 31,2012",[5,8],[Node("Total",[5,5],[]),Node("Level1",[6,6],[]),Node("Level2",[7,7],[]),Node("Level3",[8,8],[])])]) #Read the table row-wise, and find the column structure (not rowstructure) of the data part and represent it using the Node class table={TABLE} #column tree using the Node class, make sure your code is executable (Use the Node class to create a column tree, make sure your code is executable)
[0035] It should be noted that the table data of at least one of the above-mentioned table types can be obtained in the following way: obtain multiple table data, encode the multiple table data to obtain the table feature vectors of the multiple table data, perform clustering processing on the multiple table data according to the table feature vectors to obtain the table data included in each cluster, select the reference table data of each cluster from the table data included in each cluster, the reference table data of each cluster can represent the table data of each table type, that is, one cluster can represent one table type, encoding the multiple table data can be executed by a table encoding model, for example, the table encoding model is Tapas (Table Parser), the clustering algorithm uses K-means++ (an improved K-means clustering algorithm, an unsupervised clustering algorithm), and K can represent the number of clusters for clustering.
[0036] The above can write the left sub-table data into the first prompt template to obtain the first prompt information, input the first prompt information into the large language model for tree structure construction to obtain the row header tree structure, and write the upper sub-table data into the second prompt template to obtain the second prompt information, input the second prompt information into the large language model for tree structure construction to obtain the list header tree structure; realize the construction of the row header tree structure and the list header tree structure through the large language model, and improve the efficiency and convenience of constructing the header tree structure; the row header tree structure and the list header tree structure in this embodiment can be in any form, such as code form or graph form, and in addition, it can also be in other forms.
[0037] For example, extract the upper sub-table data from the table data corresponding to the problem to be processed, write the upper sub-table data into the second prompt template to obtain the second prompt information, input the second prompt information into the large language model for tree structure construction, and the obtained list header tree structure (taking the python language as an example) is: column_tree=Node("Root node",[1,3], Node("Income and Expenditure Table",[1,1],[]), Node("Year",[2,3], Node("xx1 year xx month xx day",[2,2],[]), Node("xx2 year xx month xx day",[3,3],[]), ), ) Among them, column_tree represents the column header tree structure; "root node", [1,3] means that the root node in the column header tree structure occupies columns 1 to 3. Similarly, the "Income and Expenditure Statement" node occupies column 1, the "Year" node occupies columns 2 to 3, the "XX Year XX Month XX Day" node occupies column 2, and the "XX Year XX Month XX Day" node occupies column 3. At the same time, there is a recursive relationship between the nodes in the column header tree structure: the root node contains the income and expenditure statement and the year, and the year contains two leaf nodes, XX Year XX Month XX Day and XX Year XX Month XX Day. In this way, the header tree structure can be clearly expressed through the range occupied by the nodes and the recursive relationship between the nodes. The expression of the row header tree structure is similar to that of the column header tree structure, and will not be repeated here.
[0038] It should be supplemented that, in the above-mentioned input of the first prompt information into the large language model for tree structure construction to obtain a row header tree structure, the large language model can use the following method to construct the tree structure based on the first prompt information: extract the row header field from the left sub-table data contained in the first prompt information, determine the hierarchical relationship between the row header fields based on the row range, column range and / or indentation information of each row header field, and construct the row header tree structure based on the hierarchical relationship and the row range of each row header field; similarly, the large language model can use the following method to construct the tree structure based on the second prompt information to obtain a column header tree structure: extract the column header field from the upper sub-table data contained in the second prompt information, determine the hierarchical relationship between the column header fields based on the row range, column range and / or indentation information of each column header field, and construct the column header tree structure based on the hierarchical relationship and the column range of each column header field.
[0039] Among them, the indentation information of each row header field may refer to whether each row header field is indented relative to the row header field of the previous row. The row range of each row header field refers to the range of the row where each row header field is located. For example, the row range of the row header field "Income and Expenditure Table" in the left sub-table data of Table 2 is [1,2]. The column range here and the row range, column range and indentation information of each column header field are not repeated here.
[0040] For example, the row range of the row header field "Income" in the left sub-table data of Table 2 is [3,3], and the column range is [1,2]. The row range of "Income Item 1" is [4,4], and the column range is [1,1]. The column range of "Income" is larger than the column range of "Income Item 1", and "Income Item 1" is indented relative to the row header field "Income" in the previous row. According to the row range, column range and / or indentation information of the row header field "Income", the hierarchical relationship between "Income" and "Income Item 1" is determined to be that the level of "Income" is higher than the level of "Income Item 1", and the row header tree structure is constructed based on the hierarchical relationship and row range of each row header field.
[0041] In addition to the above-mentioned row header tree structure and column header tree structure which can be in the form of code, the first prompt template and the second prompt template can also adopt the form of code prompt words. The code prompt words can effectively stimulate the structured understanding ability of the large language model, which is helpful to directly obtain the executable tree definition code later. It should be added that, in addition to the above-mentioned implementation method of parsing the header of the table data corresponding to the problem to be processed to obtain the header tree structure, there are other ways to parse the table data to obtain the header tree structure. For example, when the table data is in the form of HTML (Hyper Text Markup Language) programming language, the HTML syntax can be used to parse the table data to obtain the header tree structure.
[0042] In specific implementations, the data structure of the header tree structure may still be relatively complex. Therefore, in order to improve the convenience of the subsequent large language model in understanding the table data, the header tree structure can be converted into multiple header field sequences to achieve the purpose of simplifying the header tree structure. In an optional implementation provided by this embodiment, in the process of converting the header tree structure to obtain multiple header field sequences, the following operations are performed: Extracting a third header field sequence from the header tree structure of the first header category, and extracting a fourth header field sequence from the header tree structure of the second header category; The third header field sequence and the fourth header field sequence are merged to obtain multiple header field sequences.
[0043] Among them, the third header field sequence may include the header field sequence of the first header category, specifically the row header field sequence, and the third header field sequence may be one or more; the fourth header field sequence may include the header field sequence of the second header category, specifically the column header field sequence, and the fourth header field sequence may be one or more.
[0044] Specifically, a row header field sequence can be extracted from the row header tree structure, and a column header field sequence can be extracted from the column header tree structure, and the row header field sequence and the column header field sequence can be merged to obtain multiple header field sequences; in the process of merging the row header field sequence and the column header field sequence, the row header field sequence and the column header field sequence can also be deduplicated to obtain a deduplicated row header field sequence and a deduplicated column header field sequence, and the deduplicated row header field sequence and the deduplicated column header field sequence can be merged to obtain multiple header field sequences.
[0045] Continuing with the above example, we perform a deep traversal from the root node of the row and column header tree structures to each leaf node to obtain the header field sequence from the root node to all leaf nodes. Since the root node is a conceptual virtual node, we can remove it to obtain the final row and column header field sequences, which can then be merged to obtain multiple header field sequences. That is, the row header field sequence extracted from the row header tree structure is "Node_Income and Expenditure Table", "Node_Income, Node_Income Item 1", "Node_Income, Node_Income Item 2", "Node_Income, Node_Income Item 3", "Node_Income, Node_Income Total", "Node_Expenditure, Node_Expenditure Item 1", "Node_Expenditure, Node_Expenditure Item 2", "Node_Expenditure, Node_Expenditure Item 3", "Node_Expenditure, Node_Expenditure Item 4", "Node_Expenditure, Node_Expenditure Total", and the column header field sequence extracted from the column header tree structure is "Node_Income and Expenditure Table", "Node_Year, Node_xx1YearxxMonthxxDay", "Node_Year, Node_xx2YearxxMonthxxDay"; The row header field sequence and the column header field sequence are merged to obtain multiple header field sequences such as "Node_Income and Expenditure Table", "Node_Income, Node_Income Item 1", "Node_Income, Node_Income Item 2", "Node_Income, Node_Income Item 3", "Node_Income, Node_Income Total", "Node_Expenditure, Node_Expenditure Item 1", "Node_Expenditure, Node_Expenditure Item 2", "Node_Expenditure, Node_Expenditure Item 3", "Node_Expenditure, Node_Expenditure Item 4", "Node_Expenditure, Node_Expenditure Total", "Node_Income and Expenditure Table", "Node_Year, Node_xx1YearxxMonthxxDay", "Node_Year, Node_xx2YearxxMonthxxDay"; that is, the row header field sequence and the column header field sequence are combined as multiple header field sequences.
[0046] The optional implementation method of converting the header tree structure to obtain multiple header field sequences can also be performed based on the above optional implementation method of parsing the header of the table data corresponding to the problem to be processed to obtain the header tree structure.
[0047] Step S104: input the multiple header field sequences and the questions to be processed into a large language model for sequence screening and screening process extraction, and output screening process information.
[0048] The above-mentioned process involves parsing the headers of the table data corresponding to the pending question to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences. In this step, to further reduce interference data in generating answers to the pending question, the multiple header field sequences and the pending question can be input into a large language model, and the large language model can be used to perform sequence screening and extraction of the screening process. Specifically, the large language model can be used to perform sequence screening and extraction of the screening process among the multiple header field sequences based on the pending question. In other words, the large language model can be used to screen the first header field sequence associated with the pending question from among the multiple header field sequences, thereby reducing data interference from header field sequences unrelated to the pending question. The large language model in this embodiment can be a large language model trained based on a hybrid of text and code corpus, namely, a Text+Code LLM (Large Language Model). This means that the large language model can understand and generate natural language text and can also process code. The screening process information refers to information related to the screening process of performing sequence screening among the multiple header field sequences based on the pending question, such as screening chains of thoughts (CoT).
[0049] During the specific implementation process, in order to improve the accuracy of sequence screening by the large language model, third prompt information can be constructed based on multiple header field sequences and pending questions. Specifically, multiple header field sequences and pending questions can be written into a third prompt template to obtain third prompt information. The third prompt information is input into the large language model for sequence screening and screening process extraction, and the screening process information is output; Among them, the third prompt template may include a question example of at least one question type, such as the question example "how many percent of black male workers were employed in the transportation andwarehousing sector?"; in this embodiment, the content in brackets after the English and English is an interpretation of the English content, not the original content in the example, and the original content may only include the English part; the question examples here may also be one or more. In the case of multiple examples, they may be question examples of multiple question types, and each question type may be one or more question examples. The question examples of multiple question types are similar to the example of table data of at least one table type mentioned above, and a clustering method may also be used. Please refer to it for reading and will not be repeated here.
[0050] In addition, the third prompt template may also include multiple header field sequences of question examples of at least one question type. For example, the multiple header field sequences of the above question example "how many percent of black male workers were employed in the transportation and warehousing sector?" are: [('percent','agriculture, forestry, fishing and hunting'),('percent','mining, quarrying, and oil and gas extraction'),('percent','utilities'),('percent','construction'),('percent', 'manufacturing'),('percent','wholesale trade'),('percent','retail trade'),('percent','transportation and warehousing'),('percent','information and cultural industries'),('percent','finance and insurance'),('percent','real estate and rental and leasing(real estate and leasing)'),('percent','professional(professional), scientific(scientific) and technical services(technical services)'),('percent','administrative and support(administrative and support, waste managementand remediation services(waste management and remediation services)'), ('percent','educationalservices(educational services)'),('percent','health care and social assistance(health care and social assistance)'), ('percent', 'arts(arts, entertainment and recreation(leisure and recreation)'),('percent', 'accommodation and food services(accommodation and food services)'),('percent', 'other services(other services)'), ('percent', 'public administration(public administration)'),('percent', 'total'), ('black male workers', 'immigrant'), ('black male workers', 'second generation'), ('black male workers', 'third generation or more'),('black male workers', 'total'), ('other male workers','immigrant'), ('other male workers','second generation'),('other male workers','third generation more'),('other male workers','total')]. ,
[0051] The third prompt template may further include screening process information of question examples of at least one question type. The screening process information may be obtained by inputting the question examples and multiple header field sequences of the question examples into the large language model for sequence screening and screening process extraction. For example, the screening process information of the above question example is: Let us look at the relevant tuples in the information given. 1. The specific group of workers, which in this case is 'black male workers'. 2. The specific sector, which in this case is 'transportation and warehousing'. 3.The specific statistic, which in this case is the percentage of workers in the sector. Therefore, from the list of information provided, we should choose ('percent','transportation and warehousing'),('black male workers','total'). That is, answer=[('percent','transportation and warehousing'),('black male workers','total')]
[0052] Continuing with the above example, the third prompt template is as follows:
Please proceed with an information finding exercise. You will be provided with a list of information and a question. Your task is to read allof provided content thoroughly and think step by step to choose all relevanttuples from the list of information that can help you to answer the question. Question: How many percent of black male workers were employed in the transportation and warehousing sector? List of Information: [('percent','agriculture,forestry,fishing and hunting'),('percent','mining,quarrying,and oil and gasextraction'),('percent','utilities'),('percent','construction'),('percent', 'manufacturing'),('percent','wholesale trade'),('percent','retail trade'),('percent','transportation and warehousing'),('percent','information and cultural industries'),('percent','finance and insurance'),('percent','real estate and rental and leasing(real estate and leasing)'),('percent','professional(professional, scientific(science) and technical services(technical services)'),('percent','administrative and support(administrative and support,waste management and remediation services(waste management and remediation services)'),('percent','educational services(educational services)'),('percent','health care and social assistance(health care and social assistance)'),('percent', 'arts(arts, entertainment and recreation)'),('percent', 'accommodation and food services(accommodation and food services)'),('percent','other services(other services)'),('percent','public administration(public administration)'),('percent', 'total'), ('black male workers', 'immigrant'), ('black male workers', 'second generation'), ('black male workers', 'third generation or more'), ('black male workers', 'total'), ('other male workers','immigrant'), ('othermale workers','second generation'),('other male workers','third generation more'),('other male workers','total')], Answer: Let us look at the relevant tuples in the information given. 1. The specific group of workers, which in this case is 'black male workers'. 2.The specific sector, which in this case is 'transportation andwarehousing'. 3.The specific statistic, which in this case is the percentage of workers in the sector. Therefore, from the list of information provided, we should choose ('percent', 'transportation and warehousing'),('black male workers','total'). That is, answer = [('percent', 'transportation and warehousing'), ('black male workers', 'total')] Question: {QUESTION} List of Information: {LIST_INFO} Answer: Let us look at the relevant tuples in the information given.
[0053] Specifically, sequence screening may include screening the first header field sequence associated with the problem to be processed from multiple header field sequences. Specifically, the matching degree between the problem to be processed and each header field sequence in the multiple header field sequences may be calculated, and sequence screening may be performed in the multiple header field sequences according to the matching degree. Specifically, the multiple header field sequences may be sorted according to the matching degree, and the first header field sequence whose sorting position is before the preset position is selected in the sorting result.
[0054] For example, the question to be processed is "What is the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2?". The question to be processed and multiple header field sequences: "Node_Income and Expenditure Table", "Node_Income, Node_Income Item 1", "Node_Income, Node_Income Item 2", "Node_Income, Node_Income Item 3", "Node_Income, Node_Total Income", "Node_Expenditure, Node_Expenditure Item 1", "Node_Expenditure, Node_Expenditure Item 2", "Node_Expenditure, Node_Expenditure Item 3", "Node_Expenditure, Node_Expenditure Item 4", "Node_Expenditure, Node_Total Expenditure", "Node_Income and Expenditure Table", "Node_Year, Node_XX1", and "Node_Year, Node_XX2" are input into the large language model for sequence screening and screening process extraction. The output screening process information is as follows: 1. Specific income, namely "Income Item 1", which indicates that we should pay attention to the statistics of all income items 1; 2. Specific years: xx / xx / xx1 and xx / xx / xx2; 3. Specific statistical data, in this case, the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2; Therefore, from the list of information provided, we should select ('Income', 'Income Item 1'), ('Year', 'XX Month XX Day XX Year ...
[0055] In actual applications, the entire table data may be large. If the subsequent large language model directly generates answers to the questions to be processed based on the entire table data, it may be interfered with by data in the table data that is not related to the questions to be processed, thereby reducing the efficiency and accuracy of answer generation. To address this issue, in order to improve the efficiency and accuracy of the subsequent answer generation by the large language model and enhance the convenience and effectiveness of answer generation, this embodiment provides an optional implementation in which the large language model also outputs a first header field sequence after performing sequence screening and extraction during the screening process. After inputting multiple header field sequences and pending questions into the large language model for sequence screening and screening process extraction, and outputting the screening process information, you can also perform the following operations: Classify the first header field sequence to obtain a header category to which the first header field sequence belongs; Extract sub-table data from table data based on table header categories.
[0056] The header category may include a first header category and / or a second header category. For example, the first header category is a row header category, and the second header category is a column header category.
[0057] On this basis, in a first optional implementation provided by this embodiment, in the process of extracting sub-table data from table data based on the table header category, the following operations are performed: If the header category includes a first header category and a second header category, determining an extraction position in the table data according to the first header field sequence; Extract the sub-table data corresponding to the extraction position from the table data.
[0058] The first header category may include a row header category, and the second header category may include a column header category.
[0059] Specifically, if the header category includes a row header category and a column header category, the row extraction position can be determined in the table data according to the row header field sequence in the first header field sequence, and the column extraction position can be determined in the table data according to the column header field sequence in the first header field sequence, and the sub-table data corresponding to the row extraction position and the column extraction position can be extracted from the table data; more specifically, if the header category includes a row header category and a column header category, the row extraction position can be determined in the table data according to the arrangement order and row range of the row header fields contained in the row header field sequence in the first header field sequence, and the column extraction position can be determined in the table data according to the arrangement order and column range of the column header fields contained in the column header field sequence in the first header field sequence, and the sub-table data corresponding to the row extraction position and the column extraction position can be extracted from the table data.
[0060] Continuing with the above example, after the large language model performs sequence screening and extraction during the screening process, it also outputs the first header field sequence as "Node_Year, Node_Date of xx1 year xx month xx day", "Node_Year, Node_Date of xx2 year xx month xx day", "Node_Revenue, Node_Revenue Item 1". Among the first header field sequence, "Node_Revenue, Node_Revenue Item 1" is the row header field sequence, and "Node_Year, Node_Date of xx1 year xx month xx day" and "Node_Year, Node_Date of xx2 year xx month xx day" are the list header field sequences. Then, the header category to which the first header field sequence belongs includes the row header category and the list header category. In this case, according to the row header field sequence "Node_Revenue, Node_Revenue Item 1", the row extraction position is determined as the row where Revenue Item 1 is located in the table data. According to the list header field sequences "Node_Year, Node_Date of xx1 year xx month xx day" and "Node_Year, Node_Date of xx2 year xx month xx day", the column extraction positions are determined as the two columns where "xx1 year xx month xx day" and "xx2 year xx month xx day" are located. Then, the sub-table data corresponding to the row extraction position and the column extraction position is extracted from the table data as shown in Table 4 below:
[0061] Table 4 Furthermore, during the process of determining the extraction position in the table data according to the first header field sequence above, since the first header field sequence output by the large language model may lack useful information, that is, lack important information for answer generation. In response to this, in order to improve the comprehensiveness and accuracy of answer generation, so that the sub-table data obtained through the first header field sequence can more comprehensively assist in answer generation; in an optional implementation manner provided in this embodiment, during the process of determining the extraction position in the table data according to the first header field sequence, the following operations are performed: Eliminate the header fields in the first header field sequence whose ranking positions are after the preset position, and obtain the second header field sequence; Determine the position corresponding to the second header field sequence in the table data as the extraction position.
[0062] Among them, the preset position can be the xth from the bottom, for example, the second from the bottom, then the header field in the first header field sequence that is the first from the bottom can be eliminated; the preset position can be any position, and this embodiment does not specifically limit the preset position.
[0063] Specifically, header fields whose arrangement positions are after a preset position can be removed from the row header field sequence or the column header field sequence included in the first header field sequence to obtain a second row header field sequence or a second column header field sequence; the positions corresponding to the second row header field sequence and the column header field sequence included in the first header field sequence are determined in the table data as extraction positions, or the positions corresponding to the second column header field sequence and the row header field sequence included in the first header field sequence are determined in the table data as extraction positions; in addition, header fields whose arrangement positions are after a preset position can also be removed from the row header field sequence and the column header field sequence respectively to obtain a second row header field sequence and a second column header field sequence, and the positions corresponding to the second row header field sequence and the second column header field sequence are determined in the table data as extraction positions; it should be noted that the preset positions involved in the process of removing header fields from the row header field sequence and the column header field sequence can be the same or different.
[0064] For example, the first header field sequence output by the large language model includes the row header field sequence "Node_Income, Node_Income Item 1", the column header field sequences "Node_Year, Node_xx1YearxxMonthxxDay" and "Node_Year, Node_xx2YearxxMonthxxDay". The penultimate header field "Node_Income Item 1" is removed from the row header field sequence "Node_Income, Node_Income Item 1", and the second row header field sequence is obtained as "Node_Income". The position corresponding to the second row header field sequence "Node_Income" and the column header field sequences "Node_Year, Node_xx1YearxxMonthxxDay" and "Node_Year, Node_xx2YearxxMonthxxDay" included in the first header field sequence is determined in the table data as the extraction position. The sub-table data corresponding to the extraction position is extracted from the table data as shown in Table 5 below:
[0065] Table 5 In actual application scenarios, in the above-mentioned process of extracting sub-table data from table data based on the header category to which the first header field sequence belongs, the header category to which the first header field sequence belongs may only include the first header category or the second header category, that is, only include one of the first header category and the second header category. In this case, in order to extract the sub-table data from the table data, the sub-table data is used to narrow the range of table data referenced by the subsequent large language model for answer generation, thereby reducing the amount of calculation of the subsequent large language model in the process of answer generation, thereby improving the efficiency of answer generation. In the second optional implementation manner provided by this embodiment, in the above-mentioned process of extracting sub-table data from table data based on the header category, the following operations are performed: If the header category includes the first header category, determining an extraction position in the table data according to the first header field sequence and a header field sequence of the second header category in the plurality of header field sequences; The sub-table data corresponding to the extraction position is extracted from the table data.
[0066] In addition, if the header category includes a second header category, an extraction position can be determined in the table data based on the first header field sequence and the header field sequence of the first header category in multiple header field sequences, and sub-table data corresponding to the extraction position can be extracted from the table data.
[0067] For example, the first header field sequence includes "Node_Income, Node_Income Item 1", that is, the header category to which the first header field sequence belongs includes the row header category. Then, based on the row header category "Node_Income, Node_Income Item 1" and the column header field sequences "Node_Income and Expenditure Table", "Node_Year, Node_xx1YearxxMonthxxDay", and "Node_Year, Node_xx2YearxxMonthxxDay" in the multiple header field sequences, the extraction position is determined in the table data, and the sub-table data is extracted from the table data according to the extraction position, as shown in Table 6 below:
[0068] Table 6 Step S106: construct prompt information based on the problem to be processed, the screening process information and the table data.
[0069] In the above, multiple header field sequences and pending questions are input into the large language model for sequence screening and screening process extraction, and the screening process information is output. In this step, the pending questions, screening process information and table data can be combined to construct prompt information to obtain prompt information. In this way, the pending questions, screening process information and table data are organized into structured information through prompt information construction. The structured prompt information is convenient for the subsequent large language model to understand, thereby improving the efficiency and accuracy of answer generation. It should be noted that the screening process information used in the process of constructing the prompt information can be the entire content of the screening process information or part of the content of the screening process information.
[0070] In specific implementation, the screening process information output by the above-mentioned large language model can represent the process of the large language model screening the first header field sequence associated with the problem to be processed from multiple header field sequences. In this case, the problem to be processed, the screening process information and the table data can be written into the fourth prompt template to obtain prompt information, thereby helping the subsequent large language model to understand the table through the screening process information.
[0071] In actual applications, the amount of table data may be large, which is not conducive to the subsequent large language model to generate answers. To improve the efficiency of the subsequent large language model in generating answers and reduce the amount of calculation in the process of answer generation by the large language model, an optional implementation method provided by this embodiment, in the process of constructing prompt information based on the question to be processed, the screening process information and the table data, the prompt information can be constructed based on the question to be processed, the screening process information, the sub-table data in the table data and the first header field sequence. Specifically, the following operations can be performed: The problem to be processed, the screening process information, the sub-table data in the table data and the first header field sequence are written into the prompt template to obtain prompt information.
[0072] Optionally, the prompt template includes a benchmark question of at least one question type and question-answer prompt information of the benchmark question.
[0073] The benchmark question here may be an example question, that is, the prompt template may include an example question of at least one question type, and the question-answer prompt information may include table data or sub-table data corresponding to the example question, the first header field sequence of the example question, answer generation process information and / or the answer to the example question, that is, the prompt template may include table data or sub-table data corresponding to the example question, and may also include the first header field sequence of the example question; Continuing with the previous example, let's say the question is "how many percent of black male workers were employed in the transportation and warehousing sector?" The first header field sequence for the question is: [('percent','transportation and warehousing'),('black male workers','total')]
[0074] In addition, the prompt template may also include the answer generation process information and the answer to the example question. Continuing with the above example, the answer generation process information for the example question is: 1. The specific group of workers, which in this case is 'black male workers'. 2. The specific sector, which in this case is 'transportation andwarehousing'. 3. The specific statistic, which in this case is the percentage of workers in the sector. 4. The table shows the percentage of black male workers in the transportation and warehousing sector as 11.1%. Therefore, 11.1% of black male workers were employed in the transportation and warehousing sector. The answer to the example problem is 11.1.
[0075] Continuing with the above example, the prompt template would look like this:
Please proceed with an information finding exercise. You will be provided with a list of information and a question. Your task is to read allof provided content thoroughly and think step by step to choose all relevanttuples from the list of information that can help you to answer the question. Question: How many percent of black male workers were employed in the transportation and warehousing sector? Table: {TABLE1} Hint: Look at those rows and columns: [('percent', 'transportation andwarehousing'), ('black male workers', 'total')] Answer: Let us look at the relevant tuples in the information given. 1. The specific group of workers, which in this case is 'black male workers'. 2.The specific sector, which in this case is 'transportation andwarehousing'. 3.The specific statistic, which in this case is the percentage of workers in the sector. 4.The table shows the percentage of black male workers in the transportation and warehousing sector as 11.1%. Therefore, 11.1% of black male workers were employed in the transportation and warehousing sector. That is, answer=11.1 (the answer is 11.1). Question: {QUESTION} Table: {TABLE} Hint: Look at those rows and columns: {HINT} Answer: Let us look at the relevant tuples in the information given. {TABLEUNDERSTAND_COT}
[0076] Specifically, the pending issues, the screening process information of the pending issues, the sub-table data in the table data, and the first header field sequence may be written into the prompt template to obtain prompt information; Continuing with the above example, the prompt template contains at least one example question of the question type, the table data or sub-table data corresponding to the example question, the first header field sequence of the example question, the answer generation process information and the answer to the example question. The question to be processed is "What is the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2?" and the content in the screening process information: 1. Specific income, namely "Income Item 1", which indicates that we should pay attention to the statistics of all income items 1; 2. Specific years: xx / xx / xx1 and xx / xx / xx2; 3. Specific statistical data, in this case, the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2; The sub-table data shown in Table 4 or Table 5 and the first header field sequence: "Node_year, Node_xx1 year xx month xx day", "Node_year, Node_xx2 year xx month xx day", "Node_income, Node_income item 1" are written into the prompt template to obtain prompt information.
[0077] In addition, in the process of constructing prompt information based on pending issues, screening process information and table data, in order to meet the diverse needs of prompt information construction and improve the flexibility of prompt information construction, prompt information can be constructed based on pending issues, screening process information, the first header field sequence and table data; prompt information can also be constructed based on pending issues, screening process information, sub-table data and the first header field sequence; prompt information can also be constructed based on pending issues, screening process information and sub-table data.
[0078] Step S108: input the prompt information into the large language model, and output the answer generation process information and the answer to the question to be processed.
[0079] The above step constructs prompt information based on the pending questions, screening process information and table data. In this step, the prompt information is input into the large language model, and the answer is generated through the large language model, and the answer generation process information and answer of the pending questions are output.
[0080] The answer generation process information in this embodiment refers to relevant information of the generation process of answer generation, such as the answer generation thought chain, which can be the reasoning process for answer generation; the answer generation process information of the problem to be processed may include the above-mentioned screening process information, or may not include the above-mentioned screening process information.
[0081] Continuing with the previous example, the question to be processed is "What is the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2?". The prompt information constructed based on the question to be processed, the screening process information, the sub-table data in the table data, and the first header field sequence is input into the large language model. The large language model is used to generate the answer. The answer generation process information and answer to the question to be processed are obtained as follows: 1. Specific income, namely "Income Item 1", which indicates that we should pay attention to the statistics of all income items 1; 2. Specific years: xx / xx / xx1 and xx / xx / xx2; 3. Specific statistical data, in this case, the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2; 4. The table shows that the income amount of income item 1 on xx / xx / xx1 is xxxxx1, and the income amount of income item 1 on xx / xx / xx2 is xxxxx2. The difference between the two is (xxxxx1-xxxxx2), and the growth rate is (xxxxx1-xxxxx2) / xxxxx2. Therefore, the growth rate of the income amount of income item on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2 is (xxxxx1-xxxxx2) / xxxxx2; The answer to the pending question is: (xxxxx1-xxxxx2) / xxxxx2.
[0082] It should be added that in order to further reduce the operational procedures involved in the process of generating answers to the questions to be processed, while ensuring the accuracy of the answer generation process information and the answers, the convenience of answer generation can be improved; in this embodiment, steps S104 to S108 can be replaced by inputting the questions to be processed, multiple header field sequences and table data into the large language model for answer generation, and outputting the answer generation process information and answers to the questions to be processed; or, can be replaced by constructing prompt information based on the questions to be processed, multiple header field sequences and table data, inputting the prompt information into the large language model for answer generation, and outputting the answer generation process information and answers to the questions to be processed.
[0083] Specifically, in the process of constructing prompt information based on the pending questions, multiple header field sequences and table data, the pending questions, multiple header field sequences and table data can be written into the fifth prompt template to obtain prompt information; the fifth prompt template may include an example question of at least one question type, table data of the example question, multiple header field sequences of the example question, answer generation process information of the example question and / or the answer to the example question.
[0084] For example, the fifth prompt template looks like this:
Please proceed with a table-based question answering exercise. You will be provided with a table, a question and a corresponding list of information. Your task is to read all the provided content thoroughly and think step by step to choose all relevant tuples from the list of information to answer the question. Question: {QUESTION1} Table: {TABLE1} List of Information: {LIST_INFO1} Answer: {ANSWER1} Question: {QUESTION} Table: {TABLE} List of Information: {LIST_INFO} Answer: Let us look at the relevant tuples in the information given.
[0085] Since the fifth prompt template no longer requires the first header field sequence of the example question, sub-table data and screening process information, table understanding is no longer explicitly performed. Instead, the thinking mode of understanding the table first and then generating the answer can be passed to the large language model through the example question, the table data of the example question, the multiple header field sequences of the example question, the answer generation process information of the example question and the answer to the example question in the fifth prompt template, so that the large language model can learn how to first perform table understanding and then generate the answer based on the question to be processed, the table data of the question to be processed and the multiple header field sequences of the question to be processed, and finally obtain the answer generation process information and the answer to the question to be processed.
[0086] The above-mentioned process writes the pending question, multiple table header field sequences and table data into the fifth prompt template to obtain prompt information. On this basis, the prompt information is input into the large language model for answer generation, and the answer generation process information and answer of the pending question are output.
[0087] Continuing with the above example, the question to be processed, multiple table header field sequences, and table data are written into the fifth prompt template shown above to obtain prompt information. The prompt information is input into the large language model for answer generation. The output of the answer generation process information and the answer to the question to be processed is: 1. Specific income, namely "Income Item 1", which indicates that we should pay attention to the statistics of all income items 1; 2. Specific years: xx / xx / xx1 and xx / xx / xx2; 3. Specific statistical data, in this case, the growth rate of the income amount of income item 1 on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2; 4. The table shows that the income amount of income item 1 on xx / xx / xx1 is xxxxx1, and the income amount of income item 1 on xx / xx / xx2 is xxxxx2. The difference between the two is (xxxxx1-xxxxx2), and the growth rate is (xxxxx1-xxxxx2) / xxxxx2. Therefore, the growth rate of the income amount of income item on xx / xx / xx1 compared to the income amount of income item 1 on xx / xx / xx2 is (xxxxx1-xxxxx2) / xxxxx2; The answer to the pending question is: (xxxxx1-xxxxx2) / xxxxx2.
[0088] It should be added that the examples in each prompt template of this embodiment can be one or more, the prompt template can be in code form, the content in the prompt template can be expressed in any language form, such as Chinese or English, and can also be other languages. The output of the large language model can also be expressed in any language form, such as Chinese or English, and can also be other languages. The output of the large language model can also be in code form.
[0089] In summary, the problem handling method provided in this embodiment first performs header parsing on the table data corresponding to the problem to be handled to obtain a row header tree structure and a column header tree structure, extracts a row header field sequence from the row header tree structure, extracts a column header field sequence from the column header tree structure, merges the row header field sequence and the column header field sequence to obtain multiple header field sequences, constructs third prompt information based on the problem to be handled and the multiple header field sequences, inputs the third prompt information into the large language model for sequence screening and screening process extraction, and outputs screening process information and the first header field sequence. In this way, since the data relationship in the table data is mostly reflected through the header, the table data is converted into a row header field sequence and a column header field sequence. At the same time, the complex table data, such as a data structure, is converted into a header field sequence, thereby improving the convenience and efficiency of sequence screening by the large language model. Secondly, the first header field sequence is classified and processed to obtain the header category to which the first header field sequence belongs. If the header category includes a row header category and a column header category, header fields whose arrangement position is after a preset position are removed from the first header field sequence to obtain a second header field sequence. The position corresponding to the second header field sequence is determined in the table data as the extraction position, and the sub-table data corresponding to the extraction position is extracted from the table data. In this way, by extracting the sub-table data from the table data, the range of the table data is further narrowed, and the sub-table data related to the problem to be processed is located in the table data. At the same time, by removing the header fields after the preset position, the extraction range of the sub-table data is expanded, thereby avoiding the first header field sequence from missing some important information and improving the comprehensiveness of the sub-table data. Finally, a second prompt is constructed based on the pending question, screening process information, sub-table data, and the first header field sequence. The second prompt is input into the large language model for answer generation, and the answer generation process information and the answer to the pending question are output. In this way, the screening process information and the first header field sequence are used to help the large language model understand the table data. At the same time, the input sub-table data is used to avoid directly inputting the table data into the large language model, which leads to low efficiency in answer generation, thereby improving the efficiency and convenience of answer generation.
[0090] The following uses the application of a problem-solving method provided by this embodiment in a form question-answering scenario as an example to further illustrate the problem-solving method provided by this embodiment. Figure 3 ,The problem processing method applied to the table question and answer scenario specifically includes the following steps.
[0091] Step S302: extract the left sub-table data and the upper sub-table data from the table data corresponding to the problem to be processed.
[0092] In step S304, the left sub-table data is written into the first prompt template to obtain the first prompt information, the first prompt information is input into the large language model to construct the tree structure, and the row header tree structure is obtained. The upper sub-table data is written into the second prompt template to obtain the second prompt information, the second prompt information is input into the large language model to construct the tree structure, and the column header tree structure is obtained.
[0093] Step S306 : extracting a row header field sequence from the row header tree structure and a column header field sequence from the column header tree structure, and merging the row header field sequence and the column header field sequence to obtain multiple header field sequences.
[0094] Step S308: Construct a third prompt information based on the problem to be processed and multiple header field sequences, input the third prompt information into the large language model for sequence screening and screening process extraction, output the screening process information and the first header field sequence, classify the first header field sequence, and obtain the header category to which the first header field sequence belongs.
[0095] Step S310: If the header category includes a row header category and a column header category, header fields whose ranking is after a preset ranking are removed from the first header field sequence to obtain a second header field sequence.
[0096] Step S312: determining a position corresponding to the second header field sequence in the table data as an extraction position, and extracting the sub-table data from the table data according to the extraction position.
[0097] Step S314 : constructing prompt information according to the problem to be processed, the screening process information, the first header field sequence and the subtable data.
[0098] Step S316: input the prompt information into the large language model, and output the answer generation process information and the answer to the question to be processed.
[0099] It should be noted that the above steps S310 to S312 can be replaced by, if the header category includes a row header category, then the extraction position is determined in the table data according to the first header field sequence and the column header field sequence in the multiple header field sequences, and the sub-table data is extracted from the table data according to the extraction position; it can also be replaced by, if the header category includes a column header category, then the extraction position is determined in the table data according to the first header field sequence and the row header field sequence in the multiple header field sequences, and the sub-table data is extracted from the table data according to the extraction position; the above steps S310 to S312 and the two replacement implementation methods provided here can also be arbitrarily executed. This embodiment does not make specific limitations.
[0100] It should also be noted that any one of steps S302 to step S316 or any combination of multiple steps can be combined with any one of steps S102 to step S108 to form a new implementation method according to the needs of implementation deployment; in addition, according to the needs of actual deployment, any one or multiple technical features can be selected from steps S302 to step S316 and combined with any one or multiple technical features provided by steps S102 to step S108 to form a new implementation method; or, any one or multiple technical features in steps S302 to step S316 can also be replaced by any one or multiple technical features provided by steps S102 to step S108 to form a new implementation method according to the needs of actual deployment, which will not be repeated here.
[0101] An embodiment of a problem solving device provided in this specification is as follows: In the above embodiment, a problem handling method is provided, and correspondingly, a problem handling device is also provided, which will be described below with reference to the accompanying drawings.
[0102] Reference Figure 4 , which shows a schematic diagram of a problem handling device provided by this embodiment.
[0103] Since the device embodiment corresponds to the method embodiment, the description is relatively simple. For the relevant parts, please refer to the corresponding description of the method embodiment provided above. The device embodiment described below is only illustrative.
[0104] This embodiment provides a problem handling device, the device comprising: A header parsing module 402 is configured to parse the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and convert the header tree structure to obtain multiple header field sequences; A sequence screening module 404 is configured to input the plurality of header field sequences and the pending question into a large language model for sequence screening and screening process extraction, and output screening process information; An information construction module 406 is configured to construct prompt information based on the problem to be processed, the screening process information, and the table data; The information input module 408 is used to input the prompt information into the large language model and output the answer generation process information and the answer to the question to be processed.
[0105] In one embodiment, the large language model in the sequence screening module 404 further outputs a first header field sequence after performing sequence screening and extraction during the screening process; The problem processing device, after inputting the plurality of header field sequences and the problem to be processed into the large language model for sequence screening and screening process extraction, and outputting screening process information, further performs the following operations: Classify the first header field sequence to obtain a header category to which the first header field sequence belongs; Extract sub-table data from table data based on table header categories.
[0106] In one embodiment, the prompt information is constructed based on the pending problem, the screening process information, and the table data, and is implemented in the following manner: Writing the pending problem, the screening process information, the sub-table data in the table data, and the first header field sequence into a prompt template to obtain the prompt information; The prompt template includes a benchmark question of at least one question type and question-answer prompt information of the benchmark question.
[0107] In one embodiment, the extracting of sub-table data from the table data based on the table header category is implemented in the following manner: If the header category includes a first header category and a second header category, determining an extraction position in the table data according to the first header field sequence; The sub-table data corresponding to the extraction position is extracted from the table data.
[0108] In one embodiment, determining the extraction position in the table data according to the first header field sequence is implemented in the following manner: Remove header fields whose arrangement positions are after a preset position from the first header field sequence to obtain a second header field sequence; A position corresponding to the second header field sequence is determined in the table data as the extraction position.
[0109] In one embodiment, the extracting of sub-table data from the table data based on the table header category is implemented in the following manner: If the header category includes a first header category, determining an extraction position in the table data according to the first header field sequence and a header field sequence of a second header category in the plurality of header field sequences; The sub-table data corresponding to the extraction position is extracted from the table data.
[0110] In one embodiment, the header parsing of the table data corresponding to the problem to be processed to obtain the header tree structure is implemented in the following manner: Determining a table type corresponding to the table data, and extracting first sub-table data and second sub-table data from the table data according to an extraction method corresponding to the table type; A header tree structure of a first header category is constructed based on the first sub-table data, and a header tree structure of a second header category is constructed based on the second sub-table data.
[0111] In one embodiment, the conversion of the header tree structure to obtain multiple header field sequences is implemented as follows: Extracting a third header field sequence from the header tree structure of the first header category, and extracting a fourth header field sequence from the header tree structure of the second header category; The third header field sequence and the fourth header field sequence are merged to obtain the multiple header field sequences.
[0112] In the problem processing device provided in this embodiment, first, the table data corresponding to the problem to be processed is header parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. By converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be processed are input into a large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. Furthermore, prompt information is constructed in combination with the problem to be processed, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be processed are output. In this way, the screening process information and the table data are used to assist in the generation of the answer to the problem to be processed, improve the efficiency of answer generation, and improve the accuracy of the answer generation process information and the answer.
[0113] An embodiment of a computer device provided in this specification is as follows: Corresponding to the problem solving method described above, based on the same technical concept, the embodiment of the present application also provides a first computer device, which is used to execute the problem solving method provided above. Figure 5 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.
[0114] This embodiment provides a computer device, including: like Figure 5 As shown, computer devices can vary significantly depending on their configuration or performance. They may include one or more processors 501 and memory 502. Memory 502 may store one or more applications or data. Memory 502 may be either ephemeral or persistent. Applications stored in memory 502 may include one or more modules (not shown), each of which may include a series of computer-executable instructions within the computer device. Furthermore, processor 501 may be configured to communicate with memory 502 to execute the series of computer-executable instructions within memory 502 on the computer device. The computer device may also include one or more power supplies 503, one or more wired or wireless network interfaces 504, one or more input / output interfaces 505, one or more keyboards 506, and the like.
[0115] In a specific embodiment, a computer device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer-executable instructions in the computer device, and the one or more programs are configured to be executed by one or more processors, including computer-executable instructions for performing the following: Parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences; Inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information; Constructing prompt information based on the problem to be processed, the screening process information and the table data; The prompt information is input into the large language model, and the answer generation process information and the answer to the question to be processed are output.
[0116] In one embodiment, the processor further outputs a first header field sequence after performing sequence screening and extraction during the screening process; After inputting the plurality of header field sequences and the pending questions into the large language model for sequence screening and screening process extraction, and outputting screening process information, the processor further performs the following operations: Classify the first header field sequence to obtain a header category to which the first header field sequence belongs; Extract sub-table data from table data based on table header categories.
[0117] In one embodiment, the processor performs the following steps in the process of constructing prompt information based on the pending question, the screening process information, and the table data: Writing the pending problem, the screening process information, the sub-table data in the table data, and the first header field sequence into a prompt template to obtain the prompt information; The prompt template includes a benchmark question of at least one question type and question-answer prompt information of the benchmark question.
[0118] In one embodiment, the processor performs the following steps in the process of extracting sub-table data from the table data based on the table header category: If the header category includes a first header category and a second header category, determining an extraction position in the table data according to the first header field sequence; The sub-table data corresponding to the extraction position is extracted from the table data.
[0119] In one embodiment, the processor performs the following steps in the process of determining the extraction position in the table data according to the first table header field sequence: Remove header fields whose arrangement positions are after a preset position from the first header field sequence to obtain a second header field sequence; A position corresponding to the second header field sequence is determined in the table data as the extraction position.
[0120] In one embodiment, the processor performs the following steps in the process of extracting sub-table data from the table data based on the table header category: If the header category includes a first header category, determining an extraction position in the table data according to the first header field sequence and a header field sequence of a second header category in the plurality of header field sequences; The sub-table data corresponding to the extraction position is extracted from the table data.
[0121] In one embodiment, the processor performs the following steps in the process of parsing the header of the table data corresponding to the problem to be processed to obtain the header tree structure: Determining a table type corresponding to the table data, and extracting first sub-table data and second sub-table data from the table data according to an extraction method corresponding to the table type; A header tree structure of a first header category is constructed based on the first sub-table data, and a header tree structure of a second header category is constructed based on the second sub-table data.
[0122] In one embodiment, the processor performs the following steps in the process of converting the header tree structure to obtain multiple header field sequences: Extracting a third header field sequence from the header tree structure of the first header category, and extracting a fourth header field sequence from the header tree structure of the second header category; The third header field sequence and the fourth header field sequence are merged to obtain the multiple header field sequences.
[0123] In the computer device provided in this embodiment, first, the table data corresponding to the problem to be processed is header parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. In this way, by converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be processed are input into a large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. Furthermore, prompt information is constructed in combination with the problem to be processed, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be processed are output. In this way, the screening process information and the table data are used to assist in the generation of the answer to the problem to be processed, improve the efficiency of answer generation, and improve the accuracy of the answer generation process information and the answer.
[0124] An embodiment of a computer-readable storage medium provided in this specification is as follows: Corresponding to the problem solving method described above, based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium.
[0125] The computer-readable storage medium provided in this embodiment is used to store computer-executable instructions. When the computer-executable instructions are executed by a processor, the following process is implemented: Parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences; Inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information; Constructing prompt information based on the problem to be processed, the screening process information and the table data; The prompt information is input into the large language model, and the answer generation process information and the answer to the question to be processed are output.
[0126] In the computer-readable storage medium provided in this embodiment, first, the table data corresponding to the problem to be processed is header parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. In this way, by converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be processed are input into a large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. Furthermore, prompt information is constructed in combination with the problem to be processed, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be processed are output. In this way, the screening process information and the table data are used to assist in the generation of the answer to the problem to be processed, improve the efficiency of answer generation, and improve the accuracy of the answer generation process information and the answer.
[0127] It should be noted that the embodiment of a computer-readable storage medium in this specification and the embodiment of a problem-solving method in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0128] An embodiment of a computer program product provided in this specification is as follows: Corresponding to the problem solving method described above, based on the same technical concept, an embodiment of the present application also provides a computer program product.
[0129] The computer program product provided in this embodiment includes a computer program. When the computer program is executed by a processor, the following process is implemented: Parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences; Inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information; Constructing prompt information based on the problem to be processed, the screening process information and the table data; The prompt information is input into the large language model, and the answer generation process information and the answer to the question to be processed are output.
[0130] In the computer program product provided in this embodiment, first, the table data corresponding to the problem to be processed is header parsed to obtain a header tree structure, and the header tree structure is converted into multiple header field sequences. In this way, by converting the table data into a header field sequence, the complex data structure is converted into a simple data structure, thereby reducing the subsequent data calculation cost. On this basis, the multiple header field sequences and the problem to be processed are input into a large language model, and the sequence screening and screening process extraction are performed through the large language model, and the screening process information is output. Furthermore, prompt information is constructed in combination with the problem to be processed, the screening process information and the table data, and the prompt information is input into the large language model, and the answer generation process information and the answer to the problem to be processed are output. In this way, the screening process information and the table data are used to assist in the generation of the answer to the problem to be processed, improve the efficiency of answer generation, and improve the accuracy of the answer generation process information and the answer.
[0131] It should be noted that the embodiment of a computer program product in this specification and the embodiment of a problem-solving method in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can refer to the implementation of the corresponding method mentioned above, and the repeated parts will not be repeated.
[0132] The foregoing description of this specification describes specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0133] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the embodiments of the present application may take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware. Furthermore, this specification may take the form of a computer program product implemented on one or more computer-readable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0134] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable test equipment to produce a machine, so that the instructions executed by the processor of the computer or other programmable test equipment generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0135] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable test equipment to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device that implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0136] These computer program instructions may also be loaded onto a computer or other programmable test device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide for implementing the process described in the flow. Figure 1 a process or multiple processes and / or boxes Figure 1 The steps for the function specified in one or more boxes.
[0137] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0138] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0139] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology for information storage. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.
[0140] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus that includes a series of elements includes not only those elements but also other elements not explicitly listed, or includes elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprises a ..." does not exclude the presence of other identical elements in the process, method, commodity, or apparatus that includes the element.
[0141] The embodiments of the present application may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0142] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.
[0143] The foregoing description is merely an example of the present invention and is not intended to limit the present invention. Persons skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be included within the scope of the claims herein.
Claims
1. A problem solving method, characterized in that: The method comprises: Parsing the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and converting the header tree structure to obtain multiple header field sequences; Inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information; Constructing prompt information based on the problem to be processed, the screening process information and the table data; The prompt information is input into the large language model, and the answer generation process information and the answer to the question to be processed are output.
2. The method according to claim 1, characterized in that After performing the sequence screening and the screening process extraction, the large language model further outputs a first header field sequence; After the step of inputting the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and outputting screening process information is executed, the method further includes: Classify the first header field sequence to obtain a header category to which the first header field sequence belongs; Sub-table data is extracted from the table data based on the table header category.
3. The method according to claim 2, characterized in that The constructing of prompt information based on the problem to be processed, the screening process information and the table data includes: Writing the pending problem, the screening process information, the sub-table data in the table data, and the first header field sequence into a prompt template to obtain the prompt information; The prompt template includes a benchmark question of at least one question type and question-answer prompt information of the benchmark question.
4. The method according to claim 2, characterized in that The extracting sub-table data from the table data based on the table header category includes: If the header category includes a first header category and a second header category, determining an extraction position in the table data according to the first header field sequence; The sub-table data corresponding to the extraction position is extracted from the table data.
5. The method according to claim 4, characterized in that The determining the extraction position in the table data according to the first table header field sequence includes: Remove header fields whose arrangement positions are after a preset position from the first header field sequence to obtain a second header field sequence; A position corresponding to the second header field sequence is determined in the table data as the extraction position.
6. The method according to claim 2, characterized in that The extracting sub-table data from the table data based on the table header category includes: If the header category includes a first header category, determining an extraction position in the table data according to the first header field sequence and a header field sequence of a second header category in the plurality of header field sequences; The sub-table data corresponding to the extraction position is extracted from the table data.
7. The method according to claim 1, characterized in that The header tree structure is obtained by parsing the table data corresponding to the problem to be processed, including: Determining a table type corresponding to the table data, and extracting first sub-table data and second sub-table data from the table data according to an extraction method corresponding to the table type; A header tree structure of a first header category is constructed based on the first sub-table data, and a header tree structure of a second header category is constructed based on the second sub-table data.
8. The method according to claim 7, characterized in that The converting process of the header tree structure to obtain multiple header field sequences includes: Extracting a third header field sequence from the header tree structure of the first header category, and extracting a fourth header field sequence from the header tree structure of the second header category; The third header field sequence and the fourth header field sequence are merged to obtain the multiple header field sequences.
9. A problem handling device, characterized in that: The device comprises: A header parsing module is used to parse the header of the table data corresponding to the problem to be processed to obtain a header tree structure, and convert the header tree structure to obtain multiple header field sequences; a sequence screening module, configured to input the plurality of header field sequences and the pending questions into a large language model for sequence screening and screening process extraction, and output screening process information; An information construction module, configured to construct prompt information based on the problem to be processed, the screening process information and the table data; The information input module is used to input the prompt information into the large language model and output the answer generation process information and the answer to the question to be processed.
10. A computer device, characterized in that: The device comprises: A processor; and a memory configured to store computer-executable instructions, which, when executed, cause the processor to perform the problem-solving method according to any one of claims 1 to 8.