Automatic report filling method based on large language model

CN119578383AActive Publication Date: 2025-03-07SHANDONG JIANZHU UNIV +2
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411653497.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-03-07
Estimated Expiration
2044-11-19
Patent Text Reader

Abstract

The invention discloses an automatic report filling method based on a large language model. The automatic report filling method comprises a report cell information analysis step, a report structure type judgment step and a search and automatic report filling step based on the large language model. Analyzing all cells in the report to form a cell structured information table E, E = {Mesi [(xi, yi), di, bi, messagei], and i is greater than or equal to 0 and less than z-1}; dividing the report into a unit type structure, a vector type structure and a matrix type structure; and searching answers of the question cells according to the core cue words of the large language model. According to the automatic report filling method based on the large language model, whether the report or the current area belongs to a unit type structure, a vector type structure or a matrix type structure is recognized, the core cue word is searched and constructed for the large language model, the method can be used for report filling of large data, the wide application value is achieved, manpower and material resources are saved, and the method is suitable for popularization and application. And remarkable economic benefits can be brought to enterprises.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for automatically filling in a report, and more specifically, to a method for automatically filling in a report based on a large language model. Background Art

[0002] A table, also known as a table, is both a visual communication mode and a means of organizing and collating data. People use a wide variety of tables in communication, scientific research, and data analysis. Tables often appear in printed media, handwritten records, computer software, architectural decorations, traffic signs, and many other places. The conventions and terms used to describe the exact table vary depending on the context. In addition, different tables vary in type, structure, flexibility, notation, expression, and use. In various books and technical articles, tables are usually placed in floating areas with numbers and titles to distinguish them from the main body of the article.

[0003] Tables are used in various software, including table application software and table controls, such as Office Word, Excel, WPS, etc. They are one of the most commonly used data processing methods, mainly used for input, output, display, processing and printing data, and can create various complex table documents, and even help users perform complex statistical calculations and graphical displays, etc. Table controls can also be commonly used for data presentation and editing in databases, data entry interface design, data exchange, data reporting and distribution, etc.

[0004] In today's life, there are two types of tables that are often used. One is relational database tables, which use a two-dimensional table structure to logically express and implement data, strictly follow the data format and length specifications, and store structured data internally. The other type is various reports that are often used in daily business offices. The table structure does not have strict logical expression specifications and stores unstructured data internally. These two types of tables have very mature applications in all walks of life. For example, banks, public security agencies, various enterprises, and even transportation and commodity trading all have a large number of scenarios where reports need to be filled out.

[0005] However, as reports become more and more common, especially as the structure of reports becomes more and more complex, filling out complex reports becomes more and more troublesome, consuming a lot of people's time and energy, reducing work efficiency, and in disguise reducing the use scenarios of reports, limiting the full application of the advantages of reports in real life.

[0006] At present, with the development of artificial intelligence technology, computer artificial intelligence can quickly and accurately fill in manually written materials, such as resumes, into corresponding reports in different categories. If the above technology can be used maturely when filling in reports, it will definitely greatly simplify the complex report filling work and liberate people's creativity for other more needed methods. In the prior art, there is no mature method for automatic report filling. Summary of the invention

[0007] In order to overcome the disadvantages of the above technical problems, the present invention provides a method for automatically filling in a report based on a large language model.

[0008] The method for automatically filling in a report based on a large language model of the present invention comprises a step of parsing cell information in the report, a step of distinguishing the structure type of the report, and a step of searching and automatically filling in the report based on the large language model; the step of parsing cell information in the report comprises: parsing all cells in the report in a top-down and left-to-right order, obtaining the position information, size information and content information of each cell, and forming a cell structured information table E, where E={Mes i [(x i ,y i ),d i ,b i ,message i ],0≤i<z-1},(x i ,y i ) represents the starting position coordinates of cell i, d i and b i Respectively represent the row span and column span of cell i, message i Indicates the text information stored in cell i; when cell i is a problem cell, message i = the text stored in cell i. When cell i is the answer cell, message i =NULL, z is the total number of cells;

[0009] The steps for determining the report structure type are as follows: according to the starting position coordinates, row span, column span of each cell in the report, and whether it belongs to a question cell or an answer cell, the matrix upper and lower structures are determined from all report cells and extracted, and then in the remaining report cells, according to the order of matrix left and right structures, vector upper and lower structures, vector left and right structures, matrix basic structures, unit upper and lower structures, and unit left and right structures, the above determination and extraction steps are repeated in rounds to divide the report into unit structures, vector structures, and matrix structures; the steps for searching and automatically filling in the form based on the large language model are as follows: first, according to the structure type of the report to which the question cell belongs and the text stored, the core prompt words of the large language model are generated, and then the answer to the question cell is searched according to the core prompt words of the large language model, and finally filled in the answer cell corresponding to the question cell to realize automatic filling in of the report.

[0010] In the method for automatically filling in a report based on a large language model of the present invention, the report structure type identification step is implemented by the following steps:

[0011] a). Get the report column span; according to x in the report i =0 is the report column span B. max ;

[0012] b). Determine and extract the matrix structure; from E, determine that "the current cell is the problem cell and the column span of the current cell is equal to B according to i from small to large. max , all cells in the next row of the current cell are problem cells" is true. If true, it means that the report or the current area is a matrix-type up-down structure, then the text message in the current problem cell is set to message. i is a first-level question, and the text information in each question cell in the next row of the current cell is set as a second-level question, and the report or current area information is extracted from E; if it is not true, the judgment is continued on the next cell information until all the cell information in E is traversed;

[0013] c). Determine and extract the matrix left-right structure; from the remaining cells in E, determine whether "the current cell is a problem cell, the row span of the current cell is ≥ 2, and the cells in the first row to the right of the current cell are all problem cells" is true according to i from small to large. If true, it indicates that the report or the current area is a matrix left-right structure, then let the text message in the current cell be message i is a first-level question, let the text information in each question cell to the right of the current cell be a second-level question, and extract the report or current area information from E; if it is not true, continue to judge the next cell information until all the cell information in E is traversed;

[0014] d). Determine and extract the vector-type up-down structure; from the remaining cells in E, determine "the column span of the current cell is equal to B" according to i from small to large max And there is a column below the current cell with a span smaller than B max Is the problem cell "true? If true, it indicates that the report or the current area is a vector-type up-down structure, then the text message in the current cell is set to i is a first-level question, let the text information in each question cell below the current cell be a second-level question, and extract the report or current area information from E; if it is not true, continue to judge the next cell information until all the cell information in E is traversed;

[0015] e). Determine and extract the vector left and right structure; from the remaining cells in E, determine whether "the row span of the current cell is greater than or equal to 2" is true according to i from small to large. If true, it indicates that the report or the current area is a vector left and right structure, then let the text message in the current cell be message i For a first-level problem, let the text information in each problem cell to the right of the current cell be the text information message in the current cell. i The problem level is increased by 1, and the report or current area information is extracted from E; if it is not true, the judgment is continued on the next cell information until all the cell information in E is traversed;

[0016] f). Determine and extract the matrix type basic structure; from the remaining cells in E, determine row by row according to i in ascending order whether "the cells in the current row are all question cells, and the cells in the next row are all answer cells" is true. If true, it indicates that the report or the current area is a matrix type basic structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all the cell information in E is traversed;

[0017] g). Determine and extract the unit type up-down structure; from the remaining cells in E, determine whether "the current cell is the question cell, the next cell is the answer cell, and the column spans of both are equal to the report column span" is true according to i from small to large. If true, it indicates that the report or the current area is a unit type up-down structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all the cell information in E is traversed;

[0018] h). Determine and extract the cell type left-right structure; determine from the remaining cells in E whether "the current cell is the question cell, the next cell is the answer cell, and the row spans of the two are equal" is true according to i from small to large. If true, it indicates that the report or the current area is a cell type left-right structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all cell information in E is traversed;

[0019] i). If there is remaining cell information in E, it means that the current report structure type identification method cannot identify the type of the report or the current area, and manual identification is required to end the report structure type identification.

[0020] In the method for automatically filling in a report based on a large language model of the present invention, the determination of whether it is a matrix-type upper and lower structure in step b) is specifically implemented by the following method:

[0021] b-1). Assume that the report or current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)};Cell n The position coordinates are (x n ,y n ), the column span is b n The initial level p of all problem cells n are all set to 1, that is, p n =1; execute step b-2);

[0022] b-2). Let n = 1; execute step b-3);

[0023] b-3). Determine the cell n The column span b n =B max Is it true? If not, go to step b-5); if true, go to step f) to determine the Cell n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of the subsequent cells is a matrix-type upper and lower structure; execute step b-4);

[0024] b-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step b-5);

[0025] b-5). Let n = n + 1; execute step b-6);

[0026] b-6). Determine whether n=(N+M). If so, the structure type determination of the report or current area is completed. If not, jump to step b-3).

[0027] In the method for automatically filling in a report based on a large language model of the present invention, the determination of whether it is a matrix left-right structure in step c) is specifically implemented by the following method:

[0028] c-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)};Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1; execute step c-2);

[0029] c-2). Set n = 1; execute step c-3);

[0030] c-3). Determine the problem cell n The row span d n =1, if it is true, execute step c-5); if not, it means that the cell n The row span is d n ≥2, then follow step f) to determine the Cell n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of the subsequent cells is a matrix left-right structure; execute step c-4);

[0031] c-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step c-5);

[0032] c-5). Let n = n + 1; execute step c-6);

[0033] c-6). Determine whether n=(N+M). If so, the structure type determination of the report or current area is completed. If not, jump to step c-3).

[0034] In the method for automatically filling in a report based on a large language model of the present invention, the determination of whether it is a vector type upper and lower structure in step d) is specifically implemented by the following method:

[0035] d-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)}, Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1;

[0036] d-2). Let n = 1;

[0037] d-3). Determine the cell n The column span b n =B max Is it true? If not, go to step d-5); if it is true, select Cell from set C. n Start searching cells sequentially to the next column span b n =B max Cell m So far, all the problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell on its right is a vector-type up-down structure, and step d-4) is executed;

[0038] d-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade";

[0039] d-5). Let n = n + 1;

[0040] d-6). Determine whether n=N+M is established. If so, the type determination of the report or the current area is completed. If not, execute step d-3).

[0041] In the method for automatically filling in a report based on a large language model of the present invention, the determination of whether it is a vector type left-right structure in step e) is specifically implemented by the following method:

[0042] e-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort the question cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)}, Problem Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1;

[0043] e-2). Let n = 1;

[0044] e-3). Determine the problem cell n The row span d n =1, if it is true, execute step e-5); if it is not true, it indicates that the problem cell n The row span is d n ≥2, then in set C, from Cell n Start searching sequentially for the cell row coordinate at x n to x n +d n -1 All problem cells in the range, with the last cell being Cell m , find all the problem cells i , n≤i<m, the report or current area formed by the answer cell on its right is a vector left-right structure, execute step e-4);

[0045] e-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade";

[0046] e-5). Let n = n + 1;

[0047] e-6). Determine whether n=N+M is established. If so, the type determination of the report or the current area is completed. If not, execute step e-3).

[0048] The method for automatically filling reports relying on large language models according to the present invention, the determination of whether it is a matrix - type basic structure in step f) is specifically implemented by the following method:

[0049] f - 1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in ascending order of cell row coordinates and in ascending order of column coordinates of cells in the same row, and form a set C = {Cell1, Cell2, …, Cell n , …, Cell (N+M)} according to the sorting. The position coordinates of cell Cell n are (x n , y n ), the row span is d n , and the column span is b n . Let the initial value of n be 1; execute step f - 2);

[0050] f - 2). Take out all cells with cell row coordinate x n =(n - 1) from set C. If all the taken - out cells are question cells, assume the starting row j of the matrix - type structure report or the current area is n - 1; execute step f - 3);

[0051] f - 3). Let n=n + 1; execute step f - 4);

[0052] f - 4). Take out all cells with cell row coordinate x n =(n - 1) from set C. If they are all answer cells, jump to step f - 3); if they are not all answer cells, the report or the current area composed of cells in set C with row coordinates satisfying j≤x n <n - 1 is a matrix - type basic structure, execute step f - 5);

[0053] f - 5). Judge whether n = N + M holds. If it holds, the judgment of the structure type of the report or the current area ends. If it does not hold, then jump to step f - 2).

[0054] The beneficial effects of the present invention are as follows: the method for automatically filling in a report based on a large language model of the present invention includes a step of parsing cell information in the report, a step of distinguishing the structure type of the report, and a step of searching and automatically filling in the report based on the large language model. In the step of parsing the cell information, the starting position coordinates, row and column spans, and text information of each cell in the report are identified, and a cell structured information table E is formed. In the step of distinguishing the structure type of the report, it is identified whether the report or the current area (sub-report) belongs to a unit structure, a vector structure, or a matrix structure, so as to construct core prompt words for the large language model search of the problem in the problem cell, so as to accurately search for the answer to the standard problem cell, so as to automatically fill it in the answer cell; it can be used for filling in batch text-structured reports of big data, has a wide range of applicable value, saves manpower and material resources, and can bring significant economic benefits to enterprises. DETAILED DESCRIPTION

[0055] The present invention will be further described below in conjunction with the embodiments.

[0056] The method for automatically filling in a report based on a large language model of the present invention includes a step of parsing cell information in the report, a step of distinguishing the structure type of the report, and a step of searching and automatically filling in the report based on the large language model. For a report or a current area (i.e., a subreport), all cells in the report are parsed in a top-down and left-to-right order to obtain the position information, size information, and content information of each cell, and form a cell structured information table E, where E={Mes i [(x i ,y i ),d i ,b i ,message i ],0≤i<z-1},,(x i ,y i ) represents the starting position coordinates of cell i, d i and b i Respectively represent the row span and column span of cell i, message i Indicates the text information stored in cell i; when cell i is a problem cell, message i = the text stored in cell i. When cell i is the answer cell, message i =NULL, z is the total number of cells in the table.

[0057] As shown in Table 1, a sample report with 27 cells is given:

[0058] Table 1

[0059]

[0060] Take cell 1 in table 1 as an example. The starting coordinate position of the cell is (0,0) and the ending coordinate position is (0,3). It is a merged cell with a row span of 1 and a column span of 4. Therefore, the structured information of cell 1 is Mes1[(0,0),1,4,example information]. Maximum column span B of report 1 max is 4.

[0061] The report structure type identification step in the present invention is implemented by the following steps:

[0062] a). Get the report column span; according to x in the report i =0 is the report column span B. max ;

[0063] b). Determine and extract the matrix structure; from E, determine that "the current cell is the problem cell and the column span of the current cell is equal to B according to i from small to large. max , all cells in the next row of the current cell are problem cells" is true. If true, it means that the report or the current area is a matrix-type up-down structure, then the text message in the current problem cell is set to message. i is a first-level question, and the text information in each question cell in the next row of the current cell is set as a second-level question, and the report or current area information is extracted from E; if it is not true, the judgment is continued on the next cell information until all the cell information in E is traversed;

[0064] For a report or current area with a matrix-type up-down structure, it consists of a matrix-type basic structure and a single adjacent problem cell on the upper side. The column span of the problem cell on the upper side is equal to the column span of the matrix-type basic structure. It is defined that the level of the problem cell on the upper side is higher than the level of the problem cell in the matrix-type basic structure. As shown in Table 2, a report with a matrix-type up-down structure is given:

[0065] Table 2

[0066]

[0067] As shown in Table 3, an example of a report with a matrix structure is given:

[0068] Table 3

[0069]

[0070] It can be seen that in Table 2 and Table 3, the first cell is a problem cell, and its column span is 4, which is equal to the maximum column span of the report. Below the first cell is a matrix-type basic structure. The problem of the first cell is level one, and the problems of the remaining problem cells are level two.

[0071] c). Determine and extract the matrix left-right structure; from the remaining cells in E, determine whether "the current cell is a problem cell, the row span of the current cell is ≥ 2, and the cells in the first row to the right of the current cell are all problem cells" is true according to i from small to large. If true, it indicates that the report or the current area is a matrix left-right structure, then let the text message in the current cell be message i is a first-level question, let the text information in each question cell to the right of the current cell be a second-level question, and extract the report or current area information from E; if it is not true, continue to judge the next cell information until all the cell information in E is traversed;

[0072] For a report or current area with a matrix left-right structure, it consists of a matrix basic structure and adjacent problem cells on the left. The row span of the problem cells on the left is equal to the row span of the matrix basic structure. It is defined that the level of the problem cells on the left is higher than the level of the problem cells in the matrix basic structure. As shown in Table 4, a report with a matrix left-right structure is given:

[0073] Table 4

[0074]

[0075] As shown in Table 5, an example of a report with a matrix left-right structure is given:

[0076] Table 5

[0077]

[0078] It can be seen that in Report 4 and Report 5, the first cell is a problem cell, and the row span is 3. The right side of the first cell is a matrix-type basic structure. The problem of the first cell is level one, and the problems of the remaining problem cells are level two.

[0079] d). Determine and extract the vector-type up-down structure; from the remaining cells in E, determine "the column span of the current cell is equal to B" according to i from small to large max And there is a column below the current cell with a span smaller than B max Is the problem cell "true? If true, it indicates that the report or the current area is a vector-type up-down structure, then the text message in the current cell is set to i is a first-level question, let the text information in each question cell below the current cell be a second-level question, and extract the report or current area information from E; if it is not true, continue to judge the next cell information until all the cell information in E is traversed;

[0080] For a report or current area with a vector-type up-and-down structure, multiple question cells form a two-level (or multi-level) up-and-down nested relationship. When the column span of the upper question cell is equal to the maximum column span of the report, and the column span of the lower cell is less than the maximum column span of the report, the upper question cell level is defined as higher than the lower question cell level, and the question cell and the adjacent answer cell on the right are a unit-type left-right structure. As shown in Table 6, a report with a vector-type up-and-down structure is given:

[0081] Table 6

[0082]

[0083] As shown in Table 7, a report example with a vector-type up-down structure is given:

[0084] Table 7

[0085]

[0086] It can be seen that the maximum column span of report 7 is 4, the first cell is a question cell, and its column span is 4. The problem in the first cell is level one, and the problems in the remaining question cells are level two.

[0087] e). Determine and extract the vector left and right structure; from the remaining cells in E, determine whether "the row span of the current cell is greater than or equal to 2" is true according to i from small to large. If true, it indicates that the report or the current area is a vector left and right structure, then let the text message in the current cell be message i For a first-level problem, let the text information in each problem cell to the right of the current cell be the text information message in the current cell. i The question level is increased by 1, and the report or current area information is extracted from E; if it is not true, the judgment is continued for the next cell information until all the cell information in E is traversed; for the report or current area with a vector left-right structure, multiple question cells form a multi-level left-right nested relationship, and the row span of the left question cell is greater than the row span of the right question cell, then the left question cell level is defined as higher than the right question cell level, and the question cell and the adjacent answer cell on the right are a unit-type left-right structure. As shown in Table 8, a report with a vector top-bottom structure is given:

[0088] Table 8

[0089]

[0090] As shown in Table 9, a report example with a vector-type up-down structure is given:

[0091] Table 9

[0092]

[0093] In Tables 8 and 9, the first, second, and fourth cells are all question cells, and the third and fifth cells are all answer cells. The question in the first question cell is level one, and the questions in the second and fourth cells are level two.

[0094] f). Determine and extract the matrix type basic structure; from the remaining cells in E, determine row by row according to i in ascending order whether "the cells in the current row are all question cells, and the cells in the next row are all answer cells" is true. If true, it indicates that the report or the current area is a matrix type basic structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all the cell information in E is traversed;

[0095] For a report or current area with a matrix basic structure, the question cells and answer cells are distributed in a matrix, the matrix column span and row span are both greater than or equal to two, the first row of cells are all question cells, and the remaining cells are all answer cells. Table 10 shows a report with a matrix basic structure:

[0096] Table 10

[0097] Question 1 Question 2 Question 3 Question 4 Question 5

[0098] Table 11 shows an example of a report with a matrix basic structure:

[0099] Table 11

[0100] Education Bachelor of Science Graduate School Major Research Direction

[0101] It can be seen that in Report 10 and Report 11, the five cells in the first row are all question cells, and the five cells in the second row, the third row, and the fourth row are all answer cells.

[0102] g). Determine and extract the unit type up-down structure; from the remaining cells in E, determine whether "the current cell is the question cell, the next cell is the answer cell, and the column spans of both are equal to the report column span" is true according to i from small to large. If true, it indicates that the report or the current area is a unit type up-down structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all the cell information in E is traversed;

[0103] For a report or current area with a unit-type up-and-down structure, the question cell and the answer cell are adjacent to each other and have the same column span. As shown in Table 12, a report with a unit-type up-and-down structure is given:

[0104] Table 12

[0105]

[0106]

[0107] Table 13 gives a specific example report:

[0108] Table 13

[0109] Personal Profile

[0110] It can be seen that in Table 12 and Table 13, the first cell is the question cell, the second cell is the answer cell, and the row span and column span of the first and second cells are both 1.

[0111] h). Determine and extract the cell type left-right structure; determine from the remaining cells in E whether "the current cell is the question cell, the next cell is the answer cell, and the row spans of the two are equal" is true according to i from small to large. If true, it indicates that the report or the current area is a cell type left-right structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all cell information in E is traversed;

[0112] For a report or current area with a unit-type left-right structure, the question cell and the answer cell are adjacent to each other and have the same row span. As shown in Table 14, a report with a unit-type left-right structure is given:

[0113] Table 14

[0114] question

[0115] Table 5 gives a specific example report:

[0116] Table 15

[0117] Name

[0118] It can be seen that in Table 14 and Table 15, the first cell is the question cell, the second cell is the answer cell, and the row span and column span of the first and second cells are both 1.

[0119] i). If there is remaining cell information in E, it means that the current report structure type identification method cannot identify the type of the report or the current area, and manual identification is required to end the report structure type identification.

[0120] in:

[0121] The determination of whether it is a matrix type upper and lower structure in step b) is specifically implemented by the following method:

[0122] b-1). Assume that the report or current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)};Cell n The position coordinates are (x n ,y n ), the column span is b n The initial level p of all problem cells n are all set to 1, that is, p n =1; execute step b-2);

[0123] b-2). Let n = 1; execute step b-3);

[0124] b-3). Determine the cell n The column span b n =B max Is it true? If not, go to step b-5); if it is true, go to step f) to determine the Cell n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of the subsequent cells is a matrix-type upper and lower structure; execute step b-4);

[0125] b-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step b-5);

[0126] b-5). Let n = n + 1; execute step b-6);

[0127] b-6). Determine whether n=(N+M). If so, the structure type determination of the report or current area is completed. If not, jump to step b-3).

[0128] The principle of judging whether it is a matrix top-bottom structure is as follows: traverse the report in the order of cell row coordinates from small to large and column coordinates from small to large to find the problem cell whose column span is equal to the report column span, and record the Cell n , the coordinates are (x n ,yn ); Continue to search for the problem cell whose column span is equal to the report column span or to the end cell of the report, and record the cell as Cell j , the coordinates are (x j ,y j ); Set the report to satisfy the horizontal axis greater than or equal to x n , and is less than or equal to x j All cells with -1 are recorded as Area n, If Area n Internal Cell n The cells outside the area satisfy the basic matrix structure, then Area n It is a matrix type up and down structure; Area n Internal Cell n The problem level of the problem cells outside the question box is increased by 1.

[0129] The determination of whether it is a matrix left-right structure in step c) is specifically implemented by the following method:

[0130] c-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)};Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1; execute step c-2);

[0131] c-2). Set n = 1; execute step c-3);

[0132] c-3). Determine the problem cell n The row span d n =1, if it is true, execute step c-5); if not, it means that the cell n The row span is d n ≥2, then follow step f) to determine the Cell n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of the subsequent cells is a matrix left-right structure; execute step c-4);

[0133] c-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step c-5);

[0134] c-5). Let n = n + 1; execute step c-6);

[0135] c-6). Determine whether n=(N+M). If so, the structure type determination of the report or current area is completed. If not, jump to step c-3).

[0136] The principle of judging the left and right structure of the matrix type is: traverse the report in the order of cell row coordinates from small to large and column coordinates from small to large to find the problematic cell with a row span greater than or equal to two, and record the cell as Cell n , the row span is d n , the coordinates are (x n ,y n ); Set the report to satisfy the horizontal axis greater than or equal to x n , and is less than or equal to x n +d n All cells with -1 are recorded as Area n, If Area n Internal Cell n The cells outside are matrix-type basic structures, then Area n It is a matrix left and right structure; Area n Internal Cell n The problem level of the problem cells outside the question box is increased by 1.

[0137] The determination of whether it is a vector type up-down structure in step d) is specifically implemented by the following method:

[0138] d-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)}, Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1;

[0139] d-2). Let n = 1;

[0140] d-3). Determine the cell n The column span b n =B max Is it true? If not, go to step d-5); if it is true, select Cell from set C. n Start searching cells sequentially to the next column span b n =B max Cell m So far, all the problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell on its right is a vector-type up-down structure, and step d-4) is executed;

[0141] d-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade";

[0142] d-5). Let n = n + 1;

[0143] d-6). Determine whether n=N+M is established. If so, the type determination of the report or the current area is completed. If not, execute step d-3).

[0144] The principle of judging the vector type up-down structure is: traverse the report in the order of cell row coordinates from small to large and column coordinates from small to large to find the problem cell whose column span is equal to the report column span, and record the cell as Cell n , the coordinates are (x n ,y n ); Sequentially search for the next problematic cell whose column span is equal to the report column span, and record the cell as Cell j , the coordinates are (x j ,y j ); Set the cells in the report that satisfy the horizontal coordinate greater than or equal to x n and less than or equal to x j All cells with -1 are recorded as Area n ; If Area n Internal Cell n The cells outside are unit structures, then Area n It is a vector type up-down structure; Area n The problem level p of the problem cell whose inner column span is smaller than the report column span is increased by 1.

[0145] The determination of whether it is a vector type left-right structure in step e) is specifically implemented by the following method:

[0146] e-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort the question cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M)}, Problem Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1;

[0147] e-2). Let n = 1;

[0148] e-3). Determine the problem cell n The row span d n =1, if it is true, execute step e-5); if it is not true, it indicates that the problem cell n The row span is d n ≥2, then in set C, from Cell n Start searching sequentially for the cell row coordinate at x n to x n +d n -1 All problem cells in the range, with the last cell being Cell m , find all the problem cells i , n≤i<m, the report or current area formed by the answer cell on its right is a vector left-right structure, execute step e-4);

[0149] e-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade";

[0150] e-5). Let n = n + 1;

[0151] e-6). Determine whether n=N+M is established. If so, the type determination of the report or the current area is completed. If not, execute step e-3).

[0152] The principle of judging whether it is a vector type left-right structure is as follows: from the report, traverse the cell row coordinates from small to large and the column coordinates from small to large to find the problem cell with a row span greater than or equal to two. If a problem cell that meets the conditions is found, it will be recorded as Cell n , let the row span be dn , with coordinates (x n , y n ); all cells in the report that satisfy both the row coordinate being greater than or equal to x n and less than or equal to x n + d n - 1, and the column coordinate being greater than or equal to y n are denoted as Area n ; if the cells in Area n other than Cell n are of cell type structure and there are problem cells with a row span less than d n , then Area n is of vector - type left - right structure; increase the current problem level of the problem cells in Area n with a row span less than d n by 1.

[0153] The judgment of whether it is a matrix - type basic structure described in step f) is specifically implemented by the following method:

[0154] f - 1). Assume that the remaining report or the current area contains N problem cells and M answer cells. Sort all cells in ascending order of cell row coordinates and, for cells in the same row, in ascending order of column coordinates, and form a set C = {Cell1, Cell2, …, Cell n , …, Cell (N+M)} according to the sorting. The position coordinates of cell Cell n are (x n , y n ), the row span is d n , and the column span is b n . Let the initial value of n be 1; execute step f - 2);

[0155] f - 2). Take out all cells with cell row coordinate x n = (n - 1) from set C. If all the cells taken out are problem cells, assume the starting row j of the matrix - type structure report or the current area is n - 1; execute step f - 3);

[0156] f - 3). Let n = n + 1; execute step f - 4);

[0157] f - 4). Take out all cells with cell row coordinate x n = (n - 1) from set C. If they are all answer cells, jump to step f - 3); if they are not all answer cells, the report or the current area composed of cells in set C with row coordinates satisfying j ≤ x n < n - 1 is a matrix - type basic structure, and execute step f - 5);

[0158] f-5). Determine whether n=N+M is true. If so, the structure type determination of the report or the current area is completed. If not, jump to step f-2).

[0159] The judgment principle of the basic structure of the matrix type is: from the report, traverse each row of cells in the order of cell row coordinates from small to large and column coordinates from small to large. If all cells in a row are problem cells, then record the horizontal coordinate of this row of cells as x. n ; If the horizontal axis is x n+1 If all cells are answer cells, the next row of cells will be searched sequentially until a problem cell or the end cell of the report is detected, and the horizontal coordinate of the problem cell is recorded as x. j ; Set the report so that the horizontal axis is greater than or equal to x n and less than or equal to x j All cells with -1 are recorded as Area n , Area n It is a matrix basic structure.

[0160] In the search and automatic form filling steps based on the large language model:

[0161] (1) For the reports of the unit structure shown in Tables 12 to 15, the construction method of the answer cell corresponding to the question content is: the content of the corresponding question cell. For the cells shown in Table 15, the answer cell large language model question prompt word is: find the content of the name in the given text.

[0162] (2) The vector structure contains multiple sets of question-answer pairs. The answer cell corresponds to the question content constructed by the combination of the contents of all question cells from the highest-level question cell to the adjacent-level question cell. As shown in the report in Table 7, Question 1 of the first three questions is: Find the unit name in the unit details in the given text. Question 2 is: Find the registered capital in the unit details in the given text. Question 3 is: Find the organization code in the unit details in the given text. As shown in the table in Table 9, Question 1 is: Find the mobile phone number in the contact information in the given text. Question 2 is: Find the office phone number in the contact information in the given text.

[0163] (3) The matrix structure contains multiple sets of question-answer pairs. Due to its special structure, there is no one-to-one or one-to-many correspondence between answer cells and question cells. It is necessary to construct the questions specially before asking them, so that the large language model can output structured answers, and then the structured answer information is disassembled and filled into the corresponding answer cells. The construction method of all answer cell question content: the combination of the first-level question cell content and all the second-level cell contents connected in a fixed delimiter sequence. The answer content is sequentially split by fixed delimiters, and the split content is matched one-to-one with the answer cells in a left-to-right and top-to-bottom order.

[0164] As shown in Table 16, a matrix-type left-right structure report is given:

[0165] Table 16

[0166]

[0167] Large language model question prompt: Find family member information in the given text and return all information in the form of "name#relationship#age#political status#work unit and position".

[0168] Example of a large language model reply: Zhang San # father # 45 # party member # teacher

[0169] Li Si#mother#43#masses#civil servant

[0170] The answer content is split sequentially using the fixed separator "#", and the split content is matched one by one with the answer cells in order from left to right and from top to bottom.

[0171] Answer cell 1: Zhang San

[0172] Answer cell 2: Father

[0173] Answer cell 3: 45

[0174] Answer cell 4: Party member

[0175] Answer Cell 5: Teacher

[0176] Answer cell 6: Li Si

[0177] Answer cell 7: Mother

[0178] Answer cell 8:43

[0179] Answer cell 9: Masses

[0180] Answer Cell 10: Civil servants.

Claims

1. A method for automatically filling in a report based on a large language model, comprising a step of parsing cell information in a report, a step of distinguishing the report structure type, and a step of searching and automatically filling in a report based on a large language model; characterized in that: The steps of parsing the cell information in the report are as follows: parse all cells in the report from top to bottom and from left to right, obtain the position information, size information and content information of each cell, and form a cell structured information table E, E={Mes i [(x i ,y i ),d i ,b i ,message i ],0≤i<z-1},(x i ,y i ) represents the starting position coordinates of cell i, d i and b i Respectively represent the row span and column span of cell i, message i Represents the text information stored in cell i; When cell i is a problem cell, message i =The text stored in cell i. When cell i is the answer cell, message i =NULL, z is the total number of cells; The steps for determining the report structure type are as follows: according to the starting position coordinates, row span, column span of each cell in the report, and whether it belongs to a question cell or an answer cell, the matrix upper and lower structures are determined from all report cells and extracted, and then in the remaining report cells, according to the order of matrix left and right structures, vector upper and lower structures, vector left and right structures, matrix basic structures, unit upper and lower structures, and unit left and right structures, the above determination and extraction steps are repeated in rounds to divide the report into unit structures, vector structures, and matrix structures; the steps for searching and automatically filling in the form based on the large language model are as follows: first, according to the structure type of the report to which the question cell belongs and the text stored, the core prompt words of the large language model are generated, and then the answer to the question cell is searched according to the core prompt words of the large language model, and finally filled in the answer cell corresponding to the question cell to realize automatic filling in of the report.

2. The method for automatically filling in a report based on a large language model according to claim 1, characterized in that: The report structure type determination step is implemented through the following steps: a). Get the report column span; according to x in the report i =0 is the report column span B. max ; b). Determine and extract the upper and lower structures of the matrix; from E, determine that "the current cell is the problem cell and the column span of the current cell is equal to B according to the order of i from small to large." max , all cells in the next row of the current cell are problem cells" is true. If true, it means that the report or the current area is a matrix-type up-down structure, then the text message in the current problem cell is set to message. i As a first-level question, the text information in each question cell in the next row of the current cell is set as a second-level question, and the report or current area information is extracted from E; If not, continue to judge the next cell information until all the cell information in E is traversed; c). Determine and extract the matrix left-right structure; from the remaining cells in E, determine whether "the current cell is a problem cell, the row span of the current cell is ≥ 2, and the cells in the first row to the right of the current cell are all problem cells" is true according to i from small to large. If true, it indicates that the report or the current area is a matrix left-right structure, then let the text message in the current cell be message i As a first-level question, the text information in each question cell to the right of the current cell is set as a second-level question, and the report or current area information is extracted from E; If not, continue to judge the next cell information until all the cell information in E is traversed; d). Determine and extract the vector-type upper and lower structures; from the remaining cells in E, determine according to i from small to large that "the column span of the current cell is equal to B max And there is a column below the current cell with a span smaller than B max Is the problem cell "true? If true, it indicates that the report or the current area is a vector-type up-down structure, then the text message in the current cell is set to i As a first-level question, the text information in each question cell below the current cell is set as a second-level question, and the report or current area information is extracted from E; If not, continue to judge the next cell information until all the cell information in E is traversed; e). Determine and extract the vector type left and right structure; from the remaining cells in E, determine whether "the row span of the current cell is greater than or equal to 2" is true according to i from small to large. If true, it indicates that the report or the current area is a vector type left and right structure, then let the text message in the current cell be message i For a first-level problem, let the text information in each problem cell to the right of the current cell be the text information message in the current cell. i The problem level is increased by 1, and the report or current area information is extracted from E; If not, continue to judge the next cell information until all the cell information in E is traversed; f). Determine and extract the matrix basic structure; from the remaining cells in E, determine row by row according to i in ascending order whether "the cells in the current row are all question cells, and the cells in the next row are all answer cells" is true. If true, it indicates that the report or the current area is a matrix basic structure, and the report or current area information is extracted from E; If not, continue to judge the next cell information until all the cell information in E is traversed; g). Determine and extract the unit type up-down structure; from the remaining cells in E, determine whether "the current cell is the question cell, the next cell is the answer cell, and the column spans of both are equal to the report column span" is true according to i from small to large. If true, it indicates that the report or the current area is a unit type up-down structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all the cell information in E is traversed; h). Determine and extract the cell type left-right structure; determine from the remaining cells in E whether "the current cell is the question cell, the next cell is the answer cell, and the row spans of the two are equal" is true according to i from small to large. If true, it indicates that the report or the current area is a cell type left-right structure, and the report or current area information is extracted from E; if not true, continue to judge the next cell information until all cell information in E is traversed; i). If there is remaining cell information in E, it means that the current report structure type identification method cannot identify the type of the report or the current area, and manual identification is required to end the report structure type identification.

3. The method for automatically filling in a report based on a large language model according to claim 2 is characterized in that: The determination of whether it is a matrix type upper and lower structure in step b) is specifically implemented by the following method: b-1). Assume that the report or current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C={Cell1,Cell2,…,Cell n ,…,Cell (N+M) };Cell n The position coordinates are (x n ,y n ), the column span is b n The initial level p of all problem cells n are all set to 1, that is, p n =1; execute step b-2); b-2). Set n=1; execute step b-3); b-3). Determine the cell n The column span b n =B max Is it true? If not, execute step b-5); if true, determine the Cell according to step f). n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of the subsequent cells is a matrix-type upper and lower structure; execute step b-4); b-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step b-5); b-5). Set n=n+1; execute step b-6); b-6). Determine whether n=(N+M) holds. If so, the structure type determination of the report or current area ends. If not, jump to step b-3).

4. The method for automatically filling in a report based on a large language model according to claim 2 or 3, characterized in that: The determination of whether it is a matrix left-right structure in step c) is specifically implemented by the following method: c-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C={Cell1,Cell2,…,Cell n ,…,Cell (N+M) };Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1; execute step c-2); c-2). Set n=1; execute step c-3); c-3). Determine the problem cell n The row span d n =1 is true, if true, execute step c-5); if not true, it means that the cell n The row span is d n ≥2, then follow step f) to determine the Cell n Whether the subsequent cell is a matrix type basic structure, if it is a matrix type basic structure, then the cell n The report or current area composed of subsequent cells is a matrix left-right structure; execute step c-4); c-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; go to step c-5); c-5). Set n=n+1; execute step c-6); c-6). Determine whether n=(N+M) holds. If so, the structure type determination of the report or current area ends. If not, jump to step c-3).

5. The method for automatically filling in a report based on a large language model according to claim 2 or 3, characterized in that: The determination of whether it is a vector type up-down structure in step d) is specifically implemented by the following method: d-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and column coordinates of cells in the same row from small to large, and form a set C={Cell1,Cell2,…,Cell n ,…,Cell (N+M) }, Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1; d-2). Let n=1; d-3). Determine the cell n The column span b n =B max Is it true? If not, go to step d-5); if it is true, select Cell from set C. n Start searching cells sequentially to the next column span b n =B max Cell m So far, all the problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell on its right is a vector-type up-down structure, and step d-4) is executed; d-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; d-5). Let n=n+1; d-6). Determine whether n=N+M is true. If so, the type determination of the report or the current area is completed. If not, execute step d-3).

6. The method for automatically filling in a report based on a large language model according to claim 5, characterized in that: The determination of whether it is a vector type left-right structure in step e) is specifically implemented by the following method: e-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort the question cells in the order of cell row coordinates from small to large and cell column coordinates from small to large, and form a set C={Cell1,Cell2,…,Cell n ,…,Cell (N+M) }, Problem Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , the initial level p of all problem cells n are all set to 1, that is, p n =1; e-2). Let n=1; e-3). Determine the problem cell n The row span d n =1 is true, if true, execute step e-5); if not true, it indicates that the problem cell n The row span is d n ≥2, then in set C, from Cell n Start searching sequentially for the cell row coordinate at x n to x n +d n -1 All problem cells in the range, with the last cell being Cell m , find all the problem cells i , n≤i<m, the report or current area formed by the answer cell on its right is a vector left-right structure, execute step e-4); e-4). In the report or current area, the problem cells in the report or current area are graded according to the principle of "the larger the row span, the lower the problem grade"; e-5). Let n=n+1; e-6). Determine whether n=N+M is true. If so, the type determination of the report or the current area ends. If not, execute step e-3).

7. The method for automatically filling in a report based on a large language model according to claim 5, characterized in that: The determination of whether the basic structure is a matrix type in step f) is specifically implemented by the following method: f-1). Assume that the remaining report or the current area contains N question cells and M answer cells. Sort all cells in the order of cell row coordinates from small to large and column coordinates from small to large, and form a set C={Cell1,Cell2,…,Cell n ,…,Cell (N+M) }, Cell n The position coordinates are (x n ,y n ), the row span is d n , column span is b n , set the initial value of n to 1; execute step f-2); f-2). Take the cell row coordinate x from set C n = all cells of (n-1). If all cells taken out are problematic cells, set the starting row j of the matrix structure report or the current area to n-1; execute step f-3); f-3). Set n=n+1; execute step f-4); f-4). Take out the cell row coordinate x from set C n All cells where = (n - 1), if they are all answer cells, jump to step f-3); if they are not all answer cells, the row coordinates in set C satisfy j ≤ x n <The report or current area composed of cells where n - 1 is a matrix basic structure, execute step f-5); f-5). Determine whether n=N+M is true. If so, the structure type determination of the report or the current area is completed. If not, jump to step f-2).

Citation Information

Patent Citations

  • Method and system for generating business report through artificial intelligence language model

    CN117194410A

  • Question and answer type reimbursement information filling intelligent assistant

    CN118332087A

  • Automatic retrieval and automatic form filling system for form information in non-fixed format

    CN118966170A

  • Method and apparatus for client side automatic electronic form completion

    WO2000042540A2