Method and system for processing table included in prompt for large language model
The method addresses the performance variability of large language models with complex tables by converting table content into standardized forms, enhancing the models' ability to process and retrieve information from these tables.
Patent Information
- Application Number
- JP2024194737
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-11-07
- Filing Date
- 2024-11-06
- Publication Date
- 2025-06-10
AI Technical Summary
Large language models (LLMs) face significant performance variability when processing tables, particularly those with merged cells, due to differences in how table information is input and represented.
A method and system that process tables by confirming the document format, recognizing the table, converting its content into either markdown or natural language form based on the presence of merged cells and text length, and storing it for use in prompts or table searches within the LLM's Retrieval Augmented Generation (RAG) system.
This approach enhances the performance and consistency of LLMs when dealing with complex tables by standardizing the representation of table data, thereby improving the accuracy of answer retrieval and generation.
Smart Images

Figure 2025087598000001_ABST
Abstract
Description
Technical Field
[0001] The following description relates to a method and system for processing a table of prompts for large language models.
Background Art
[0002] A large language model or large language model (LLM) is a type of artificial intelligence trained on a large-scale text data set to generate responses similar to those of humans for natural language input, and is a language model composed of an artificial neural network with a huge number of parameters (usually billions of weights or more). Such an LLM can learn with a significant amount of unlabeled text using self-supervised learning or semi-self-supervised learning. It can learn with a significant amount of unlabeled text using self-supervised learning or semi-self-supervised learning.
[0003] Such an LLM has very excellent Retrieval Augmented Generation (RAG) ability to input a single document as a prompt and generate an answer. However, generally, a document may contain non-text data such as graphs and tables. In particular, the performance of the LLM can vary greatly depending on how the table information included in the prompt is input to the LLM. Also, it is necessary to find out whether the answer to a specific question is in the table within the document using the RAG retriever, but in this case as well, the performance of the retriever varies greatly depending on how the table is represented. In particular, in the case of a complex table containing merged cells, it may have a very significant impact on the performance of the LLM and the retriever. —(Retriever), but in this case as well, the performance of the retriever varies greatly depending on how the table is represented. By In particular, in the case of a complex table containing merged cells, it may have a very significant impact on the performance of the LLM and the retriever. .
Prior Art Documents
Patent Documents
[0004]
Patent Document 1
Summary of the Invention
Problems to be Solved by the Invention
[0005] Provided are a method and a system for processing a table of prompts for a large language model.
Means for Solving the Problems
[0006] In a table processing method of a computer device including at least one processor, the at least one processor confirms a document format of a document used for a prompt for a large language model (LLM); the at least one processor recognizes a table included in the document according to the document format; the at least one processor converts the content of the recognized table into a markdown form or a natural language form; and the at least one processor stores the content of the converted table in a storage for use in the prompt or for table search of a retriever of Retrieval Augmented Generation (RAG). A table processing method is provided including the above steps.
[0007] According to one aspect, the converting step may be characterized by converting the content of the recognized table into a markdown form or a natural language form based on at least one of whether there is a merged cell coupled to the recognized table and the overall length of the text included in the recognized table.
[0008] According to another aspect, when the recognized table does not include merged cells and the total length of the text included in the recognized table is less than a preset reference value, the converting step converts the content of the recognized table into a markdown form, and when the recognized table includes merged cells or the total length is greater than or equal to the preset reference value, the converting step converts the content of the recognized table into a natural language form.
[0009] According to still another aspect, when the converting step converts the content of the recognized table into a natural language form, the converting step may include: extracting the header of the table; determining the reading direction of the table; and generating natural language by reading the header and the values of the table row by row according to the reading direction.
[0010] According to still another aspect, the step of determining the reading direction of the table may determine the reading direction as one of the column-based direction and the row-based direction of the table.
[0011] According to still another aspect, the step of checking the document format may check the document format through the file extension corresponding to the document.
[0012] According to another aspect, the document format may be classified into at least one of a DOCX file format, an Excel (Excel) file format, and a PDF (Portable Document Format) file format.
[0013] According to another aspect, the step of recognizing the table includes, when the document format is a PDF file format, detecting the area where the table exists through an artificial intelligence model to detect the table; when the document format is a DOCX file format, using the information on the table structure included in the DOCX file to recognize the table; and when the document format is an Excel file format, converting the document into an image and detecting the area where the table exists in the converted image to detect the table. This can be characterized by including these steps. When it is a DOCX file format, using the information on the table structure included in the DOCX file to recognize the table ; and when the document format is an Excel file format, converting the document into an image and detecting the area where the table exists in the converted image to detect the table. This can be characterized by including these steps.
[0014] Provided is a computer program stored in a computer-readable recording medium for coupling with a computer device to cause the computer device to execute the method.
[0015] Provided is a computer-readable recording medium on which a program for causing a computer device to execute the method is recorded.
[0016] Including at least one processor implemented to execute instructions readable by a computer device, and by the at least one processor, confirming the document format of the document used in the prompt of a large language model (LLM), recognizing the table included in the document according to the document format, converting the content of the recognized table into a markdown format or a natural language format, and storing the content of the converted table in storage for use in the prompt or for table search of a retriever of RAG (Retrieval Augmented Generation). A computer device is provided characterized by this. -ver (retriever) for use in table search. A computer device is provided characterized by this.
Advantages of the Invention
[0017] A method and system for processing a table of prompts for a large language model can be provided.
Brief Description of Drawings
[0018]
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Figure 8
Figure 9
Figure 10
Modes for Carrying Out the Invention
[0019] Hereinafter, embodiments will be described in detail with reference to the accompanying drawings.
[0020] The spreadsheet processing system according to an embodiment of the present invention can be implemented by at least one computer device. At this time, a computer program according to an embodiment of the present invention can be installed and driven in the computer device that implements the spreadsheet processing system, and the computer device can perform the spreadsheet processing method according to the embodiment of the present invention according to the control of the driven computer program. The above-mentioned computer program can be stored in a computer-readable recording medium that is combined with the computer device to cause the computer to execute the spreadsheet processing method. When this is the case, a computer program according to an embodiment of the present invention can be installed and driven in the computer device that implements the spreadsheet processing system, and the computer device can perform the spreadsheet processing method according to the embodiment of the present invention according to the control of the driven computer program. The above-mentioned computer program can be stored in a computer-readable recording medium that is combined with the computer device to cause the computer to execute the spreadsheet processing method.
[0021] FIG. 1 is a drawing showing an example of a network environment according to an embodiment of the present invention. The network environment of FIG. 1 shows an example including a plurality of electronic devices (110, 120, 130, 140), a plurality of servers (150, 160), and a network (170). Such FIG. 1 is an example for explaining the invention, and the number of electronic devices and the number of servers are not limited as in FIG. 1.
[0022] The plurality of electronic devices (110, 120, 130, 140) can be fixed terminals or mobile terminals realized by a computer system. Examples of the plurality of electronic devices (110, 120, 130, 140) include smartphones, mobile phones, navigation devices, computers, notebook computers, digital broadcast terminals, PDAs (Personal Digital Assistants), PMPs (Portable Multimedia Players), tablet PCs, game consoles, wearable devices, IoT (internet of things) devices, VR (virtual reality) devices, AR (augmented reality) devices, and the like. As an example, in FIG. 1, the shape of a smartphone is shown as an example of the electronic device (110), but in the embodiment of the present invention, the electronic device (110) is substantially When this is the case, a computer program according to an embodiment of the present invention can be installed and driven in the computer device that implements the spreadsheet processing system, and the computer device can perform the spreadsheet processing method according to the embodiment of the present invention according to the control of the driven computer program. The above-mentioned computer program can be stored in a computer-readable recording medium that is combined with the computer device to cause the computer to execute the spreadsheet processing method. For example, in FIG. 1, the shape of a smartphone is shown as an example of the electronic device (110), but in the embodiment of the present invention, the electronic device (110) is substantially shown as having the shape of a smartphone, but in the embodiments of the present invention, the electronic device (110) is substantially can communicate with other electronic devices (120, 1 30, 140) and / or servers (150, 160) through a network (170) using a wireless or wired communication method. It can mean one of various physical computer systems.
[0023] The communication method is not limited, and it can utilize communication networks that the network (170) can include (for example, mobile communication networks, wired Internet, wireless Internet, broadcast networks, satellite networks, etc.). Not only communication methods but also short - range wireless communication between devices can be included. For example, the network (170) can include one or more arbitrary networks among networks such as PAN (personal area network), LAN (local area network), CAN (campus area network), MAN (metropolitan area network), WAN (wide area network), BBN (broadband network), and the Internet. Also, the network (170) can include any one or more of network topologies including bus network, star network, ring network, mesh network, star - bus network, tree or hierarchical network, etc., but is not limited thereto.
[0024] Each of the servers (150, 160) communicates with a plurality of electronic devices (110, 120, 130, 140) through the network (170) and can be realized by a computer device or a plurality of computer devices that provide commands, codes, files, contents, services, etc. For example, the server (150) provides a first service to a plurality of electronic devices (110, 120, 130, 140) connected through the network (170). It can be a system that provides a first service and can also be a system that provides a second service to a plurality of electronic devices (110, 120, 130, 140) connected through a network (170) by a server (160). . As a more specific example, the server (150) can provide a service (such as a search service, for example) targeted by the application as a first service to a plurality of electronic devices (110, 120, 130, 140) through an application as a computer program installed and driven on the plurality of electronic devices (110, 120, 130, 140). Another example, the server (160) can provide, as a second service, a service that distributes files for installation and driving of the above-described application to a plurality of electronic devices (110, 120, 130, 140).
[0025] FIG. 2 is a block diagram showing an example of a computer device according to an embodiment of the present invention. Each of the plurality of electronic devices (110, 120, 130, 140) and each of the servers (150, 160) described above can be implemented by the computer device (200) shown through FIG. 2.
[0026] Such a computer device (200) can include, as shown in FIG. 2, a memory (210), a processor (220), a communication interface (230), and an input / output interface (240). The memory (210) can include, as a computer-readable recording medium, a random access memory (RAM), a read only memory (ROM), and a permanent mass storage device such as a disk drive. Here, non-volatile mass storage devices such as ROM and disk drive are separate permanent devices distinct from the memory (210). It may also be included in the computer device (200) as a long-term storage device. Also, the memory (210) may store an operating system and at least one program code. Such software components can be loaded into the memory (210) from a computer-readable recording medium other than the memory (210). Such other computer-readable recording media can include computer-readable recording media such as floppy drives, disks, tapes, DVD / CD-ROM drives, memory cards, etc. In other embodiments, the software components may also be loaded into the memory (210) through a communication interface (230) that is not a computer-readable recording medium. For example, the software components may be based on a computer program installed by a file received through the network (170), and can be loaded into the memory (210) of the computer device (200).
[0027] The processor (220) can be configured to process the instructions of the computer program by performing basic arithmetic, logic, and input / output operations. The instructions can be provided to the processor (220) by the memory (210) or the communication interface (230). For example, the processor (220) can be configured to execute instructions received according to the program code stored in a recording device such as the memory (210).
[0028] The communication interface (230) can provide a function for the computer device (200) to communicate with other devices (e.g., the aforementioned storage device) through the network (170). For example, the processor (220) of the computer device (200) accesses a recording device such as the memory (210). Requests, instructions, data, files, etc. generated according to the program code stored in [memory] can be transmitted to other devices through the network (170) under the control of the communication interface (230). Conversely, signals, instructions, data, files, etc. from other devices can be received by the computer device (200) through the communication interface (230) of the computer device (200) via the network (170). Signals, instructions, data, etc. received through the communication interface (230) can be transmitted to the processor (220) and the memory (210), and files, etc. can be stored in a storage medium (the aforementioned permanent storage device) that the computer device (200) can further include. The input / output interface (240) can be means for interfacing with the input / output device (250). For example, the input device can include devices such as a microphone, keyboard, or mouse, and the output device can include devices such as a display and speaker. As another example, the input / output interface (240) can also be means for interfacing with a device in which functions for input and output are integrated into one, such as a touch screen. The input / output device (250) can also be configured as one device with the computer device (200).
[0029] In other embodiments, the computer device (200) can also include fewer or more components than the components in FIG. 2. However, there is no need to clearly illustrate most of the prior art components. For example, the computer device (200) can be implemented to include at least a part of the above-described input / output device (250), or can further include other components such as a transceiver
[0030] In other embodiments, the computer device (200) can also include fewer or more components than the components in FIG. 2. However, there is no need to clearly illustrate most of the prior art components. For example, the computer device (200) can be implemented to include at least a part of the above-described input / output device (250), or can further include other components such as a transceiver , a database, etc.
[0031] FIG. 3 illustrates an example of a schematic state of a table processing system in an embodiment of the present invention. The following is the drawing. The table processing system (300) according to the embodiment of FIG. 3 can include a table processing unit (310) and a storage unit (320). The table processing system (300) can input a document (330) and convert the content of the table included in the input document (330) through the table processing unit (310) into a Markdown form or a natural language form, and can store the document (330) including the converted table content in the storage unit (320). Thereafter, the document (330) stored in the storage unit (320) can be utilized as a prompt for the LLM or can be utilized by a retriever to determine whether the answer to a question exists inside the table. According to an embodiment, only the content of the converted table may be stored in the storage unit (320).
[0032] Herein, the document can have various document formats such as DOCX file format, Excel file format, PDF (Portable Document Format) file format, etc. Therefore, tables can be processed in different ways for each document format.
[0033] FIG. 4 is a drawing illustrating an example of a process of processing a table included in a document in PDF file format in an embodiment of the present invention. In a PDF, information on which point on the document is a table does not exist separately in the layout system. A document in PDF file format only draws a table with the positions of characters and lines. Therefore, a separate process for detecting the table is required. In the upload (410) process, the PDF file is sent to the table processing system (300) described above. Therefore, a separate process for detecting the table is required.
[0034] The upload (Upload, 410) process sends the PDF file to the table processing system (300) described above. An example of the process of uploading a document in aル format is shown. Here, the table processing unit (310) included in the table processing system (300) can check the extension of the file constituting the document to confirm the document format of the document to be processed. In the embodiment of FIG. 4, it is assumed that the document format is the PDF file format. The table processing unit (310) includes handlers for processing the tables included in the document for each document format, such as the PDF Handler (421), docx Handler (422), and excel Handler (423) shown in FIG. 4. This can be done. Once the document format is confirmed, the handler corresponding to the confirmed document format can process the subsequent process. The embodiment of FIG. 4 is an example of processing a document in the PDF file format, and the subsequent process can be processed by the PDF handler (421).
[0035] The Split page (430) process is an example of the process in which the PDF handler (421) splits the document page by page, and the subsequent process can be processed for each split page. The subsequent process can be processed for each split page.
[0036] The Make preview (440) process shows an example in which the PDF handler (421) creates a preview for each of the split pages. An example of creating a preview for each split page is shown.
[0037] The Table detection (450) process is an example of the process in which the PDF handler (421) detects the part where the table exists on the split page because there is no information about the presence or absence and position of the table on the document in the PDF file format as described above. At this time, the detection of the part where the table exists can be performed using an artificial intelligence model (for example, a Table Detection Model). Identifying on an image using an artificial intelligence model Since there is no information about the presence or absence and position of the table on the document in the PDF file format as described above, it can be an example of the process for the PDF handler (421) to detect the part where the table exists on the split page. At this time, the detection of the part where the table exists can be performed using an artificial intelligence model (for example, a table detection model). Using an artificial intelligence model to identify a specific Since the technology for detecting objects is already well known, a detailed description thereof will be omitted.
[0038] Determining the presence of a simple table (460) is done by the PDF handler (421) determining whether a detected table is a simple Here, a simple table is one that does not have any merged cells and contains many texts. A simple table may refer to a table in which the total length of text contained therein is less than a reference value. Conversely, a complex table may refer to a table in which merged cells are included or the total length of the text contained therein is equal to or greater than a reference value. In this case, determining whether or not there is a simple table may be performed using an artificial intelligence model (for example, a table classification model). Technology for classifying specific objects in an image using an artificial intelligence model is already well known, so a detailed description will be omitted.
[0039] Handle as markdown (470) is a simple text handler for the PDF handler (421). In this case, a document including the contents of the table converted into the Markdown format may be stored in the storage (320). can.
[0040] The header detection process (480) is a complex process that the PDF handler (421) detects. It can be an example of the process of detecting the header of a table (e.g., the title row) in a table. Such header detection can be performed by an artificial intelligence model (e.g., Header Detection Model) trained to detect the header of a table. Also, the PDF handler (421) can determine the reading direction of the table (row-based or column-based). At this time, it is based on the assumption that the values in the reading direction of the table are composed of different values from each other, and the direction perpendicular to the reading direction is composed of similar values. The process of handling as natural language (490) can be an example of the process of the PDF handler (421) reading the header and the values of the table line by line according to the reading direction of the table and generating natural language. At this time, the natural language can be generated according to preset rules or can also be generated through an LLM.
[0041] Figure 5 is a drawing illustrating an example of a complex table in an embodiment of the present invention. Figure 5 shows an example of a table classified as a complex table including merged cells. For such a complex table, the PDF handler (421) can extract the header using a header detection model. In the table of Figure 5, the headers are "Location", "Population", "Birth Rate", "Route AA", "City BB", and "City CC". At this time, by comparing the values of the cells, the reading direction can be determined. For the table in Figure 5, since the column-based direction (vertical direction) has relatively more similar values grouped together compared to the row-based direction (horizontal direction), the table in Figure 5 can be classified as a table having a reading direction in the row-based direction. In this case, the PDF handler (421) can select one row as follows.
[0042] "Location: Suwon, Gyeonggi-do, Population 1.1 million, Birth Rate: 1.1%" "Birth Rate", "Route AA", "City BB", and "City CC". At this time, by comparing the values of the cells, the reading direction can be determined. For the table in Figure 5, since the column-based direction (vertical direction) has relatively more similar values grouped together compared to the row-based direction (horizontal direction), the table in Figure 5 can be classified as a table having a reading direction in the row-based direction. In this case, the PDF handler (421) can select one row as follows.
[0043] "Location: Suwon, Gyeonggi-do, Population 1.1 million, Birth Rate: 1.1%"
[0044] In this case, the PDF handler (421) can convert the value of the selected row into natural language as follows and save it in the storage (320).
[0045] "The location is Suwon, Gyeonggi-do, the population is 1.1 million, and the birth rate is 1.1%."
[0046] FIG. 6 is a drawing illustrating an example of a process of processing a table included in a document in docx file format in one embodiment of the present invention. It is a drawing showing an example of the process of processing a table included in a document in docx file format in one embodiment of the present invention.
[0047] As described in the embodiment of FIG. 4 above, when a document is uploaded through the upload (410) process, the table processing unit (310) included in the table processing system (300) can check the extension of the file constituting the document and confirm the document format of the document to be processed. Assume that the docx file format is confirmed in the embodiment of FIG. 6. At this time, the document in docx file format can be processed by the docx handler (422). When a document is uploaded through the upload (410) process, the table processing unit (310) included in the table processing system (300) can check the extension of the file constituting the document and confirm the document format of the document to be processed. The docx handler (422) can convert the docx file into a PDF file through the process of printing to PDF (610) and process the table as a PDF file as in the embodiment of FIG. 4. However, unlike a PDF file, since information related to the table structure is stored in the docx file, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table The docx handler (422) can convert the docx file into a PDF file through the process of printing to PDF (610) and process the table as a PDF file as in the embodiment of FIG. 4. However, since the docx file stores information related to the table structure, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table
[0048] The docx handler (422) can convert the docx file into a PDF file through the process of printing to PDF (610) and process the table as a PDF file as in the embodiment of FIG. 4. However, since the docx file stores information related to the table structure, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table The docx handler (422) can convert the docx file into a PDF file through the process of printing to PDF (610) and process the table as a PDF file as in the embodiment of FIG. 4. However, since the docx file stores information related to the table structure, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table However, since the docx file stores information related to the table structure, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table However, since the docx file stores information related to the table structure, the process of table detection (450) described in the embodiment of FIG. 4 can be omitted, and the process of table recognition (Table recognition, 620) for recognizing the table through the information stored in the docx file can be performed by the docx handler (422). The subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table subsequent process proceeds in the same manner as in the embodiment of FIG. 4, and the table The content can be converted into Markdown format or natural language format and saved in the storage (320). This is possible.
[0049] FIG. 7 is a drawing showing an example of a process for processing a table included in a document in the Excel file format in an embodiment of the present invention.
[0050] As described in the embodiment of FIG. 4 above, when a document is uploaded through the upload (410) process, the table processing unit (310) included in the table processing system (300) can check the file extension of the file constituting the document and confirm the document format of the document to be processed. In the embodiment of FIG. 7, it is assumed that the Excel file format is confirmed. At this time, a document in the Excel file format can be processed by an Excel handler (423).
[0051] Although Excel files are already decomposed into columns and rows, many tables often contain not only values but also headers and other information. Therefore, if all areas are recognized as tables as they are, there is a high possibility of errors. Also, table parts are often visually distinguished through specific colors, emphasized border lines, etc. Therefore, it is more accurate to convert the Excel file into an image (as an example, an image in the PNG (Portable Network Graphics) file format) and extract the table area from the image. To this end, the Excel handler (423) can convert the Excel file into an image through the print to image (710) process and extract the table area from the image through the table detection (720) process. After extracting the table area, the content of the table can be converted into Markdown form or natural language form and saved in the storage (320). This is possible. This is possible. FIG. 8 is a drawing showing an example of a process for processing a table included in a document in the Excel file format in an embodiment of the present invention. A drawing showing an example of a container. FIG. 9 shows, in one embodiment of the present invention, the conversion into natural language form A drawing showing an example of the table content.
[0052] FIG. 10 is a flowchart illustrating an example of a table processing method in one embodiment of the present invention. The table processing method according to this embodiment can be implemented by a computer device (200) that implements the above-described table processing system (300). At this time, the processor (220) of the computer device (200) can be implemented to execute control instructions according to the code of the operating system included in the memory (210) and the code of at least one computer program. Here, the processor (220) can control the computer device (200) so that the computer device (200) performs the steps (1010 to 1040) included in the method of FIG. 10 according to the control instructions provided by the code stored in the computer device (200). In step (1010), the computer device (200) can check the document format of the document used for the prompt for the large language model. As an example, the computer device (200) can check the document format through the file extension of the file corresponding to the document. Such a document format can be classified into at least one of DOCX file format, Excel file format, and PDF file format, but is not limited thereto. As an example, DOC file format, HWP file format, etc. can also be further utilized. Since the DOC file format and HWP file format contain information regarding the table structure, DOCX
[0053] In step (1010), the computer device (200) can check the document format of the document used for the prompt for the large language model. As an example, the computer device (200) can check the document format through the file extension of the file corresponding to the document. This kind of document format can be classified into at least one of DOCX file format, Excel file format, and PDF file format, but is not limited thereto. As an example, DOC file format, HWP file format, etc. can also be further utilized. Since the DOC file format and HWP file format contain information regarding the table structure, DOCX Various image file formats can also be processed similarly to the PDF file format.
[0054] In step (1020), the computer device (200) reads the text included in the document according to the document format. For example, if the document format is a PDF file, the computer device 200 can detect an area where a table exists through an artificial intelligence model to detect the table. For another example, if the document format is a DOCX file, the computer device 200 can detect the table. In the case of a DOCX file format, the computer device 200 can recognize a table by using information on a table structure contained in the DOCX file. In the case of a document in XSL file format, the document is converted to an image and the area in the converted image where the table exists is detected to detect the table.
[0055] In step (1030), the computer device (200) marks the contents of the recognized table. For example, the computer device 200 may convert the contents of the recognized table into a Markdown form or a natural language form based on at least one of whether or not the recognized table has a merged cell and the total length of the text included in the recognized table. If the total length of the text contained in the recognized table, not including the cells, is less than a preset threshold, the recognized table content can be converted to Markdown format. The computer device (200) also detects whether the recognized table contains merged cells. Alternatively, when the overall length is equal to or greater than a preset reference value, the content of the recognized table can be converted into a natural language form.
[0056] At this time, the computer device (200) converts the content of the recognized table into a natural language form When doing so, after extracting the header of the table and determining the reading direction of the table, the header and the table values can be read line by line from the table along the reading direction to generate a natural language. Also, the computer device (200) can determine the reading direction to be one of the column-based direction and the row-based direction of the table
[0057] In step (1040), the computer device (200) can store the content of the converted table in the storage for use as a prompt or for use in table search of the RAG retriever Here, the storage can correspond to the aforementioned storage (320), and the content of the converted table can be stored in the storage, or the content of the document including the content of the converted table can be stored in the storage
[0058] Thus, according to an embodiment of the present invention, a method and a system for processing a table of prompts for a large language model can be provided.
[0059] The systems or devices described below can be implemented as hardware components, or combinations of hardware components and software components. For example, the devices and components described in the embodiments can be, for example, a processor, a controller, an ALU (arithmetic logic unit), a digital signal processor, a microcomputer, an FPGA (field programmable gate array), a PLU (programmable logic unit), A microprocessor, or any other device capable of executing instructions and responding, can be implemented using one or more general-purpose computers or special-purpose computers. The processing device can execute an operating system (OS) and one or more software applications executed on the operating system. Also, in response to the execution of software, the processing device can access, store, manipulate, process, and generate data. For the sake of convenience of understanding, the processing device may be described as being one, but those of ordinary skill in the art will know that the processing device can include multiple processing elements and / or multiple types of processing elements. For example, the processing device can include multiple processors or one processor and one controller. Also, other processing configurations, such as a parallel processor, are possible. A microprocessor, or any other device capable of executing instructions and responding, can be implemented using one or more general-purpose computers or special-purpose computers. The processing device can execute an operating system (OS) and one or more software applications executed on the operating system. Also, in response to the execution of software, the processing device can access, store, manipulate, process, and generate data. For the sake of convenience of understanding, the processing device may be described as being one, but those of ordinary skill in the art will know that the processing device can include multiple processing elements and / or multiple types of processing elements. For example, the processing device can include multiple processors or one processor and one controller. Also, other processing configurations, such as a parallel processor, are possible. For example, the processing device can include multiple processors or one processor and one controller. Also, other processing configurations, such as a parallel processor, are possible.
[0060] Software can include a computer program, code, instructions, or a combination of one or more of these, and can configure the processing device to operate as desired or can instruct the processing device independently or collectively. The software and / or data are interpreted by the processing device. Alternatively, it can be embodied in certain types of machines, components, physical devices, virtual equipment, computer storage media or devices in order to provide instructions or data to a processing device. Software can also be distributed over a networked computer system and stored or executed in a distributed manner. Software and data can be stored on one or more computer-readable recording media can be.
[0061] The method according to the embodiment can be embodied in a program instruction form that can be executed through various computer means and recorded on a computer-readable medium. The computer-readable medium can include program instructions, data files, data structures, etc alone or in combination. The medium can be one that continuously stores a computer-executable program or temporarily stores it for execution or download. Also, the medium can be various recording or storage means in the form of a single or several pieces of hardware combined, but is not limited to a medium directly connected to any computer system and can also exist distributed over a network. Examples of the medium include magnetic media such as hard disks, floppy disks and magnetic tapes, optical recording media such as CD-ROMs and DVDs, magneto-optical media such as floptical disks, and those configured to store program instruction words including ROM, RAM, flash memory, etc. Also, as examples of other media, there can be mentioned recording media or storage media managed by app stores that distribute applications, and sites, servers, etc. that supply or distribute various other software. Examples of program instructions include not only machine language codes similar to those created by compilers, but also high-level language codes that can be executed by a computer using an interpreter, etc.
[0062] As described below, the embodiments have been described by way of limited embodiments and drawings. However, those of ordinary skill in the art can make various modifications and variations from the above description. For example, the described technology may be executed in an order different from the described method, and / or components such as the described systems, structures, devices, circuits, etc. may be combined or combined in a form different from the described method, or replaced or substituted by other components or equivalents, and appropriate results can still be achieved.
[0063] Therefore, other embodiments, other examples, and equivalents to the claims also fall within the scope of the claims described hereinafter.
Claims
1. 1. A method of processing tables in a computer system including at least one processor, comprising: identifying, by the at least one processor, a document format of a document to be utilized to prompt Large Language Models (LLM); The at least one processor converts the document into a format based on the document. Recognizing the tables contained in; Marking the contents of the recognized table by the at least one processor. converting the information into a spoken or natural language form; and The at least one processor converts the contents of the converted table into the storing the data in storage for use in prompting or for table lookup by a retriever in Retrieval Augmented Generation (RAG); A method for processing a table, comprising:
2. In claim 1, The converting step comprises: A table processing method, comprising: converting the contents of the recognized table into a Markdown form or a natural language form based on at least one of whether or not the recognized table has a merged cell and the total length of text included in the recognized table.
3. In claim 2, The converting step comprises: and converting the recognized table content into a Markdown format when the recognized table does not include merged cells and the total length of the text included in the recognized table is less than a predetermined reference value, and converting the recognized table content into a natural language format when the recognized table includes merged cells or the total length is equal to or greater than the predetermined reference value.
4. In claim 1, The converting step comprises: When converting the recognized table contents into a natural language form, extracting a header of the table; determining a reading direction of the table; and generating a natural language by reading a header and a value of the table line by line according to the reading direction; 23. A method for processing a table, comprising:
5. In claim 4, The step of determining a reading direction of the table comprises:
20. A method for processing a table, comprising determining the leading direction to be one of a column-based direction and a row-based direction of the table.
6. In claim 1, The step of checking the document format includes: A method for processing a table, comprising: identifying a document format through a file extension corresponding to the document;
7. In claim 1, The document format is DOCX file format, Excel file format. A table processing method, characterized in that the table is classified into at least one of the following file formats: .mat, PDF (Portable Document Format), and .pdf.
8. In claim 1, The step of recognizing the table includes: If the document format is a PDF file format, through an artificial intelligence model detecting an area in which the table exists by detecting the table; recognizing the table using information about a table structure contained in a DOCX file when the document format is a DOCX file format; and converting the document into an image when the document format is an Excel file format, and detecting the table by detecting an area where the table exists from the converted image.
23. A method for processing a table, comprising:
9. A computer program stored on a computer-readable recording medium for causing a computer device to execute the method according to any one of claims 1 to 8.
10. At least one computer readable instruction set is embodied to execute the instructions. A processor is included. by said at least one processor, Identify the document format of documents used as prompts for Large Language Models (LLMs), Recognizing a table contained in the document according to the document format; converting the recognized table content into a Markdown form or a natural language form; and storing the contents of the converted table in a repository for use in the prompt or for table lookups by a retriever of a Retrieval Augmented Generation (RAG).
Citation Information
Patent Citations
Context-based interactive service providing system and method
KR102551531B1