LLM-based automatic table filling method, apparatus and device, and medium
By using an LLM model to parse the entity-attribute relationships between tables and text, the problem of form filling errors in traditional NLP models in complex semantic contexts is solved, achieving highly accurate and efficient automatic form filling.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SUZHOU CHUANGLUTIANXIA INFORMATION TECH CO LTD
- Filing Date
- 2025-12-24
- Publication Date
- 2026-05-08
AI Technical Summary
Traditional NLP models have poor generalization ability when dealing with complex semantic contexts, making it difficult to accurately capture user intent, resulting in low accuracy of automatic table filling.
The system uses a large LLM-based model to parse the entity-attribute relationship between the table to be filled and the text to be filled. Through HTML format conversion and Prompt template guidance, it achieves accurate matching and automatic filling of the table header fields and the text to be filled.
It improves the accuracy and efficiency of automatic table filling, ensures the matching degree between the filled content and the table header, reduces human judgment errors, adapts to cross-page or nested tables, and expands the scope of application.
Smart Images

Figure CN121997901A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to an automatic form filling method, apparatus, device and medium based on LLM. Background Technology
[0002] In today's rapidly developing information age, filling out various forms has become an indispensable part of daily work and life, especially in fields such as finance, healthcare, and government where data accuracy is paramount. Traditional manual form filling methods are not only inefficient but also prone to errors due to human negligence, posing potential risks to individuals and organizations. Currently, automatic form filling methods based on Natural Language Processing (NLP) models are mainly used. These methods extract information from user input through pattern matching and keyword recognition and fill it into the corresponding form fields. While these methods are effective in processing structured or highly standardized text, their generalization ability is poor, and they struggle to understand complex semantic contexts. In particular, when user input contains variations in expression, colloquialisms, or cross-domain terminology, traditional NLP models often fail to accurately capture the intent, resulting in errors or omissions and low accuracy in automatic form filling. Summary of the Invention
[0003] This application provides an LLM-based method, apparatus, device, and medium for automatically filling out forms, which addresses the technical problem that NLP models cannot accurately capture intent, resulting in errors or omissions in form filling and thus low accuracy in automatic form filling.
[0004] The technical solution of this application embodiment is implemented as follows: In a first aspect, embodiments of this application provide an LLM-based method for automatically filling in tables, including: Obtain the table to be filled in the document to be filled and record its position; obtain the text to be filled input by the user; parse the table to be filled and convert it into HTML format to obtain a first HTML table; concatenate the first HTML table, the text to be filled, and a preset Prompt template and input them into the LLM model; parse the entity-attribute relationship between the header fields of the first HTML table and the text to be filled using the LLM model; automatically fill the first HTML table based on the entity-attribute relationship to obtain a second HTML table; input the second HTML table into the position of the table to be filled in the document to obtain the filled document.
[0005] Optionally, parsing the table to be filled and converting it into HTML format to obtain a first HTML table specifically includes: identifying cell information, table structure, header information, and header fields in the table to be filled; generating corresponding row attribute tags and column attribute tags based on the cell information; generating HTML format header tags based on the header information; and generating the first HTML table based on the row attribute tags, column attribute tags, header tags, and header fields.
[0006] Optionally, the entity-attribute relationship between the header fields of the first HTML table and the text to be filled is parsed using the LLM model. Specifically, this includes: parsing the semantics of the text to be filled using the LLM model to obtain multiple attribute fields; mapping each attribute field to the header fields to obtain the entity-attribute relationship between the header fields and the text to be filled.
[0007] Optionally, based on the entity-attribute relationship, the first HTML table is automatically filled to obtain a second HTML table in HTML format. Specifically, this includes: locating the row attribute tags and column attribute tags of the HTML string to be filled in the first HTML table; filling each attribute field into the corresponding HTML string to be filled according to the entity-attribute relationship, and retaining the row attribute tags and column attribute tags of the HTML string to be filled, to obtain the second HTML table in HTML format after filling.
[0008] Optionally, after inputting the second HTML table into the position of the table to be filled in the document to be filled, and obtaining the filled document, the method further includes outputting the second HTML table in the user-preset specified format.
[0009] Optionally, the document to be filled includes multiple tables to be filled, and the method includes: parsing each of the tables to be filled, converting each of the tables to be filled into HTML format to obtain multiple first HTML tables; concatenating each of the first HTML tables, the text to be filled, and a preset Prompt template and inputting them into an LLM large model; parsing the entity-attribute relationship between the header fields of each of the first HTML tables and the text to be filled through the LLM large model; automatically filling each of the first HTML tables based on the entity-attribute relationship to obtain multiple second HTML tables; and inputting each of the second HTML tables into the positions of each of the tables to be filled in the document to be filled to obtain a filled document.
[0010] Optionally, if the table to be filled is a cross-page table or a nested table, then when converting the table to be filled into the HTML format, the cross-page structure or nested structure of the table to be filled is identified and recorded to obtain the first HTML table that retains the cross-page structure or the nested structure.
[0011] Secondly, embodiments of this application provide an LLM-based automatic form filling device, comprising: The module for obtaining tables to be filled is used to obtain tables to be filled in the document to be filled and record the position of the tables to be filled. The text to be filled module is used to obtain the text to be filled input by the user; The format conversion module is used to parse the table to be filled and convert it into HTML format to obtain the first HTML table. The data input module is used to concatenate the first HTML table, the text to be filled, and the preset Prompt template and input them into the LLM large model; The data mapping module is used to parse the entity-attribute relationship between the header fields of the first HTML table and the text to be filled through the LLM large model; The table filling module is used to automatically fill the first HTML table based on the entity-attribute relationship to obtain the second HTML table; The document filling module is used to input the second HTML table into the position of the table to be filled in the document to obtain a filled document.
[0012] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, a user interface, and a network interface. The memory is used to store instructions, and both the user interface and the network interface are used to communicate with other devices. The processor is used to execute the instructions stored in the memory so that the electronic device performs the above-described LLM-based automatic table filling method.
[0013] Fourthly, embodiments of this application provide a computer-readable storage medium storing instructions that, when executed, implement the LLM-based automatic table filling method provided in embodiments of this application.
[0014] In summary, by adopting one or more technical solutions provided in this application, at least the following technical effects or advantages are achieved: 1. By acquiring the table to be filled and its location, as well as the user-inputted text, the table is converted into a first HTML table. Then, the text to be filled and a preset Prompt template are input into the LLM model, allowing the model to parse the entity-attribute relationship between the header fields and the text to be filled, thereby automatically filling the table to obtain a second HTML table. Finally, it is placed back in the original document position, clearly presenting the table structure and content. By guiding the model through the preset Prompt template, the model can more accurately focus on the association analysis between the header fields and the text to be filled, ensuring the matching degree between the filled content and the header. With the deep understanding and analysis capabilities of the LLM model, the error of manual judgment is reduced, thereby effectively improving the accuracy of automatic table filling.
[0015] 2. By identifying cell information, table structure, header information, and header fields, and then generating corresponding row attribute tags, column attribute tags, and header tags based on this information, a first HTML table is ultimately generated. This process comprehensively and meticulously captures all key information of the table to be filled, ensuring that the converted first HTML table fully retains the structural and content characteristics of the original table. This allows the LLM model to be analyzed based on accurate table information during subsequent processing, laying the foundation for correctly parsing entity-attribute relationships, thereby improving the accuracy and reliability of table filling.
[0016] 3. By first parsing the semantics of the text to be filled to obtain multiple attribute fields, and then mapping each attribute field to the table header field, the required entity-attribute relationship is obtained. This allows the model to first deeply understand the meaning of the text to be filled, extract valuable attribute fields, and then establish a connection with the table header field through mapping, thus ensuring the accuracy of the entity-attribute relationship.
[0017] 4. By precisely locating the position to be filled, it ensures that the attribute fields are filled into the correct cells; retaining the row and column attribute tags maintains the original structural integrity of the table, making the second HTML table after filling not only accurate in content but also structurally complete.
[0018] 5. The second HTML table is output in a user-preset format, which meets the user's personalized needs for table format. This allows the filled table to adapt to different application scenarios or document requirements, enhancing the practicality and flexibility of the method and improving the user experience.
[0019] 6. When the document to be filled contains multiple tables, multiple first HTML tables are obtained by parsing each table separately. Then, operations such as concatenating the input model, parsing the relationship, filling the tables, and putting them back in their original positions are performed in sequence to achieve automatic filling of multiple tables. Users do not need to operate on each table individually, which saves a lot of time and manpower costs and improves the efficiency of table filling. At the same time, the unified processing flow also ensures the consistency and accuracy of filling multiple tables.
[0020] 7. When the table to be filled is a multi-page or nested table, its multi-page or nested structure is identified and recorded during the conversion to HTML format. This ensures that the unique structure of the table is not destroyed during the conversion process. The LLM large model can analyze and fill based on the complete structural information, thereby ensuring the accuracy of automatic filling of multi-page or nested tables and expanding the applicability of this method to handle more complex table types. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating an LLM-based automatic table filling method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the table format conversion process provided in the embodiments of this application; Figure 3 This is a flowchart illustrating the process of resolving entity-attribute relationships provided in an embodiment of this application; Figure 4 This is a flowchart illustrating the process of filling an HTML table according to an embodiment of this application; Figure 5 This is another flowchart illustrating an LLM-based automatic table filling method provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an LLM-based automatic form filling device provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application.
[0022] Explanation of reference numerals in the attached figures: 300, LLM-based automatic form filling device; 301, form to be filled acquisition module; 302, text to be filled acquisition module; 303, format conversion module; 304, data input module; 305, data mapping module; 306, form filling module; 307, document filling module; 308, form output module; 400, electronic device; 401, processor; 402, communication bus; 403, user interface; 404, network interface; 405, memory. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0024] In the description of the embodiments of this application, words such as "illustrative," "for example," or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "illustrative," "for example," or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design solutions. Rather, the use of words such as "illustrative," "for example," or "for example" is intended to present the relevant concepts in a specific manner.
[0025] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit. The terms "comprising," "including," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0026] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.
[0027] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.
[0028] In related technologies, automatic form filling methods based on natural language processing (NLP) models are commonly used. These methods are effective in processing structured or highly standardized text, but their generalization ability is poor and they have difficulty understanding complex semantic contexts. In particular, when user input contains variations in expression, colloquial expressions, or cross-domain terms, traditional NLP models often fail to accurately capture the intent, resulting in errors or omissions in form filling and low accuracy of automatic form filling.
[0029] To address the aforementioned issues, this application provides an LLM-based method, apparatus, device, and medium for automatically filling tables. By using the LLM model, the mapping relationship between the user-inputted text and the table to be filled can be accurately analyzed, reducing errors from manual judgment and thus effectively improving the accuracy of automatic table filling.
[0030] Figure 1This is a flowchart illustrating an LLM-based automatic table filling method provided in an embodiment of this application.
[0031] This invention discloses an automatic table filling method based on LLM, such as... Figure 1 As shown, the steps include the following.
[0032] Step S101: Obtain the table to be filled in the document to be filled, and record the position of the table to be filled.
[0033] Specifically, the processor obtains the user-provided document to be filled and records its storage location. Python or other machine learning models can be used to parse the document and extract raw data (such as text and table objects within the document). No specific restrictions are placed here. The extracted raw data is used to identify the table to be filled based on preset criteria (e.g., in Excel, objects with "clear row and column indices and containing blank cells" are considered tables; in Word, objects containing...). <w:tbl>The XML node of the "tag" is determined to be a table, and its position information in the document is recorded during processing.
[0034] Here, "document to be filled" refers to a user-provided document that requires automatic table filling. "Table to be filled" refers to an incomplete table in the document that only contains header information or only partial information. "Table position" refers to quantitative information used to accurately describe the physical location of the table within the document. It is the core data for recording the table position and is beneficial for quickly locating the table later.
[0035] For example, the document to be filled can be a Word document, an Excel document, a PDF document, etc., without specific restrictions. When obtaining the table to be filled from the document, you can use Python's openpyxl to parse Excel documents, python-docx to parse Word documents, or a CNN image recognition model to parse PDF documents, etc.
[0036] The above embodiments can support manual and rapid table lookup, and also provide a reliable location basis for subsequent automated data filling (such as batch filling with code), ultimately improving the efficiency and accuracy of document processing and meeting the precise management needs of tables to be filled in business scenarios.
[0037] Step S102: Obtain the text to be filled input by the user.
[0038] Specifically, users can input text to be filled in on the application's interactive interface, and the processor obtains the text input by the user through the network interface with the front end, and uses it as the text to be filled in.
[0039] The text to be filled refers to the text content that the user directly enters in the interactive interface, including the text content entered for the form to be filled. For example, the text entered by the user can be a complete text (e.g., Zhang San, male, Han nationality, 24 years old, graduated from a certain university with a bachelor's degree, currently working in a certain department of a certain company), or standardized text content (name: Zhang San; gender: male; nationality: Han; age: 21 years old; education: bachelor's degree). There are no specific restrictions here.
[0040] Step S103: Parse the table to be filled and convert it into HTML format to obtain the first HTML table.
[0041] Specifically, the processor can use programming tools (such as Python's pandas library) to read the table to be filled, use the `shape` attribute to get the number of rows and columns, use the `isnull()` function to identify blank cells, or use Python's `openpyxl` library to read the table's border and other attribute information, as well as the table content information. Based on the parsing results, the corresponding HTML table structure is constructed, converting the original table's visual layout into a standard HTML tag hierarchy, including generating... Tags are used as table containers. Labels represent table rows. or The tags represent cells, and the final output is a first HTML table that fully conforms to the HTML syntax specification. This table retains the structural features and data content of the original table, providing standardized input for subsequent data processing or visualization.
[0042] Parsing the table to be filled refers to the process of analyzing the structure and extracting the content of the input table document, used to identify the table's row and column structure, cell attributes, and data content; HTML format refers to the standard document format of Hypertext Markup Language, used to represent the table structure and content in a webpage; the first HTML table refers to the standardized HTML table object generated after format conversion, containing complete... 、 、 Label structure and original table data.
[0043] For example, when the table to be populated is a product information table, the parsing process will identify that the table contains 5 rows and 4 columns, with the first row being the header row (containing four header cells: "Product Number", "Product Name", "Specifications", and "Unit Price"). The converted first HTML table will contain accurate... Structure, Use The `<title>` tag represents the header cell and fully preserves the text content and number formatting of all cells, ensuring that the generated HTML table displays in the browser with a layout completely consistent with the original table.
[0044] Through the above embodiments, the first HTML table retains clear identification of the cells to be filled, and can be directly connected to applications (such as automatically focusing on the position to be filled through the data-to-fill attribute) and stored in the processor (such as synchronizing the HTML table content to the database), adapting to various application scenarios such as "online forms" and "document collaboration", and can meet subsequent business needs.
[0045] Figure 2 This is a schematic diagram of the table format conversion process provided in the embodiments of this application.
[0046] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 2 ,against Figure 1 The step S103 shown can be achieved through... Figure 2 Steps S1031-S1034 are implemented, and will be explained in detail below.
[0047] Step S1031: Identify the cell information, table structure, header information, and header fields in the table to be filled.
[0048] Specifically, the processor performs comprehensive structural recognition and information extraction on the table to be filled. First, it preprocesses the table image and analyzes the layout to identify the boundary positions and spatial distribution of all cells, accurately obtaining the coordinates and dimensions of each cell. Next, it analyzes the overall structural features of the table, including the number of rows and columns, table line types, and border styles. Then, it specifically identifies the header area, determining the row / column of the header based on text and positional features, and extracting the text content of each field in the header. Finally, it deeply analyzes the header field information, including field names, data types (text / number / date, etc.), formatting requirements, and logical relationships between fields, establishing a complete table metadata description. The entire process employs a combination of computer vision and natural language processing techniques to ensure comprehensive and accurate capture of table information.
[0049] Cell information refers to the content data and format attributes contained in each independent cell in the table, used to represent specific information such as the cell's text value, font style, and alignment; table structure refers to the overall organization of the table, used to represent layout features such as the number of rows and columns, cell merging relationships, and border styles; header information refers to the header row or header column at the top of the table, used to describe the classification and meaning of the data content below; header fields refer to the individual header cells in the header, which are the attribute names and type definitions of each data column in the table, such as the header field "Name" indicating that the column stores string-type personnel name data.
[0050] For example, when the table to be filled is a 6-row, 5-column employee information table, the recognition process will first locate the 6-row, 5-column table structure, and identify the first row as the header row, which contains five header fields: employee ID, name, department, date of employment, and salary. The type of each field is also identified: employee ID is a numeric type, name is a text type, department is a text type, date of employment is a date type, and salary is a currency type.
[0051] Through the above embodiments, the structured and semantic information of the table is captured completely and accurately, providing a reliable metadata foundation for subsequent data filling and processing. This ensures the accuracy and consistency of data filling, supports the correct processing of complex table structures, significantly improves the automation and reliability of table data processing, and reduces the need for manual intervention.
[0052] Step S1032: Generate corresponding row attribute labels and column attribute labels based on cell information.
[0053] Specifically, the processor analyzes the position coordinates and adjacency relationships of each cell in the table to determine its row and column indices. Then, based on the table structure and content characteristics, it generates a unique row attribute label for each row to identify the data type and content characteristics of that row. At the same time, it generates a column attribute label for each column to describe the data attributes and semantic meaning of that column. Finally, it establishes a mapping relationship between row and column labels and cell data.
[0054] Among them, row attribute labels are identifiers generated for each row in the table to represent the category attributes and data characteristics of that row, such as data rows, header rows, summary rows, etc.; column attribute labels are descriptors generated for each column in the table, which are abstract representations of the data content and semantics of that column, such as name columns, date columns, numeric columns, etc.
[0055] For example, if the table to be filled is a sales data table, the row attribute labels generated based on the cell information include: header row (first row), data rows (second to tenth rows), and summary row (last row); the generated column attribute labels include: product name column (text type), sales date column (date type), sales quantity column (numeric type), and sales amount column (currency type).
[0056] Through the above embodiments, the system can automatically add structured tags to tabular data, establish a mapping relationship from raw data to semantic description, provide clear semantic guidance for subsequent data processing and analysis, improve the accuracy of data processing, enhance the interpretability of the system, and lay a solid foundation for the intelligent application of tabular data.
[0057] Step S1033: Generate HTML-formatted table header tags based on the table header information.
[0058] Specifically, based on the text content, data type, and hierarchical relationship of each field in the table header information, the processor analyzes the organizational structure and semantic information of the table header information. The label defines the header area, where it is used Tags create header rows, then generate corresponding tags for each header field. The tag sets the scope attribute to indicate the scope (col / row), and adds the corresponding class or data-type attribute to record the data type, ensuring that the generated HTML table header tag completely retains the semantic information and structure of the original table header.
[0059] The table header tag is a special tag in HTML specifically used to define table titles. 、 Semantic markup elements used to identify and describe the attributes of table columns.
[0060] For example, for a sales report with a three-level header, the system will generate a report containing... HTML code for the area: First-level header uses Sales data This indicates a header that spans three columns; the second-level header contains... Product Information and Sales situation The third-level table header contains specific field headings, such as... Product Name , Sales volume Wait, each Tags all contain corresponding data type attributes and semantic identifiers.
[0061] Step S1034: Generate the first HTML table based on row attribute tags, column attribute tags, table header tags, and table header fields.
[0062] Specifically, the number of rows and the type of each row (header row, data row, summary row, etc.) are determined based on the row attribute tags. Tags create a table container; then generate a table based on the header tags. Regions are defined according to the hierarchical relationship and structural characteristics of the table header fields, using... The tags construct the complete table header structure, including setting the scope attribute, colspan / rowspan attributes, etc.; then, based on the column attribute tags, the data type and semantic characteristics of each column are determined, for each... Add the corresponding data-type attribute to the cell; finally, follow the order of the row attribute labels and use... and The tags construct data areas row by row, ensuring that each cell has corresponding row and column semantic attributes, forming a first HTML table with a complete structure and rich semantics.
[0063] The first HTML table refers to the final generated complete table structure that conforms to HTML standards, meaning it contains complete...
[0065]
[0066]
[0067] 、 、 、 、 、 Standard HTML table code with tags such as "etc".
[0064] For example, when the document to be populated is an employee information table, three rows are generated based on the row attribute tags. (1 header row + 2 data rows); generated based on header labels and header fields. Area, including Employee ID , Name etc.; based on column attribute labels for each Add data type properties, such as 1001 , Zhang San Finally, standard HTML table code containing complete semantic information is generated. Through the above embodiments, structured row and column attributes and header information are converted into standardized HTML table code, which not only fully preserves the semantic information and data structure of the original table but also achieves machine-readable standard format output, providing a reliable foundation for subsequent webpage display, data processing, and analysis, significantly improving the usability and interoperability of table data. Step S104: The first HTML table, the text to be filled, and the preset Prompt template are concatenated and input into the LLM large model. Specifically, the complete code of the first HTML table is extracted in the processor, including...
[0068]
[0069]
[0070]
[0071]
[0072]
[0099]
[0100]
[0101]
[0103]
[0104]
[0105] <w:tbl> Insert the data and then repackage the file. For PDF documents, which have a fixed layout, processing is more complex. Typically, the data is located using a PDF library at specific coordinates (bounding boxes) or by special tags (such as those in tagged PDFs).< / w:tbl> 、 、 The process involves: obtaining all tag structure and attribute information; acquiring the text content to be filled, including the specific data items and descriptions to be inserted into the table; then, embedding the HTML table code and the text to be filled into the specified positions of the template according to the format requirements of the preset Prompt template, maintaining the original instruction structure and context description of the template; finally, inputting the completed prompt information into the LLM large model through the API interface, ensuring that all input information meets the model's context length limits and processing requirements. The preset Prompt template refers to a pre-designed prompt word framework, a standardized text template containing instruction descriptions, format requirements, and context descriptions; concatenation refers to the process of combining and connecting various types of information in a specific order and format; and the LLM (Large Language Model) refers to a large-scale language model, an artificial intelligence model with natural language understanding and generation capabilities. For example, the preset Prompt template is: Please fill the following text content: {{table code}} into the corresponding cells according to the following table structure: {{table code}}, while maintaining the HTML format. The system replaces the placeholders {{table code}} with the complete code of the first HTML table and replaces the placeholders {{text to be filled}} with the text content to be filled, forming a complete prompt word that is input into the LLM big model for processing. Through the above embodiment, the effective integration of structured table data and unstructured text content is achieved. The preset Prompt template provides clear processing instructions and contextual constraints, ensuring that the LLM big model can accurately understand the task requirements and generate output results that conform to the format specifications, greatly improving the accuracy and efficiency of table data processing. Step S105: The LLM big model parses the entity-attribute relationship between the header fields of the first HTML table and the text to be filled. Specifically, through the powerful natural language understanding and reasoning capabilities of the LLM big model, deep semantic analysis is performed on the extracted first HTML table and the text to be filled. The LLM big model accurately identifies and extracts the first HTML table... All in the region or The model analyzes the text content of the header fields (such as name and age) within the labels, understanding the attribute concepts represented by each field and their expected data types (such as text, numeric, and date). Simultaneously, the model deeply analyzes the text to be filled, utilizing its Named Entity Recognition (NER), coreference resolution, and relation extraction capabilities to identify the various entities mentioned in the text (such as specific people, places, and events) and the information describing these entities (such as "Zhang San" and "28 years old"). The core step is performing entity-attribute relationship mapping. The model intelligently matches and aligns the entities and information identified in the text to be filled with the attribute categories defined in the header fields, determining which information in the text corresponds to which column in the table, and understanding the attribution relationship between entities and attributes (e.g., determining that "Zhang San" is the value of the name attribute, and "28 years old" is the value of the age attribute). Finally, the LLM model outputs a structured set of mapping relationships, clearly defining which parts of the text each header field (attribute) should extract or derive its corresponding value (entity attribute value).
[0073] In this context, an entity refers to a distinguishable and independently existing object or concept in the text, such as a specific person, organization, or product; an attribute refers to a dimension or category used to describe or define the characteristics of an entity; and an entity-attribute relationship refers to the correspondence between an entity and its specific characteristics, used to indicate that an entity (such as employee Zhang San) possesses a specific value of an attribute (such as age) (e.g., 30 years old).
[0074] For example, if the first HTML table contains header fields such as patient name, symptoms, and diagnosis, and the text to be filled is an outpatient record: Patient Li Si, chief complaint: persistent cough and fever for three days. Upon examination, diagnosed as acute bronchitis. The LLM model will parse out: the entity is Li Si, its symptom attribute is persistent cough and fever for three days, and its diagnosis attribute is acute bronchitis. The model thus establishes an accurate correspondence between the entity Li Si and each header field (attribute).
[0075] Through the above embodiments, the LLM large model acts as a semantic bridge connecting unstructured text and structured tables. By deeply understanding the semantics of text content and table structure, it accurately maps the correspondence between entities and their attributes in the table, transforming vague natural language descriptions into clear structured data associations, and completely solving the ambiguity and limitations of traditional methods in matching entities and attributes.
[0076] Figure 3 This is a flowchart illustrating the process of parsing entity-attribute relationships provided in an embodiment of this application.
[0077] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 3 ,against Figure 1 The step S105 shown can be achieved through... Figure 3 Steps S1051-S1052 are implemented, and will be explained in detail below.
[0078] Step S1051: The semantics of the text to be filled are parsed using the LLM large model to obtain multiple attribute fields.
[0079] Specifically, the LLM (Limited Least Model) in the processor performs lexical, syntactic, and semantic analysis on the input text to be filled, identifying key entities, concepts, and relationships between them. Based on its internally stored general and domain knowledge, the LLM infers and summarizes the dimensions and categories required to describe these entities and concepts. The LLM then transforms these dimensions and categories into standardized attribute fields, each of which clearly represents a specific aspect of the information described in the text. Finally, it outputs a complete and structured set of attribute fields that comprehensively covers the core semantic information of the text to be filled, providing a direct basis for subsequent mapping and filling of the table structure.
[0080] Among them, semantics refers to the meaning, concepts and logical relationships expressed by language; obtaining refers to the result produced after processing and analysis; attribute field refers to the standardized category name used to describe a certain aspect of the characteristics or properties of things, and refers to the data dimension with clear semantics abstracted from the text, such as parsing the age field from "he is 30 years old this year".
[0081] For example, if the text to be filled is a product description: "This is a newly launched smartphone, equipped with the latest flagship chip, 6.7-inch screen, 12GB RAM, 5000mAh battery, and priced at 5999 yuan." After parsing its semantics using the LLM model, multiple attribute fields can be obtained, including: product type, launch status, chip model, screen size, RAM, battery capacity, price, etc., each corresponding to a specific attribute dimension mentioned in the text.
[0082] Through the above embodiments, the LLM large model acts as a semantic decoder from unstructured text to structured data. By deeply understanding the text content, it automatically and intelligently extracts key attribute dimensions, transforming the messy raw text into a clear and orderly list of structured fields. This significantly improves the efficiency and accuracy of information processing, laying a solid foundation for subsequent data entry, knowledge base construction, and data analysis.
[0083] Step S1052: Map each attribute field to the header field to obtain the entity-attribute relationship between the header field and the text to be filled.
[0084] Specifically, the processor precisely matches and associates the multiple attribute fields parsed from the LLM model in step S1051 with the existing header fields in the first HTML table. The two sets of field lists are aligned, and a multi-dimensional comprehensive matching is performed based on string similarity (such as edit distance, word vector cosine similarity), semantic similarity (calculated by the LLM itself or word embedding model), and data type compatibility. For successfully matched field pairs, a mapping relationship is directly established. For fields that cannot be directly matched, the LLM performs semantic reasoning and contextual understanding to determine whether the attribute field may be a synonym, hypernym, hyponym, or a derived attribute that can be easily deduced (such as mapping screen size to size, or mapping selling price to price). In this way, an indirect mapping relationship is established, and finally a complete mapping relationship table is generated, clearly indicating which header field in the first HTML table each attribute field extracted from the text to be filled corresponds to, thereby establishing the correspondence between the information entities in the text to be filled and the table columns (attributes).
[0085] Among them, attribute fields refer to standardized category names parsed from the text to be filled, used to describe the characteristics of entities; mapping refers to the operation process of establishing the correspondence between elements in two different sets; and obtaining refers to producing a clear result after a series of calculations and judgments.
[0086] For example, suppose the header fields contain product name, memory capacity, battery size, and price, while the attribute fields parsed from the text to be populated (This phone has 12GB of memory, a 6000mAh battery, and a price of 5000 yuan) are product type, RAM, battery capacity, and price. We semantically map RAM to memory capacity, battery capacity to battery size, and price to selling price. This establishes entity-attribute relationships in the text: 12GB corresponds to the memory capacity column, 6000mAh to the battery size column, and 5000 yuan to the selling price column.
[0087] Through the above embodiments, the system successfully bridges the semantic attributes extracted from free text with the header fields of pre-extracted structured tables, solving the problem of the difference between the diversity of natural language expression and the standardization of table structure. It accurately anchors unstructured information into a structured data framework, providing a crucial logical basis for the final realization of automated and highly accurate table filling, and greatly reducing the cost of manual intervention and mapping.
[0088] Step S106: Based on the entity-attribute relationship, automatically populate the first HTML table to obtain the second HTML table.
[0089] Specifically, based on the established entity-attribute relationships, the processor will traverse the first HTML table. For each row in the area, the system identifies the data row to be filled based on the row attribute label. Then, for each target cell, the system searches for the matching attribute field in the entity-attribute relationship mapping based on the header field of its column, and locates and extracts the corresponding attribute value from the text to be filled. The processor then fills the extracted text, numerical value, or other data type into the current cell according to the data format requirements defined by the column attribute label. Within the tags, the processor also handles multiple entities or complex relationships that may exist, ensuring that the different attribute values of each entity are correctly filled into the corresponding columns of the same or related rows. Finally, the processor generates a second HTML table that retains all the structure, styles and tags of the original table and whose content has been fully filled.
[0090] Among them, automatic filling refers to the process by which the processor completes data entry without human intervention according to established rules and mapping relationships; the second HTML table refers to the final HTML table result generated after automatic data filling, which contains both complete structure and real data.
[0091] For example, assuming the entity-attribute relationships are already mapped: Zhang San corresponds to the Name field, 28 corresponds to the Age field, and Engineer corresponds to the Job title field. The first HTML table already has corresponding empty cells. The autofill process: Enter Zhang San in the cell under the Name column, 28 in the cell under the Age column, and Engineer in the cell under the Job title column. All the original table structure is preserved, thus generating a complete second HTML table.
[0092] Through the above embodiments, the system realizes a fully automated closed loop from data mapping to data filling, efficiently, accurately, and in a standardized manner transforming unstructured text information into structured tabular data. This not only greatly improves the efficiency and accuracy of data entry and ensures the standardization and uniformity of data format, but also provides a standardized data source that can be directly used for subsequent data processing, display, and analysis.
[0093] Figure 4 This is a flowchart illustrating the process of filling an HTML table according to an embodiment of this application.
[0094] Based on the above embodiments, as an optional embodiment, see [link to embodiment]. Figure 4 ,against Figure 1 The step S106 shown can be achieved through... Figure 4 Steps S1061-S1062 are implemented, and will be explained in detail below.
[0095] Step S1061: Locate the row attribute tags and column attribute tags of the HTML string to be filled in the first HTML table.
[0096] Specifically, the first HTML table is subjected to deep parsing via electronic devices to precisely locate the HTML string regions where content needs to be inserted or modified. The processor parses the entire DOM structure of the first HTML table and identifies all... (Yuki) / (Cell) label; Next, based on the pre-generated row attribute label (e.g., data-row-type=data), iterates and filters all data rows marked as to be filled, excluding header rows, footer rows, and other rows that do not need to be filled. Then, within the target row, based on the column attribute label (e.g., data-column-type=username), it scans and locates the cells corresponding to the specific columns that need to be filled, and the processor accurately obtains the content within the target cells. The start and end positions of the HTML string enclosed by the tag, or the placeholder text that needs to be replaced (such as {{username}}), provide the accurate insertion point for subsequent dynamic content population.
[0097] The HTML string to be filled refers to the HTML code snippet or text content that needs to be inserted, modified, or replaced.
[0098] For example, a row in the first HTML table is marked with A cell in that row is marked with {{email}} The system locates the row by positioning `data-row-type=user-data`, then locates the specific cell within that row by positioning `data-col-type=user-email`, and confirms the position of the HTML string (placeholder) to be filled, `{{email}}`. Through this embodiment, the system can intelligently and accurately navigate complex HTML table structures, quickly locating the target area to be operated on using semantic attribute tags. This lays a solid technical foundation for subsequent automated and accurate content filling, avoiding errors that may arise from positioning based on fixed offsets, and greatly improving the accuracy and efficiency of data filling. Step S1062: Based on the entity-attribute relationship, each attribute field is filled into the corresponding HTML string to be filled, while retaining the row and column attribute tags of the HTML string to be filled, resulting in a second HTML table in HTML format after filling. Specifically, the processor will find the corresponding attribute field value (e.g., Zhang San) for each HTML string to be filled (such as the placeholder `{{name}}` or an empty cell) according to the mapping relationship, and insert or replace the attribute value into the target... Within the HTML string of the tag, ensure that the newly entered content conforms to the cell's formatting requirements; throughout the entire filling process, the system will strictly preserve the original cell elements. or All row attribute tags (such as data-row-type) and column attribute tags (such as data-col-type) carried on the table are used to ensure that the semantic structure and metadata integrity of the table are not compromised. Finally, a second HTML table is generated in which all target cells are filled with real data and all original structure and attribute tags are completely preserved.
[0102] For example, suppose the original content of a cell is The entity-attribute mapping indicates that the value corresponding to 'name' is 'Li Si'. The fill operation will change the cell content to... Li Si Data is filled in, and the important row attribute tags (data-row-type=employee) and column attribute tags (data-col-type=name) are fully preserved. Through the above embodiment, the system successfully and accurately injects unstructured text data into a structured HTML framework, not only achieving content filling but, more importantly, fully preserving all metadata attributes that support the readability, operability, and semantic integrity of the table. Step S107: The second HTML table is input into the position of the table to be filled in the document to be filled, resulting in a filled document. Specifically, the processor can parse the underlying structure of the document to be populated, precisely locate the placeholders for each table to be populated, and then accurately write or replace the data, formatting, and structural information contained in the generated second HTML table into these placeholder positions using specific technical means. For a Word document (.docx), which is essentially a ZIP archive containing a document structure described in XML, the device decompresses the archive, parses the XML DOM, locates specific content controls or custom bookmarks, and then converts or styles the second HTML table into an Open XML format supported by Word (such as...).
[0106]
[0107]
[0108]
[0109] The second HTML table defines a reserved area (element), and then draws the content (text, borders) of the second HTML table to the specified location in the form of PDF instructions, or by embedding a complete PDF form object and filling its fields. For Excel documents (.xlsx), which are also defined by XML, the device uses libraries such as Open XML SDK to locate the specified worksheet and named range or specific cell range, and then maps and fills the two-dimensional data of the second HTML table row by row and column by column into the corresponding cells, while preserving the style of the original HTML table (such as font and background color) as much as possible; no specific restrictions are made here. Regardless of the format, a final document can be generated in which all reserved positions are accurately filled, the format is correct, and the overall document structure is maintained. The filled document refers to the final product generated after all replacement operations, which is a complete document in which reserved placeholders have been replaced with valid content and can be used or distributed directly. Through the above embodiments, the seamless integration of dynamically generated data content and static document templates is achieved. This step automates the final stage of document generation, ensuring the accuracy and efficiency of data output, avoiding errors that may be introduced by manual copying and pasting, and guaranteeing the professionalism and consistency of the final document format. Based on the above embodiment, as an optional embodiment, after inputting the second HTML table into the position of the table to be filled in the document and obtaining the filled document, the method further includes outputting the second HTML table in a user-preset specified format. Specifically, after obtaining the filled document, the processor parses the user-preset specified format requirements (such as PDF, Excel, CSV, Word, or image formats) through the interface or configuration file. According to the specifications of the target format, the processor adaptively converts the code structure and style of the second HTML table. For example, when converting to PDF, pagination and font embedding need to be handled; when converting to Excel, [the following needs to be done].
[0110]
[0111] The structure is mapped to worksheets and cells. When converting to CSV, all HTML tags need to be removed, and plain text data should be retained, separated by commas. Then, the appropriate format conversion library or API (such as wkhtmltopdf for PDF conversion, Apache POI for Excel conversion) is called to render the processed table data into a binary or text file conforming to the target format specification. Finally, the processor can output the generated file to the user-specified storage path or provide it directly to the user for download through an interactive interface. The specified format refers to the type and specification of the output file explicitly required by the user, such as a PDF document, XLSX spreadsheet, CSV comma-separated value file, DOCX document, or PNG image, etc., a specific and standardized file format. For example, if the user presets the specified format to PDF, the system will convert the second HTML table (e.g., ...) into a CSV file. Sales data ... The table, along with its CSS styles, is sent to the PDF rendering engine to generate a printable PDF document containing the table and having a fixed layout. If the specified format is CSV, the system will extract the text content of all cells in the table and generate a plain text file similar to Name, Age\nZhang San,28\n.
[0112] Through the above embodiments, the system achieves seamless integration of data processing results with users' actual application scenarios. By converting a unified HTML data source into multiple common formats as needed, the system greatly enhances data usability and portability, meets the data usage needs of different users on different platforms (such as office software, email attachments, and reporting systems), and improves the practicality and user experience of the entire process.
[0113] Figure 5 This is another flowchart illustrating an LLM-based automatic form filling method provided in an embodiment of this application.
[0114] Based on the above embodiments, as an optional embodiment, this invention discloses an LLM-based automatic table filling method, wherein the document to be filled includes multiple tables to be filled, such as... Figure 5 As shown, it includes the following steps: Step S201: Parse each table to be filled and convert each table to HTML format to obtain multiple first HTML tables.
[0115] Specifically, the processor will identify and read all the tables to be filled, and parse each table independently, that is, analyze its original structure and content, including identifying the number of rows and columns, cell merging status (rowspan / colspan), border style, text content and format (font, size, color); then, based on the parsing results, the structure and content data of each original table will be converted into corresponding standard HTML code snippets according to HTML syntax specifications, that is, generating multiple independent and structurally complete first HTML tables; each generated first HTML table accurately retains the visual layout and data content of its corresponding original table.
[0116] For example, if the input includes a sales data table and an employee information table from a Word document, the system will parse these two original tables, which have different structures and contents, and generate a corresponding table for the sales data table. ... Product A ... The first HTML table in the code generates another table containing employee information. ... Zhang San ... The code creates the first HTML table, resulting in two separate first HTML tables.
[0117] Through the above embodiments, the system achieves unified and standardized processing of heterogeneous table data, efficiently converting various original tables into a consistent, machine-readable HTML format, laying a unified data foundation for the subsequent batch and automated processing of all tables (such as data filling and format adjustment), and significantly improving processing efficiency and system scalability.
[0118] Step S202: Combine each first HTML table, the text to be filled, and the preset Prompt template and input them into the LLM large model.
[0119] Specifically, the processor batch integrates and preprocesses multiple first HTML tables generated in the preprocessing stage, uniform text to be filled, and preset instruction templates. It then iterates through each set of first HTML tables, processing the complete HTML code of each table (including...) , , Extract all tags and attributes, and obtain the common text to be filled. Then, for each first HTML table, the system fills the HTML code and text to be filled into the specified placeholder positions (e.g., {{TABLE}} and {{TEXT}}) in the template according to the framework defined by the preset Prompt template, thereby generating an independent and complete prompt for each table. The processor inputs these multiple constructed prompts into the LLM large model in sequence or in parallel through batch calling or serialization, requesting the model to process the corresponding table and text based on the instructions of each prompt.
[0120] Step S203: Analyze the entity-attribute relationship between the header fields and the text to be filled in each first HTML table using the LLM large model.
[0121] Specifically, the LLM large model will process each of the first HTML tables sequentially according to the specific process in step S105, accurately identifying and extracting each table. All in the region The LLM model analyzes the text content of the header fields within the tags (such as name, department, sales amount), understands the attribute concept and expected data type represented by each field in its respective table, identifies the various entities mentioned in the text (such as different people, projects, products) and the information describing these entities, identifies the numerous entities and information in the text to be filled, intelligently matches and aligns them with the attribute categories defined in the header fields of each first HTML table, determines which piece of information in the text corresponds to which column field in which specific table, and understands the complex attribution relationships between different entities and different table attributes. The LLM model outputs a structured set of mapping relationships, clarifying which parts of the text to be filled should be used to extract or derive the corresponding value (entity attribute value) for each header field (attribute) in each table.
[0122] For example, suppose there are two HTML tables: one with headers of [Employee ID, Name, Department], and the other with headers of [Project ID, Project Name, Person in Charge, Budget]. The text to be filled is: Employee E1001 (Zhang San) belongs to the Marketing Department, and the project he is responsible for, P201 (New Brand Promotion), has a budget of 500,000 yuan. The LLM model will parse out: the entity Zhang San and its attributes Employee ID: E1001, Name: Zhang San, Department: Marketing Department, corresponding to the first table; and the entity New Brand Promotion Project and its attributes Project ID: P201, Project Name: New Brand Promotion, Person in Charge: Zhang San, Budget: 500,000 yuan, corresponding to the second table.
[0123] Through the above embodiments, the LLM large model acts as a semantic scheduling center connecting a single unstructured text with multiple structured tables. By deeply understanding the semantics of text content and different table structures, it accurately constructs the correspondence between multiple sets of entities and their attributes in different tables, solving the complexity problem of multi-table data extraction and association.
[0124] Step S204: Based on the entity-attribute relationship, automatically populate each first HTML table to obtain multiple second HTML tables.
[0125] Specifically, referring to step S106, the processor parses the structure of the first HTML table, identifies the attribute fields represented by its header (or specific attribute tags), and maps and matches them with attributes in the relational data model. Subsequently, based on the mapping relationship, the system retrieves the attribute values corresponding to the target entity from the data source (such as a database, knowledge graph, or JSON object) and fills them into the table according to the correct row and column coordinates. Within the tag, each first HTML table is populated independently and in parallel based on its corresponding entity data, outputting as a series of second HTML tables with complete data and standardized format.
[0126] Step S205: Input each of the second HTML tables into the positions of the tables to be filled in the document to obtain the filled document.
[0127] Specifically, referring to step S107, the processor inserts each parsed second HTML table into the pre-marked or specified table areas in the document to be filled, according to their corresponding position information, thereby generating a complete document where all tables are filled. Simultaneously, it is necessary to ensure that each second HTML table logically corresponds accurately to its target table position. The processor reads the template structure of the document to be filled, locates the placeholders (e.g., specific tags, bookmarks, or attribute identifiers) for each table, and then processes the complete code of the corresponding second HTML table (including...). 、 、 The tags (including their content, style, and structure information) are replaced at the location of the placeholder, and the output is a completed document containing all the original document content and the newly entered table data, requiring no further manual intervention.
[0128] For example, suppose the document to be populated is a Markdown report template that contains multiple tags as<!--table_1--> ,<!--table_2--> The annotation placeholders, each representing a position in the table to be populated, result in two second HTML tables: one representing sales data. Product A 100 Another indicator of inventory data Product B 50 The device replaces the first HTML table code with the corresponding table code based on the mapping relationship (e.g., sales data corresponds to table_1, and inventory data corresponds to table_2).<!--table_1--> Replace the placeholder with the code for the second HTML table.<!--table_2--> The placeholders will eventually generate a complete Markdown document containing these two populated tables.
[0129] The above embodiments have automated the process of filling in document tables, avoiding the errors and inefficiencies that may result from manually copying and pasting table data.
[0130] Based on the above embodiments, as an optional embodiment, if the table to be filled is a cross-page table or a nested table, then when converting the table to be filled into HTML format, the cross-page structure or nested structure of the table to be filled is identified and recorded to obtain a first HTML table that retains the cross-page structure or nested structure.
[0131] Specifically, when the processor detects a complex structure in the table to be filled, such as spanning multiple pages or nested cells, it initiates a specific conversion and parsing process. First, it performs a deep analysis of the overall layout and cell relationships of the table, rather than simply performing format conversion. For spanning multiple pages, the device identifies the break points at page breaks, analyzes the continuity of the table header, footer, and body across consecutive pages, and records this structural information as metadata. For nested tables, the device recursively parses the child table cells within the main table, precisely defining the boundaries of the child tables and their hierarchy with the parent table cells. Subsequently, when generating the first HTML table, it not only outputs the standard...
[0132]
[0133] 、 、 The basic table framework is built using tags such as `data-cross-page=header-main`, and further enhanced by adding custom HTML attributes (e.g., `data-cross-page=header-main`), specific CSS classes (e.g., `nested-table-container`), or industry-standard structured tags (e.g., `...`). 、 This is used to explicitly encode and store these identified cross-page or nested relationships. The resulting first HTML table is a composite containing the original data content, basic styles, and crucial structural semantic information, ensuring that its complex structure is preserved and reproduced in subsequent processing. A cross-page table to be filled refers to a single logical table whose content exceeds the capacity of a single page and is split across two or more consecutive pages, used to represent a physically disconnected but logically continuous set of data. A nested table to be filled refers to a complex structure where one or more cells of a main table contain another complete sub-table, used to represent hierarchical relationships or more refined classifications of data. A cross-page structure refers to the layout information in a cross-page table regarding which rows belong to the header, footer, body, and where the page breaks. A nested structure refers to the hierarchical relationship information of inclusion and being included between a sub-table and its parent table cells. For example, suppose a Word document contains a large report table with the first two rows as headers, and the table content extends from the first page to the second page. Electronic devices will recognize this table as a cross-page table during conversion. It marks the first two rows as the table header (using...) (Labels), and place the watch body portion on the first page and the watch body portion continuing on the second page into different... In the tag, it is also the second one. Add an attribute like `data-page-break=2` to record pagination information. The resulting first HTML table may appear as a long table in the browser, but its HTML code will retain the original structure information at the pagination points. For example, if a cell contains a mini-calendar sub-table, the device will generate a new table for that cell during conversion. Tags, and then build a complete system within them.
[0134]
[0135] Figure 6
[0136] Figure 6
[0137]
[0138]
[0139]
[0140]
[0141]
[0142]
[0143]
[0144]
[0145] Figure 7
[0146] Figure 7
[0147]
[0148]
[0149]
[0150]
[0151] Figure 7
[0152] Figure 7
[0153]
[0154] The `` tag is used to represent nested sub-tables, thus faithfully reproducing the nesting relationship in the HTML structure. Through the above embodiments, the complex structure of the table is proactively analyzed and coded during the conversion stage, laying a solid foundation for subsequent data filling and document generation. This effectively avoids common problems caused by ignoring structural information, such as missing headers in cross-page tables after filling, pagination errors, or damaged nested tables and chaotic hierarchical relationships. This ensures that the final generated document highly replicates the design intent and layout of the original template, significantly improving the accuracy and professionalism of automated document processing. The diagram below illustrates the structure of an LLM-based automatic table filling device provided in this application embodiment. Referring to this, an LLM-based automatic table filling device 300 provided in this application embodiment includes: a table to be filled acquisition module 301, a text to be filled acquisition module 302, a format conversion module 303, a data input module 304, a data mapping module 305, a table filling module 306, and a document filling module 307. The module 301 for obtaining the table to be filled in the document and recording its position is as follows: The module 302 for obtaining the text to be filled input by the user; the format conversion module 303 for parsing the table to be filled and converting it to HTML format to obtain a first HTML table; the data input module 304 for concatenating the first HTML table, the text to be filled, and a preset Prompt template and inputting them into the LLM model; the data mapping module 305 for parsing the entity-attribute relationship between the header fields of the first HTML table and the text to be filled through the LLM model; the table filling module 306 for automatically filling the first HTML table based on the entity-attribute relationship to obtain a second HTML table; and the document filling module 307 for inputting the second HTML table into the position of the table to be filled in the document to obtain a filled document. Based on the above embodiments, the format conversion module 303 is further used to identify cell information, table structure, header information, and header fields in the table to be filled; generate corresponding row attribute tags and column attribute tags based on the cell information; generate HTML format header tags based on the header information; and generate a first HTML table based on the row attribute tags, column attribute tags, header tags, and header fields. Based on the above embodiments, the data mapping module 305 is further used to parse the semantics of the text to be filled using an LLM large model to obtain multiple attribute fields; and map each attribute field to the header fields to obtain the entity-attribute relationship between the header fields and the text to be filled.Based on the above embodiments, the table filling module 306 is further configured to locate the row attribute tags and column attribute tags of the HTML string to be filled in the first HTML table; fill each attribute field into the corresponding HTML string to be filled according to the entity-attribute relationship, and retain the row attribute tags and column attribute tags of the HTML string to be filled, thereby obtaining a second HTML table in HTML format after filling. Based on the above embodiments, the above device 300 further includes: an output table module 308, configured to output the second HTML table in a user-preset specified format after the second HTML table is input into the position of the table to be filled in the document to be filled and the document is filled. Based on the above embodiments, when the document to be filled in the device 300 includes multiple tables to be filled, the format conversion module 303 is used to parse each table to be filled and convert each table to be filled into HTML format to obtain multiple first HTML tables; the data input module 304 is used to concatenate each first HTML table, the text to be filled, and a preset Prompt template and input them into the LLM large model; the data mapping module 305 is used to parse the entity-attribute relationship between the header fields of each first HTML table and the text to be filled through the LLM large model; the table filling module 306 is used to automatically fill each first HTML table based on the entity-attribute relationship to obtain multiple second HTML tables; the document filling module 307 is used to input each second HTML table into the position of each table to be filled in the document to be filled to obtain a filled document. Based on the above embodiments, if the table to be filled is a cross-page table or a nested table, when converting the table to be filled into HTML format, the format conversion module 303 is also used to identify and record the cross-page structure or nested structure of the table to be filled to obtain a first HTML table that retains the cross-page structure or nested structure. It should be noted that the above embodiments of the device are only illustrated by the division of the above functional modules when implementing their functions. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here. This is a structural schematic diagram of the electronic device provided in the embodiments of this application. The embodiments of this application provide an electronic device, as shown, the electronic device 400 may include: at least one processor 401, at least one network interface 404, a user interface 403, a memory 405, and at least one communication bus 402. The communication bus 402 is used to realize the connection and communication between these components. The user interface 403 may include a display screen and a camera; optionally, the user interface 403 may also include a standard wired interface and a wireless interface.The network interface 404 may optionally include a standard wired interface or a wireless interface (such as a Wi-Fi interface). The processor 401 may include one or more processing cores. The processor 401 connects to various parts within the electronic device 400 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 405, and by calling data stored in the memory 405. Optionally, the processor 401 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 401 may integrate one or more of the following: a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), and a modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the content to be displayed on the screen; and the modem handles wireless communication. It is understood that the aforementioned modem may not be integrated into the processor 401, but may be implemented as a separate chip. The memory 405 may include random access memory (RAM) or read-only memory. Optionally, the memory 405 may include a non-transitory computer-readable storage medium. The memory 405 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 405 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), instructions for implementing the various method embodiments described above, etc.; the data storage area may store data involved in the various method embodiments described above, etc. Optionally, the memory 405 may also be at least one storage device located remotely from the aforementioned processor 401. As shown, the memory 405, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and an application program for an LLM-based auto-fill form method.In the illustrated electronic device 400, the user interface 403 is mainly used to provide an input interface for the user and to acquire user input data; while the processor 401 can be used to call an application program stored in the memory 405 for an LLM-based autofill form method. When executed by one or more processors, the electronic device executes the LLM-based autofill form method described in the embodiments of this application. Embodiments of this application provide a computer-readable storage medium storing instructions. When executed by one or more processors, it causes the execution of the LLM-based autofill form method provided in the embodiments of this application. The above descriptions are merely exemplary embodiments of this disclosure and should not be construed as limiting the scope of this disclosure. All equivalent changes and modifications made in accordance with the teachings of this disclosure are still within the scope of this disclosure. Those skilled in the art will readily conceive of other embodiments of this disclosure upon considering the specification and the disclosure of practical truth. This application is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary technical means in the art not described in this disclosure. The specification and embodiments are considered exemplary only, and the scope and spirit of this disclosure are defined by the claims. < / w:tbl>
Claims
1. An LLM-based method for automatically filling in tables, characterized in that, include: Obtain the table to be filled in the document to be filled, and record the position of the table to be filled; Get the text to be filled in by the user input; The table to be filled is parsed and converted into HTML format to obtain the first HTML table; The first HTML table, the text to be filled, and the preset Prompt template are concatenated and input into the LLM large model; The entity-attribute relationship between the header fields of the first HTML table and the text to be filled is analyzed using the LLM large model. Based on the entity-attribute relationship, the first HTML table is automatically populated to obtain the second HTML table; The second HTML table is entered into the position of the table to be filled in the document to obtain the filled document.
2. The method according to claim 1, characterized in that, The process of parsing the table to be filled and converting it into HTML format to obtain a first HTML table includes: Identify the cell information, table structure, header information, and header fields in the table to be filled; Generate corresponding row attribute labels and column attribute labels based on the cell information; The HTML-formatted header tags are generated based on the header information; The first HTML table is generated based on the row attribute tags, the column attribute tags, the table header tags, and the table header fields.
3. The method according to claim 2, characterized in that, The step of parsing the entity-attribute relationship between the header fields of the first HTML table and the text to be filled using the LLM large model includes: The semantics of the text to be filled are analyzed using the LLM large model to obtain multiple attribute fields; Map each attribute field to the header field to obtain the entity-attribute relationship between the header field and the text to be filled.
4. The method according to claim 3, characterized in that, The process of automatically filling the first HTML table based on the entity-attribute relationship to obtain a second HTML table in HTML format includes: Locate the row attribute tags and column attribute tags of the HTML string to be filled in the first HTML table; According to the entity-attribute relationship, each attribute field is filled into the corresponding HTML string to be filled, and the row attribute tags and column attribute tags of the HTML string to be filled are retained to obtain the second HTML table in HTML format after filling.
5. The method according to claim 1, characterized in that, After inputting the second HTML table into the position of the table to be filled in the document to be filled, and obtaining the filled document, the method further includes outputting the second HTML table in the user-preset specified format.
6. The method according to any one of claims 1-5, characterized in that, The document to be filled includes multiple tables to be filled, and the method includes: Parse each of the tables to be filled and convert each of the tables to be filled into HTML format to obtain multiple first HTML tables; Each of the first HTML tables, the text to be filled, and the preset Prompt template are concatenated and input into the LLM large model; The entity-attribute relationship between the header fields of each of the first HTML tables and the text to be filled is analyzed using the LLM large model. Based on the entity-attribute relationship, each of the first HTML tables is automatically populated to obtain multiple second HTML tables; Each of the second HTML tables is entered into the corresponding position of the table to be filled in the document to obtain the filled document.
7. The method according to any one of claims 1-5, characterized in that, If the table to be filled is a cross-page table or a nested table, then when converting the table to be filled into the HTML format, the cross-page structure or nested structure of the table to be filled is identified and recorded, and the first HTML table retaining the cross-page structure or the nested structure is obtained.
8. An LLM-based automatic form filling device, characterized in that, include: The module for obtaining tables to be filled is used to obtain tables to be filled in the document to be filled and record the position of the tables to be filled. The text to be filled module is used to obtain the text to be filled input by the user; The format conversion module is used to parse the table to be filled and convert it into HTML format to obtain the first HTML table. The data input module is used to concatenate the first HTML table, the text to be filled, and the preset Prompt template and input them into the LLM large model; The data mapping module is used to parse the entity-attribute relationship between the header fields of the first HTML table and the text to be filled through the LLM large model; The table filling module is used to automatically fill the first HTML table based on the entity-attribute relationship to obtain the second HTML table; The document filling module is used to input the second HTML table into the position of the table to be filled in the document to obtain a filled document.
9. An electronic device, characterized in that, The device includes a memory, a processor, a user interface, and a network interface. The memory is used to store instructions. The user interface and the network interface are both used to communicate with other devices. The processor is used to execute the instructions stored in the memory to cause the electronic device to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed, perform the method as described in any one of claims 1 to 7.