Automatic question-answering method, system, device and storage medium for tables
By integrating table information with the structure prediction model and using technologies such as graph convolutional networks, the question and answer generation problem of the natural language processing model in table data processing is solved, the efficiency of table recognition and question and answer is improved, and automatic question and answer directly targeted at the table is realized.
Patent Information
- Application Number
- CN202210374208.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-11
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-04-11
AI Technical Summary
Existing natural language processing models lack effective methods when processing tabular type data and are difficult to generate accurate questions and answers, especially due to the lack of global information and appropriate text generation strategies.
The structure prediction model is used to fuse the text, location and picture information in the table, extract features and generate question and answer sentences. It uses technologies such as graph convolution network and multi-layer perceptron to identify the structural relationships of the table and generate questions and answers for the table.
It improves the accuracy of table recognition and the efficiency of automatic question and answer. It directly implements question and answer on the form without converting it into text first, which saves processing steps and improves the performance of the form question and answer system.
Smart Images

Figure CN114743204B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an automatic question-answering method, system, device and storage medium for a table. Background Art
[0002] With the development of technology, many models for text generation tasks have been born. There are text generation based on existing sentences, such as translation; there are text generation based on keywords, such as expanding keywords into a sentence; there are also summary generation based on paragraphs, etc. However, text generation related to table structured data is very rare.
[0003] At present, the natural language processing model GPT-2 is widely used in the field of generation. Since GPT-2 generates the next text based on the decoded information, it lacks global information during generation. Although the Bidirectional Encoder Representation from Transformers (BERT) can obtain global information, it is obviously more reasonable to generate subsequent text based on the existing information during actual generation. The BART model combines the advantages of the GPT-2 and BERT models, obtaining global information in the encoding part and generating subsequent text based on the decoded information in the decoding part.
[0004] However, the BART model is also an end-to-end model, which is more suitable for text information, but there is still no better way to process tabular data. Summary of the invention
[0005] The present invention provides an automatic question-answering method, system, device and storage medium for tables, the main purpose of which is to provide an automatic question-answering method for tables, which effectively improves the efficiency of automatic question-answering of documents.
[0006] In a first aspect, an embodiment of the present invention provides an automatic question-answering method for a table, comprising:
[0007] According to the preprocessed document to be identified, the text information, position information and picture information corresponding to each text box in the target table area are obtained from the document to be identified;
[0008] Inputting text information, position information and picture information corresponding to each text box into a structure prediction model to obtain the structural position relationship between each text box in the target table area, wherein the structure prediction model is trained using the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structural position relationship between each text box in the sample table area as labels;
[0009] Generate a target question-answering sentence according to the structural position relationship and text information between the text boxes;
[0010] The target question and answer sentence is input into a tabular question and answer model to obtain an answer, wherein the tabular question and answer model is trained using preset question and answer sentences as samples and answer labels.
[0011] Preferably, the structure prediction model includes a text feature extraction module, a coordinate feature extraction module, an image feature extraction module, a multi-layer perceptron and a graph convolutional network, and the text information, position information and image information corresponding to each text box are input into the structure prediction model to obtain the structural position relationship between each text box in the target table area, including:
[0012] Inputting the text information corresponding to each text box into the text feature extraction module to obtain text content features;
[0013] Inputting the position information corresponding to each text box into the coordinate feature extraction module to obtain text position features;
[0014] Inputting the picture information corresponding to each text box and the position information corresponding to each text box into the picture feature extraction module to obtain local image features, and inputting the local image features into the multi-layer perceptron to obtain multi-layer image features;
[0015] The multi-layer image features, the text content features and the text position features are input into the graph convolutional network to obtain the structural position relationship between each text box and other text boxes.
[0016] Preferably, the text feature extraction module includes a projection unit and an LSTM unit, and the text information corresponding to each text box is input into the text feature extraction module to obtain text content features, including:
[0017] Inputting text information corresponding to each text box into the projection unit, projecting the text information into a preset vector space, and obtaining a text projection vector;
[0018] The text projection vector is input into the LSTM unit, the character string is converted into a text semantic vector, and the text content feature is obtained.
[0019] Preferably, the image feature extraction module is a convolutional neural network.
[0020] Preferably, the step of obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified after preprocessing includes:
[0021] Based on OCR technology, the pre-processed document to be recognized is detected to obtain the text information corresponding to each text box and the position information corresponding to each text box;
[0022] According to the row dividing lines and column dividing lines common to each text box, the image information corresponding to each text box is obtained.
[0023] Preferably, generating a target question-answering sentence according to the structural position relationship and text information between the text boxes includes:
[0024] Determine a reference text frame according to the structural position relationship between each text frame and other text frames;
[0025] Acquire reference text information according to the reference text box and the text information corresponding to each text box;
[0026] The target question and answer sentence is generated according to the reference text information.
[0027] Preferably, the preset question and answer sentence is expanded based on the basic question and answer sentence.
[0028] In a second aspect, an embodiment of the present invention provides an automatic question-answering system for a table, comprising:
[0029] An information extraction module, used for obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified after preprocessing;
[0030] A structure prediction module, used to input text information, position information and picture information corresponding to each text box into a structure prediction model, and obtain the structural position relationship between each text box in the target table area, wherein the structure prediction model is trained using the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structural position relationship between each text box in the sample table area as labels;
[0031] A sentence generation module, used to generate a target question-answering sentence according to the structural position relationship and text information between the text boxes;
[0032] A prediction module is used to input the target question and answer sentence into a table question and answer model to obtain an answer, wherein the table question and answer model is trained using preset question and answer sentences as samples and answer labels.
[0033] In a third aspect, an embodiment of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned automatic question-and-answer method for a table when executing the computer program.
[0034] In a fourth aspect, an embodiment of the present invention provides a computer storage medium, wherein the computer storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned automatic question-and-answer method for a table are implemented.
[0035] The present invention proposes an automatic question-and-answer method, system, device and storage medium for tables. First, the text information corresponding to each text box in the target table area, the position information corresponding to each text box, and the image information corresponding to each document box are integrated with the three aspects of text, position and image information, and the data is sampled in a diverse manner and features are extracted. This can accurately and effectively identify the information contained in the target table area, and on this premise, a target question-and-answer statement is generated, thereby realizing an automatic question-and-answer system for tables. The embodiment of the present invention integrates the text information, position information and image information in the table, and effectively improves the accuracy of table recognition through data sampling and data feature extraction from multiple aspects, and realizes automatic question-and-answer statements based on the recognition rate. Compared with the prior art, the automatic question-and-answer method can be directly implemented for the table without converting the table into text first, thus saving the implementation steps. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 A schematic diagram of an application scenario of an automatic question-answering method for a table proposed in an embodiment of the present invention;
[0037] Figure 2 A flowchart of an automatic question-answering method for a table provided by an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of the structure obtained for Table 1 in an embodiment of the present invention;
[0039] Figure 4 A schematic diagram of a structure prediction model provided by an embodiment of the present invention;
[0040] Figure 5 A schematic diagram of the structure of an automatic question-answering system for tables provided in an embodiment of the present invention;
[0041] Figure 6 A schematic diagram of the structure of a computer device is provided in an embodiment of the present invention.
[0042] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0043] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0044] Figure 1 A schematic diagram of an application scenario of an automatic question-answering method for a table proposed in an embodiment of the present invention is shown in FIG. Figure 1 As shown, the user inputs the preprocessed document to be recognized on the client side. After receiving the preprocessed document to be recognized, the client side sends the preprocessed document to be recognized to the server side. After receiving the preprocessed document to be recognized, the server side executes the automatic question and answer method for the table to obtain the target question and answer statement and answer.
[0045] It should be noted that the server can be implemented by an independent server or a server cluster composed of multiple servers. The client can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc., but is not limited thereto. The client and the server can be connected via Bluetooth, USB (Universal Serial Bus) or other communication connection methods, which is not limited in the embodiments of the present invention.
[0046] Figure 2 A flowchart of an automatic question-answering method for a table provided by an embodiment of the present invention, such as Figure 2 As shown, the method includes:
[0047] S210, according to the preprocessed document to be identified, obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified;
[0048] The document to be identified in the embodiment of the present invention can be a PDF document of various formats including documents from which text content can be extracted and a picture-type PDF document. If the document to be identified is a document of other formats, it is necessary to preprocess the document to be identified first, convert the document of other formats into a picture-type PDF document, and obtain the preprocessed document to be identified, and the preprocessed document to be identified is the PDF document; if the document to be identified is a picture-type PDF document, it is not necessary to preprocess the document to be identified, and the picture-type PDF document can be directly used as the preprocessed PDF document.
[0049] In addition, the preprocessed document to be identified is obtained, and based on the preprocessed document to be identified, the text information corresponding to each text box in the target table area, the position information corresponding to each text box, and the image information corresponding to each text box are obtained. The text information corresponding to each text box is the text information in each text box table, which can also be understood as the text content of the string. The position information corresponding to each text box can be identified by the coordinates of the four upper, lower, left and right points of the text box, or can be represented by two coordinates of the horizontal axis and the vertical axis. The specific information can be determined according to the actual situation, and the embodiments of the present invention will not be repeated here. The image information corresponding to each text box can be regarded as the image corresponding to the text box.
[0050] The embodiment of the present invention performs diversity sampling and feature extraction on the data by fusing the text information corresponding to each text box, the position information corresponding to each text box, and the image information corresponding to each document box in the target table area, thereby accurately and effectively identifying the information contained in the target table area.
[0051] According to the preprocessed document to be identified, the text information corresponding to each text box and the position information corresponding to each text box in the target table area are obtained. As an embodiment, the preprocessed document to be identified is obtained, and the preprocessed document to be identified is input into the OCR (Optical Character Recognition) software. The OCR technology can be used to identify each character in the document, the lateral position information of the character, and the longitudinal position information of the character. The font, font size (characterizing the size of the character) and color information of each character can also be obtained. In practical applications, the OCR tool can also correct and preprocess the image for problems such as tilt, uneven lighting, noise, and distortion of the image to be detected. The picture information corresponding to each text box can be obtained by performing image segmentation on the target table area.
[0052] As another embodiment, the preprocessed document to be identified can also be input into the neural network, and finally the text information corresponding to each text box, the position information corresponding to each text box and the image information corresponding to each text box are obtained. The neural network is trained with the document to be identified as a sample and the text information corresponding to each text box, the position information corresponding to each text box and the image information corresponding to each text box as labels.
[0053] S220, inputting text information, position information and picture information corresponding to each text box into a structure prediction model, and obtaining a structure position relationship between each text box in the target table area, wherein the structure prediction model is trained using the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structure position relationship between each text box in the sample table area as labels;
[0054] Then, the text information corresponding to each text box, the position information corresponding to each text box, and the image information corresponding to each text box obtained above are input into the structure prediction model to obtain the structural position relationship between each text box and other text boxes in the target table area. In the embodiment of the present invention, a text box in the target table area is taken as an example for explanation, and the text information corresponding to the text box, the position information corresponding to the text box, and the image information corresponding to the text box are input into the structure prediction model to obtain the structural position relationship between the text box and other text boxes. Here, the structural position relationship between the text box and other text boxes can be the structural relationship between the text box and all other text boxes in the target table area; however, if it is necessary to calculate the structural relationship between the text box and all other text boxes, it will cause a large amount of training when training the structural prediction model. Each text box has a relationship with other text boxes, whether they are in the "same column" or "same row", and considering that the correlation between text boxes that are far away is small, in order to save the amount of calculation, as a preferred embodiment, the K nearest neighbor algorithm is adopted, and for each text box, only the relationship between it and the nearest K nodes is considered, that is, the structural relationship between the text box and other text boxes is specifically the structural relationship between the text box and the nearest K text boxes.
[0055] In addition, usually, a string is regarded as a node, and the information of the table structure can be abstracted into the column-row relationship between the nodes, that is, the strings in the same column of the table constitute nodes with a "same column" relationship, the strings in the same row of the table constitute nodes with a "same row" relationship, and the strings in the same text box have both "same row" and "same column" relationships. Then the problem of table structure extraction can be abstracted into predicting the row-column relationship between each string node, and through the row-column relationship between nodes, the structural relationship of the table can be accurately extracted in the end. Therefore, in the embodiment of the present invention, the structural relationship here refers to the relationship in the same row or column.
[0056] The existing methods for extracting tables from PDF files basically extract the table frame in the file first, then extract the area inside the frame according to the table frame, and finally perform OCR recognition on the image of the area inside the frame to extract the table content. However, this method is only effective for tables with table lines. If the table lines are incomplete, the located table area may be incomplete or the cell content may be incomplete, resulting in a low accuracy rate for table extraction. The embodiment of the present invention integrates the text information, location information and image information in the table, and effectively improves the accuracy rate of table recognition by sampling data and extracting data features from multiple aspects.
[0057] Table 1 is a team statistics table in an embodiment of the present invention. Figure 3The schematic diagram of the structure obtained according to Table 1 in the embodiment of the present invention is shown in Table 1. Figure 3 It can be seen that if we only consider the 8 strings (text boxes) marked in the table, the structural relationship between the 8 text boxes is as follows: Figure 3 As shown, the solid line represents the same row relationship and the dotted line represents the same column relationship.
[0058] Table 1
[0059] Name① Age② Team ③ Peter④ 25⑦ A⑧ Mike⑤ 29 A John⑥ 30 B
[0060] S230, generating a target question-answering sentence according to the structural position relationship and text information between the text boxes;
[0061] Then, based on the structural position relationship between each text box and other text boxes, find the text box in the first horizontal row, and then combine the text information of each text box to find the text information "name", "age" and "team" in the text box in the first horizontal row. Based on the found "name", "age" and "team", the target question and answer sentence can be generated. For example, the target question and answer sentence can be "Who is the oldest?" and "Whose name has the most strokes?" and so on.
[0062] You can also find the text boxes in the first and second horizontal rows based on the structural position relationship between each text box and other text boxes, and then combine the text information of each text box to find the text information "Name" "Peter", "Age" "25", "Team" "A" and other information in the text box in the first horizontal row to generate a target question and answer sentence. For example, the target question and answer sentence can be "Which team is the person named Peter on?" "How old is Peter?" "Which team is Peter on?" and so on.
[0063] S240, input the target question and answer sentence into a table question and answer model to obtain an answer, wherein the table question and answer model is trained using preset question and answer sentences as samples and answer labels.
[0064] The target question-answering sentence is input into the table question-answering model, and the answer can be obtained by searching in the table. In the embodiment of the present invention, the table question-answering model is a neural network model. After the neural network model is trained with samples and labels, the trained table question-answering model can be obtained, and the answer corresponding to the target question-answering sentence can be obtained using the table question-answering model.
[0065] On the basis of the above embodiment, preferably, the structure prediction model includes a text feature extraction module, a coordinate feature extraction module, an image feature extraction module, a multi-layer perceptron and a graph convolutional network, and the text information, position information and image information corresponding to each text box are input into the structure prediction model to obtain the structural position relationship between each text box in the target table area, including:
[0066] Inputting the text information corresponding to each text box into the text feature extraction module to obtain text content features;
[0067] Inputting the position information corresponding to each text box into the coordinate feature extraction module to obtain text position features;
[0068] Inputting the picture information corresponding to each text box and the position information corresponding to each text box into the picture feature extraction module to obtain local image features, and inputting the local image features into the multi-layer perceptron to obtain multi-layer image features;
[0069] The multi-layer image features, the text content features and the text position features are input into the graph convolutional network to obtain the structural position relationship between each text box and other text boxes.
[0070] Figure 4 A schematic diagram of a structure prediction model provided by an embodiment of the present invention is shown in FIG. Figure 4 As shown, the structural prediction model includes a text feature extraction module 410, a coordinate feature extraction module 420, an image feature extraction module 430, a multi-layer perceptron 440 and a graph convolutional network 450. The text information corresponding to each text box is input into the text feature extraction module. The text feature extraction module first projects the characters into a pre-set vector space, and the character string can be converted into a text semantic vector through LSTM, and the text semantic vector is used as a text content feature; the position information corresponding to the text box is input into the coordinate feature extraction module. Generally speaking, the absolute coordinates of the text box are obtained through OCR technology, and then the absolute coordinates are converted into relative coordinates to obtain text position features; finally, the image information corresponding to the text box and the position information corresponding to each text box are input into the image feature extraction module. For the image information of the text box, the local image features of the text box are obtained through a convolutional neural network according to the four-point coordinates and the image of the table area.
[0071] Then, the multi-layer image features, text content features, and text position features are input into the graph convolutional network to obtain the structural position relationship between each text box and other text boxes.
[0072] On the basis of the above embodiment, preferably, the text feature extraction module includes a projection unit and an LSTM unit, and the text information corresponding to each text box is input into the text feature extraction module to obtain text content features, including:
[0073] Inputting text information corresponding to each text box into the projection unit, projecting the text information into a preset vector space, and obtaining a text projection vector;
[0074] The text projection vector is input into the LSTM unit, the character string is converted into a text semantic vector, and the text content feature is obtained.
[0075] Specifically, the text feature extraction module consists of two parts: a projection unit and an LSTM unit. The text information corresponding to each text box is input into the projection unit and projected into a pre-set vector space to obtain a text projection vector. The text projection vector is then input into the LSTM network to convert the character string into a text semantic vector to obtain text content features.
[0076] LSTM (Long Short-Term Memory) is a time recurrent neural network that is specially designed to solve the long-term dependency problem of general RNN (recurrent neural network). All RNNs have a chain form of repeated neural network modules.
[0077] Based on the above embodiment, preferably, the image feature extraction module is a convolutional neural network.
[0078] Specifically, the image feature extraction module in the embodiment of the present invention is a convolutional neural network.
[0079] Convolutional Neural Networks (CNN) are a type of feedforward neural network that includes convolutional calculations and has a deep structure. It is one of the representative algorithms of deep learning. Convolutional neural networks have representation learning capabilities and can perform translation-invariant classification of input information according to their hierarchical structure.
[0080] On the basis of the above embodiment, preferably, the step of obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified after preprocessing includes:
[0081] Based on OCR technology, the pre-processed document to be recognized is detected to obtain the text information corresponding to each text box and the position information corresponding to each text box;
[0082] According to the row dividing lines and column dividing lines common to each text box, the image information corresponding to each text box is obtained.
[0083] Obtain the preprocessed document to be recognized, input the preprocessed document to be recognized into the OCR software, and use the OCR technology to recognize each character in the document, the horizontal position information of the character, and the vertical position information of the character. According to the row dividing lines and column dividing lines shared by the text box, the target table area is segmented.
[0084] Based on the above embodiment, preferably, generating a target question-answering sentence according to the structural position relationship and text information between the text boxes includes:
[0085] Determine a reference text frame according to the structural position relationship between each text frame and other text frames;
[0086] Acquire reference text information according to the reference text box and the text information corresponding to each text box;
[0087] The target question and answer sentence is generated according to the reference text information.
[0088] According to the structural position relationship between each text box and other text boxes, find the text boxes in the first horizontal row, the second horizontal row and the third horizontal row, and then combine the text information of each text box to find the text information "Name" "Mike" "Age" "29" "Team" "A" in the text box in the first horizontal row. According to the found text information, the target question and answer sentences can be generated. For example, the target question and answer sentences can be "How old is Mike?" and "Who is in team A?" and so on.
[0089] On the basis of the above embodiment, preferably, the preset question and answer sentence is expanded based on the basic question and answer sentence.
[0090] When training a table question-answering model, in addition to the training methods and techniques, the training data problem also needs to be solved. For the same table, if only one question is used in a table, one problem is a waste of resources, and the other is that it may cause overfitting and the model is not generalized enough. Therefore, some questions and answers can be generated based on the table information.
[0091] There are two main ways to generate:
[0092] Generate through templates. Use fixed sentence patterns to ask questions about the data in the table. For example, "What is the [team] of [name] [Peter]?" You can complete the question by filling in the slots. In addition, use the model to expand the sentence and use the T5 model to expand the question synonymously, so that similar questions can be obtained, thereby expanding the data set.
[0093] The current text generation in the prior art is only for the generation of text types such as short sentences or long texts, and does not generate questions and answers for the text of table structure data. The embodiment of the present invention provides question and answer generation for table structure data, proposes a new solution on how to prepare a data set, how to expand a data set, and how to conduct training, and describes the process in detail. Therefore, the model can generate question and answer text for table structure data according to this method.
[0094] Figure 5 A schematic diagram of the structure of an automatic question-answering system for a table provided by an embodiment of the present invention, such as Figure 5 As shown, the system includes an information extraction module 510, a structure prediction module 520, a sentence generation module 530 and a prediction module 540, wherein:
[0095] The information extraction module 510 is used to obtain text information, position information and image information corresponding to each text box in the target table area from the document to be identified after preprocessing;
[0096] The structure prediction module 520 is used to input the text information, position information and picture information corresponding to each text box into the structure prediction model, and obtain the structural position relationship between each text box in the target table area, wherein the structure prediction model is trained with the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structural position relationship between each text box in the sample table area as labels;
[0097] The sentence generation module 530 is used to generate a target question-answering sentence according to the structural position relationship and text information between the text boxes;
[0098] The prediction module 540 is used to input the target question and answer sentence into the table question and answer model to obtain the answer, wherein the table question and answer model is trained with preset question and answer sentences as samples and answer labels.
[0099] This embodiment is a system embodiment corresponding to the above method embodiment, and its specific implementation process is the same as the above method embodiment. For details, please refer to the above method embodiment, and this system embodiment will not be repeated here.
[0100] On the basis of the above embodiment, preferably, the structure prediction model includes a text feature extraction module, a coordinate feature extraction module, a picture feature extraction module, a multi-layer perceptron and a graph convolutional network, wherein:
[0101] The text feature extraction module is used to obtain text content features according to the text information corresponding to each text box;
[0102] The coordinate feature extraction module is used to obtain text position features according to the position information corresponding to each text box;
[0103] The image feature extraction module is used to obtain local image features according to the image information corresponding to each text box and the position information corresponding to each text box;
[0104] The perceptron is used to obtain multi-layer image features according to the local image features;
[0105] The graph convolutional network is used to obtain the structural position relationship between each text box and other text boxes based on the multi-layer image features, the text content features and the text position features.
[0106] On the basis of the above embodiment, preferably, the text feature extraction module includes a projection unit and an LSTM unit, wherein:
[0107] The text feature extraction module is used to project the text information into a preset vector space according to the text information corresponding to each text box, and obtain a text projection vector;
[0108] The LSTM unit is used to convert the character string into a text semantic vector according to the text projection vector to obtain the text content feature.
[0109] Based on the above embodiment, preferably, the image feature extraction module is a convolutional neural network.
[0110] Based on the above embodiment, preferably, the information extraction module includes a detection unit and a segmentation unit, wherein:
[0111] The detection unit is used to detect the pre-processed document to be recognized based on the OCR technology, and obtain the text information corresponding to each text box and the position information corresponding to each text box;
[0112] The segmentation unit is used to obtain the image information corresponding to each text box according to the row segmentation lines and column segmentation lines common to each text box.
[0113] Based on the above embodiment, preferably, the sentence generation module includes a reference structure unit, a reference text unit and a generation unit, wherein:
[0114] The reference structure unit is used to determine the reference text frame according to the structural position relationship between each text frame and other text frames;
[0115] The reference text unit is used to obtain reference text information according to the reference text box and the text information corresponding to each text box;
[0116] The generating unit is used to generate the target question-answering sentence according to the reference text information.
[0117] On the basis of the above embodiment, preferably, the preset question and answer sentence is expanded based on the basic question and answer sentence.
[0118] Each module in the above-mentioned automatic question-answering system for forms can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above-mentioned modules can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each of the above modules.
[0119] Figure 6 A schematic diagram of the structure of a computer device is provided in an embodiment of the present invention. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a computer storage medium and an internal memory. The computer storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the computer storage medium. The database of the computer device is used to store data generated or obtained during the execution of the automatic question-and-answer method for the form, such as documents to be identified, text information, location information and image information. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, an automatic question-and-answer method for the form is implemented.
[0120] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the automatic question-answering method for a table in the above embodiment are implemented. Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the automatic question-answering system for a table are implemented.
[0121] In one embodiment, a computer storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the automatic question-answering method for a table in the above embodiment are implemented. Alternatively, when the computer program is executed by a processor, the functions of each module / unit in the above embodiment of the automatic question-answering system for a table are implemented.
[0122] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0123] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0124] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. An automatic question-answering method for tables, It is characterized in that include: According to the preprocessed document to be identified, the text information, position information and picture information corresponding to each text box in the target table area are obtained from the document to be identified; Input text information, position information and picture information corresponding to each text box into a structure prediction model, and obtain the structural position relationship between each text box in the target table area, wherein the structural position relationship is a relationship in the same row or column, wherein the structure prediction model is trained using the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structural position relationship between each text box in the sample table area as labels; Generate a target question-answering sentence according to the structural position relationship and text information between the text boxes; The target question and answer sentence is input into a tabular question and answer model to obtain an answer, wherein the tabular question and answer model is trained using preset question and answer sentences as samples and answer labels.
2. The automatic question-answering method for a table according to claim 1, It is characterized in that The structural prediction model includes a text feature extraction module, a coordinate feature extraction module, an image feature extraction module, a multi-layer perceptron and a graph convolutional network. The text information, position information and image information corresponding to each text box are input into the structural prediction model to obtain the structural position relationship between each text box in the target table area, including: Inputting the text information corresponding to each text box into the text feature extraction module to obtain text content features; Inputting the position information corresponding to each text box into the coordinate feature extraction module to obtain text position features; Inputting the picture information corresponding to each text box and the position information corresponding to each text box into the picture feature extraction module to obtain local image features, and inputting the local image features into the multi-layer perceptron to obtain multi-layer image features; The multi-layer image features, the text content features and the text position features are input into the graph convolutional network to obtain the structural position relationship between each text box and other text boxes.
3. The automatic question-answering method for a table according to claim 2, It is characterized in that The text feature extraction module includes a projection unit and an LSTM unit. The text information corresponding to each text box is input into the text feature extraction module to obtain text content features, including: Inputting text information corresponding to each text box into the projection unit, projecting the text information into a preset vector space, and obtaining a text projection vector; The text projection vector is input into the LSTM unit, the character string is converted into a text semantic vector, and the text content feature is obtained.
4. The automatic question-answering method for a table according to claim 2, It is characterized in that The image feature extraction module is a convolutional neural network.
5. The automatic question-answering method for a table according to claim 1, It is characterized in that The step of obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified after preprocessing includes: Based on OCR technology, the pre-processed document to be recognized is detected to obtain the text information corresponding to each text box and the position information corresponding to each text box; According to the row dividing lines and column dividing lines common to each text box, the image information corresponding to each text box is obtained.
6. The automatic question-answering method for a table according to any one of claims 1 to 5, It is characterized in that Generating a target question-answering sentence according to the structural position relationship and text information between the text boxes includes: Determine a reference text frame according to the structural position relationship between each text frame and other text frames; Acquire reference text information according to the reference text box and the text information corresponding to each text box; The target question and answer sentence is generated according to the reference text information.
7. The automatic question-answering method for a table according to any one of claims 1 to 5, It is characterized in that The preset question and answer sentence is obtained by expanding the basic question and answer sentence.
8. An automatic question-answering system for tables, It is characterized in that include: An information extraction module, used for obtaining text information, position information and picture information corresponding to each text box in the target table area from the document to be identified after preprocessing; A structure prediction module, used for inputting text information, position information and picture information corresponding to each text box into a structure prediction model, and obtaining a structure position relationship between each text box in the target table area, wherein the structure position relationship is a relationship in the same row or column, wherein the structure prediction model is trained using the text information, position information and picture information corresponding to each text box in the sample table area as samples and the structure position relationship between each text box in the sample table area as labels; A sentence generation module, used to generate a target question-answering sentence according to the structural position relationship and text information between the text boxes; A prediction module is used to input the target question and answer sentence into a table question and answer model to obtain an answer, wherein the table question and answer model is trained using preset question and answer sentences as samples and answer labels.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the steps of the automatic question-answering method for a form as claimed in any one of claims 1 to 7 are implemented.
10. A computer storage medium storing a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the automatic question-answering method for a form as claimed in any one of claims 1 to 7 are implemented.
