A method for automatically filling out reports based on a large language model

By parsing and identifying the report structure through a large language model, complex reports can be automatically filled in, solving the time-consuming and labor-intensive problem of report filling in existing technologies, achieving efficient automatic filling effects, and is suitable for batch text-structured reports.

CN119578383BActive Publication Date: 2025-09-23SHANDONG JIANZHU UNIV +2
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411653497.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-19
Publication Date
2025-09-23
Estimated Expiration
2044-11-19

AI Technical Summary

Technical Problem

In the prior art, filling in complex reports consumes a lot of time and energy. The prior art lacks a mature automatic filling method, which limits the application of reports in real life.

Method used

The report automatic filling method adopts the large language model, which realizes automatic filling by parsing cell information, identifying the report structure type and searching for answers based on the large language model.

Benefits of technology

It simplifies the process of filling out complex reports, saves manpower and material resources, improves work efficiency, and has wide applicability and economic benefits.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005141572330000091
    Figure BDA0005141572330000091
  • Figure BDA0005141572330000101
    Figure BDA0005141572330000101
  • Figure BDA0005141572330000102
    Figure BDA0005141572330000102
Patent Text Reader

Abstract

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 identifying the report structure type, and a step of searching and automatically filling in the report based on the large language model; all cells in the report are parsed to 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}; divide the report into a unit structure, a vector structure, and a matrix structure; and search for the answer to the question cell based on the core prompt word of the large language model. The present invention's automatic report filling method based on a large language model identifies whether the report or the current region belongs to a unit structure, a vector structure, or a matrix structure, and constructs core prompt words for the large language model search. This method can be used for filling out reports for big data, has broad applicability, saves manpower and material resources, and can bring significant economic benefits 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 out a report, and more specifically, to a method for automatically filling out a report based on a large language model. Background Art

[0002] Tables, also known as tables, are both a visual communication format and a means of organizing data. They are widely used in communication, scientific research, and data analysis. They appear in a wide variety of places, including printed materials, handwritten records, computer software, architectural decorations, and traffic signs. The conventions and terminology used to describe tables vary depending on the context. Furthermore, tables vary significantly in type, structure, flexibility, notation, presentation, and usage. In books and technical texts, tables are often placed within a numbered and titled floating area, distinguishing them from the main text.

[0003] Tables are used in a variety of software, including both spreadsheet applications and table controls. Typical examples include Office Word, Excel, and WPS. Tables are one of the most commonly used data processing methods, primarily used for inputting, outputting, displaying, processing, and printing data. They can create complex spreadsheet documents and even help users perform complex statistical calculations and graphical presentations. Table controls are also commonly used for presenting and editing data in databases, designing data entry interfaces, and for data exchange, reporting, and distribution.

[0004] In our daily lives, commonly used tables fall into two categories. The first category is relational database tables, which logically represent and implement data using a two-dimensional table structure, strictly adhere to data format and length specifications, and store structured data. The second category is the various reports commonly used in daily business offices, which lack strict logical expression specifications and store unstructured data. Both types of tables are highly mature in various industries. For example, in banks, public security agencies, various enterprises, transportation, and commodity trading, there are numerous scenarios requiring report filling.

[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 realization of the advantages of reports in real life.

[0006] Currently, with the development of artificial intelligence (AI), computers can quickly and accurately categorize and fill in reports with manually written documents, such as resumes. If these technologies can be fully utilized during report filling, the complex task of filling out reports will undoubtedly be greatly simplified, freeing up people's creativity for other more needed methods. However, there are no mature methods for automatically filling out reports in the existing technology. Summary of the Invention

[0007] In order to overcome the shortcomings of the above technical problems, the present invention provides a method for automatically filling in reports 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 includes a step of parsing cell information in the report, a step of distinguishing the report structure type, 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 is characterized in that: all cells in the report are parsed in order from top to bottom and from left to right, and the position information, size information and content information of each cell are obtained to 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 Represents 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: based on 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-type upper and lower structure is determined from all report cells and extracted. Then, in the remaining report cells, the order of matrix-type left and right structure, vector-type upper and lower structure, vector-type left and right structure, matrix-type basic structure, unit-type upper and lower structure, and unit-type left and right structure is repeated in turn to divide the report into unit-type structure, vector-type structure, and matrix-type structure. The steps for searching and automatically filling in the form based on the large language model are as follows: first, based on the structure type of the report to which the question cell belongs and the stored text, the core prompt words of the large language model are generated. Then, based on the core prompt words of the large language model, the answer to the question cell is searched for. Finally, it is 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 sum of the column spans of all cells with column spans equal to 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 the order of i from small to large." max , all cells in the row below the current cell are problem cells" is true. If so, it indicates that the report or the current area is a matrix-type top-bottom structure, then the text message in the current problem cell is set to i For a first-level question, let the text information in each question cell in the next row 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 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" are 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 For 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 cell information in E is traversed;

[0014] d). Determine and extract the vector-type upper and lower structures; 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 current area is a vector-type up-down structure, then the text message in the current cell is set to message. i For 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 not, continue to judge the next cell information until all 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 in ascending order. If true, it indicates that the report or the current area is a vector left and right structure, then let the text information message in the current cell be 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 for 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 based on i in ascending order whether "all cells in the current row are question cells, and all cells in the next row are answer cells" is true. If so, it indicates that the report or current area has a matrix-type basic structure, and the report or current area information is extracted from E. If not, continue to perform the judgment on the next cell information until all cell information in E has been traversed;

[0017] g) Determine and extract the cell-type context structure; from the remaining cells in E, determine, based on i in ascending order, 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." If so, the report or current region has a cell-type context structure, and the report or current region information is extracted from E. If not, continue the determination for the next cell information until all cell information in E has been traversed.

[0018] h) Determine and extract the cell-type left-right 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 row spans of the two are equal" is true based on i from small to large. If so, it indicates that the report or current area has a cell-type left-right structure, and the report or current area information is extracted from E; if not, continue to perform the judgment on 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. 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 the structure is a matrix-type top-bottom 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 ascending order of row coordinates and column coordinates, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M) Cell n The position coordinates are (x n ,y 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; proceed to step b-2);

[0022] b-2). Set 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 it is true, go to step f) to determine the Cell n Whether the subsequent cells are matrix-type basic structures, if they are matrix-type basic structures, then the cell n The report or current area composed of the subsequent cells is a matrix-type top-bottom structure; go to step b-4);

[0024] b-4). In the report or current region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; then proceed to step b-5).

[0025] b-5). Set 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 the left-right structure is a matrix 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 ascending order of row coordinates and column coordinates, 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; proceed to 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 is true, if so, 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 cells are matrix-type basic structures, if they are matrix-type basic structures, 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 region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; proceed to step c-5).

[0032] c-5). Set 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 up-down 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 ascending order of row coordinates and column coordinates of cells in the same row. Then 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 problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell to its right is a vector-type up-down structure, execute step d-4);

[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 level";

[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 the left-right structure is a vector type is specifically achieved 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 ascending order of row coordinates and column coordinates, 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 is true, if so, execute step e-5); if not, it indicates that the problem cell n The row span is d n ≥2, then in set C from Cell n Start searching for the cell row coordinates in 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 to its right is a vector left-right structure, execute step e-4);

[0045] e-4) In a 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. If so, the type determination of the report or the current area ends. If not, execute step e-3).

[0048] The method for automatically filling reports based on large language models of the present invention, the determination of whether it is a matrix basic structure described 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 the cell row coordinates and in ascending order of the 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 the cell row coordinate x n = (n - 1) from set C. If all the cells taken out are question cells, assume the starting row j of the matrix 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 the 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 formed by the cells in set C with row coordinates satisfying j ≤ x n < n - 1 is a matrix 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 cell information parsing step in the report, a report structure type discrimination step, and a search and automatic filling step based on the large language model. In the cell information parsing step, 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 report structure type discrimination step, 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 question in the question cell, so as to accurately search for the answer to the standard question cell so as to automatically fill it in the answer cell; it can be used for batch text structure report filling of big data, has a wide range of applicable value, saves manpower and material resources, and can bring significant economic benefits to the enterprise. DETAILED DESCRIPTION

[0055] The present invention will be further described below with reference to 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 identifying the report structure type, 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, 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 Represents 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]. The 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 sum of the column spans of all cells with column spans equal to 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 the order of i from small to large." max , all cells in the row below the current cell are problem cells" is true. If so, it indicates that the report or the current area is a matrix-type top-bottom structure, then the text message in the current problem cell is set to i For a first-level question, let the text information in each question cell in the next row 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 cell information in E is traversed;

[0064] For a report or current area with a matrix-type top-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. This defines the level of the problem cell on the upper side as higher than the level of the problem cell within the matrix-type basic structure. Table 2 shows a report with a matrix-type top-down structure:

[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] As you can see, in Tables 2 and 3, the first cell is a question cell, and its column span is 4, equal to the maximum column span of the report. Below the first cell is a matrix-like basic structure. The problem in the first cell is level one, and the problems in the remaining question 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" are 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 For 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 cell information in E is traversed;

[0072] For a report or current area with a matrix-type left-right structure, it consists of a matrix-type 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-type basic structure. This defines the level of the problem cells on the left as higher than the level of the problem cells within the matrix-type basic structure. Table 4 shows a report with a matrix-type left-right structure:

[0073] Table 4

[0074]

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

[0076] Table 5

[0077]

[0078] As you can see, in Reports 4 and 5, the first cell is a problem cell, the row span is 3, and the right side of the first cell is a matrix-type basic structure. The problem in the first cell is level one, and the problems in the remaining problem cells are level two.

[0079] d). Determine and extract the vector-type upper and lower structures; 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 current area is a vector-type up-down structure, then the text message in the current cell is set to message. i For 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 not, continue to judge the next cell information until all cell information in E is traversed;

[0080] For a report or current area with a vector-type top-bottom structure, multiple question cells form a two-level (or multi-level) top-bottom 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 is defined as having a higher level than the lower question cell, and the question cell and the adjacent answer cell to the right form a unit-type left-right structure. Table 6 shows a report with a vector-type top-bottom structure:

[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 with a column span of 4. The question in the first cell is level one, and the questions 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 in ascending order. If true, it indicates that the report or the current area is a vector left and right structure, then let the text information message in the current cell be 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 incremented by 1, and the report or current region information is extracted from E. If the condition is not met, the judgment is continued for the next cell information until all cell information in E is traversed. For a report or current region with a vector left-right structure, multiple question cells form a multi-level left-right nested relationship. If the row span of the left question cell is greater than the row span of the right question cell, the left question cell level is defined as higher than the right question cell level. The question cell and the adjacent answer cell on the right form 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 questions in the first question cell are 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 based on i in ascending order whether "all cells in the current row are question cells, and all cells in the next row are answer cells" is true. If so, it indicates that the report or current area has a matrix-type basic structure, and the report or current area information is extracted from E. If not, continue to perform the judgment on the next cell information until all cell information in E has been traversed;

[0095] For a report or current area with a matrix-type basic structure, the question cells and answer cells are arranged in a matrix. The column span and row span of the matrix are both greater than or equal to two. The cells in the first row are all question cells, and the remaining cells are all answer cells. Table 10 shows a report with a matrix-type 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 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, third, and fourth rows are all answer cells.

[0102] g) Determine and extract the cell-type context structure; from the remaining cells in E, determine, based on i in ascending order, 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." If so, the report or current region has a cell-type context structure, and the report or current region information is extracted from E. If not, continue the determination for the next cell information until all cell information in E has been traversed.

[0103] For reports or current areas with a unit-type top-bottom structure, question cells and answer cells are adjacent to each other and have the same column span. Table 12 shows a report with a unit-type top-bottom structure:

[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; from the remaining cells in E, determine 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 based on i from small to large. If so, it indicates that the report or current area has a cell-type left-right structure, and the report or current area information is extracted from E; if not, continue to perform the judgment on the next cell information until all cell information in E is traversed;

[0112] For reports or current areas with a unit-type left-right structure, the question cells and answer cells are adjacent to each other and have the same row span. Table 14 shows a report with a unit-type left-right structure:

[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. Manual identification is required to end the report structure type identification.

[0120] in:

[0121] The determination of whether the structure 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 ascending order of row coordinates and column coordinates, and form a set C = {Cell1, Cell2, ..., Cell n ,…,Cell (N+M) Cell n The position coordinates are (x n ,y 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; proceed to step b-2);

[0123] b-2). Set 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 cells are matrix-type basic structures, if they are matrix-type basic structures, then the cell n The report or current area composed of the subsequent cells is a matrix-type top-bottom structure; go to step b-4);

[0125] b-4). In the report or current region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; then proceed to step b-5).

[0126] b-5). Set 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: 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 the left-right structure is a matrix 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 ascending order of row coordinates and column coordinates, 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; proceed to 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 is true, if so, 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 cells are matrix-type basic structures, if they are matrix-type basic structures, 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 region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; proceed to step c-5).

[0134] c-5). Set 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 is: 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 2, 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 ascending order of row coordinates and column coordinates of cells in the same row. Then 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 problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell to its right is a vector-type up-down structure, execute step d-4);

[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 level";

[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 top-bottom 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 problem 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-type structures, then Area n It is a vector type up and 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 the left-right structure is a vector type 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 ascending order of row coordinates and column coordinates, 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 is true, if so, execute step e-5); if not, it indicates that the problem cell n The row span is d n ≥2, then in set C from Cell n Start searching for the cell row coordinates in 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 to its right is a vector left-right structure, execute step e-4);

[0149] e-4) In a 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. If so, the type determination of the report or the current area ends. 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 2. If a problem cell that meets the conditions is found, it will be recorded as a 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 a 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 the 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] A f - 4). Take out all cells with the 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 formed by the 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. 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 the cells in each row in the order of cell row coordinates from small to large and column coordinates from small to large. If all the cells in a row are problem cells, then record the horizontal coordinate of the cells in this row as x. n ; If the horizontal axis is x n+1 If all cells in the table 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. 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 with unit structures shown in Tables 12 to 15, the method for constructing the answer cell corresponding to the question content is: the content corresponding to the question cell. For the cells shown in Table 15, the answer cell large language model question prompt 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 combining 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 method for constructing the question content of all answer cells is: 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 using 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 response: Zhang San #father #45 #party member #teacher

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

[0170] Use the fixed separator "#" to split the answer content sequentially, and match the split content with the answer cells one by one 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 the steps of parsing cell information in the report, identifying the report structure type, and searching and automatically filling in the report based on the large language model; characterized in that: The steps for parsing the cell information in the report are: 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 coordinate of cell i, d i and b i Represents 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: based on 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-type upper and lower structure is determined from all report cells and extracted. Then, in the remaining report cells, the order of matrix-type left and right structure, vector-type upper and lower structure, vector-type left and right structure, matrix-type basic structure, unit-type upper and lower structure, and unit-type left and right structure is repeated in turn to divide the report into unit-type structure, vector-type structure, and matrix-type structure. The steps for searching and automatically filling in the form based on the large language model are as follows: first, based on the structure type of the report to which the question cell belongs and the stored text, the core prompt words of the large language model are generated. Then, based on the core prompt words of the large language model, the answer to the question cell is searched for. Finally, it is 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 sum of all cell column spans to report column span B max ; b) Determine and extract the matrix structure; from E, based on i from small to large, determine whether the current cell is the problem cell and the column span of the current cell is equal to B. max , all cells in the row below the current cell are problem cells" is true. If so, it indicates that the report or the current area is a matrix-type top-bottom structure, then the text message in the current problem cell is set to i For the first-level question, let the text information in each question cell in the next row of the current cell be the second-level question, and extract the report or current area information from E; If not, continue to judge the next cell information until all 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" are 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 For the first-level question, let the text information in each question cell to the right of the current cell be the second-level question, and extract the report or current area information from E; If not, continue to judge the next cell information until all cell information in E is traversed; d). Determine and extract the vector-type upper and lower structures; 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 current area is a vector-type up-down structure, then the text message in the current cell is set to message. i For the first-level question, let the text information in each question cell below the current cell be the second-level question, and extract the report or current area information from E; If not, continue to judge the next cell information until all cell information in E is traversed; 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 in ascending order. If true, it indicates that the report or the current area is a vector left and right structure, then the text information message in the current cell is set to 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 cell information in E is traversed; f) Determine and extract the matrix structure. From the remaining cells in E, determine row by row, in ascending order of i, whether the following holds true: "all cells in the current row are question cells, and all cells in the next row are answer cells." If so, the report or current region has a matrix structure, and the report or current region information is extracted from E. If not, continue to judge the next cell information until all cell information in E is traversed; g) Determine and extract the cell-type context structure; from the remaining cells in E, determine, based on i in ascending order, 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." If so, the report or current region has a cell-type context structure, and the report or current region information is extracted from E. If not, continue the determination for the next cell information until all cell information in E has been traversed. h) Determine and extract the cell type left-right 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 row spans of the two are equal" is true based on i from small to large. If so, it indicates that the report or current area has a cell type left-right structure, and the report or current area information is extracted from E; if not, continue to perform the judgment on 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. 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, characterized in that: The determination of whether the structure 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 ascending order of row coordinates and column coordinates, 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; go to step b-2); b-2). Set n=1; go to step b-3); 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 if Cell n Whether the subsequent cells are matrix-type basic structures, if they are matrix-type basic structures, then the cell n The report or current area composed of the subsequent cells is a matrix-type top-bottom structure; go to step b-4); b-4). In the report or current region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; proceed to step b-5). b-5). Set n=n+1; proceed to step b-6); b-6). Determine whether n=(N+M) holds true. 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 the left-right structure is a matrix 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 ascending order of row coordinates and column coordinates, 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; go to step c-2); c-2). Set n=1; proceed to step c-3); c-3). Determine the problem cell n The row span d n =1 is true, if so, 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 cells are matrix-type basic structures, if they are matrix-type basic structures, 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 region, rank the problem cells in the report or current region according to the principle of "the larger the row span, the lower the problem level"; proceed to step c-5). c-5). Set n=n+1; proceed to 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 ascending order of row coordinates and column coordinates of cells in the same row. Then 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 problem cells have been found. i , n≤i<m, the report or current area formed by the answer cell to its right is a vector-type up-down structure, execute step d-4); d-4) In a report or current area, the problem cells in the report or current area are ranked according to the principle of "the larger the row span, the lower the problem level"; 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 the left-right structure is a vector type 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 ascending order of row coordinates and column coordinates, 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 so, go to step e-5); if not, it indicates a problem cell n The row span is d n ≥2, then in set C from Cell n Start searching for the cell row coordinates in 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 to its right is a vector left-right structure, execute step e-4); e-4) In a 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 level"; e-5). Let n=n+1; e-6). Determine whether n=N+M. 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 ascending order of row coordinates and column coordinates, 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 retrieved are problem 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 the current area formed by cells where n - 1 is a matrix - type 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 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