Document analysis method and device and electronic equipment
Through the fusion of text, layout and visual information, multi-modal pre-trained language models are used for document parsing, which solves the problems of low parsing accuracy and strong module dependence in the existing technology, and achieves more accurate and stable document parsing results. .
Patent Information
- Application Number
- CN202310187028.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-28
- Publication Date
- 2024-08-30
AI Technical Summary
Existing document parsing methods have low parsing accuracy when dealing with portable documents with complex layouts, resulting in confusing content and multi-module interdependence that is difficult to maintain.
By extracting the feature information of text information, text layout information and visual information, and fusing it, a multi-modal pre-trained language model is used for end-to-end parsing, and rich feature information is obtained to improve parsing accuracy.
It improves the accuracy of document parsing, avoids the negative impact of resource module interdependence and out-of-order text on parsing results, and reduces system maintenance costs.
Smart Images

Figure CN118569206A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a document parsing method, device and electronic device. Background Art
[0002] Document parsing is a common document processing method that requires algorithms to be able to recognize structured documents (such as resumes). The purpose can be to obtain important data in the document through parsing, such as the name, phone number, email address, graduation school, and company employed in the resume.
[0003] The current document parsing method can be summarized as a method that includes two steps: document text segmentation and field extraction. Both steps focus on the text information in the document, and based on the text information, the document text is segmented and the field is extracted through heuristic rules, dictionaries or machine learning methods.
[0004] However, a large number of portable document format (such as resumes in PDF format) documents have complex document layouts, and simple parsing often results in a large amount of disorganized content. Summary of the invention
[0005] The main technical problem solved by the implementation methods of this application is how to improve the accuracy of document parsing.
[0006] In order to solve the above technical problems, a technical solution adopted in the implementation mode of the present application is: providing a document parsing method, including: extracting text information and text layout information based on the acquired document to be parsed; extracting visual information of the document to be parsed; obtaining feature information corresponding to the text information and the text layout information, and obtaining feature information corresponding to the visual information; fusing the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information to obtain target fusion information; and obtaining the parsing result of the document to be parsed based on the target fusion information.
[0007] Optionally, extracting text information and text layout information based on the acquired document to be parsed specifically includes: extracting each character in the document, position information of the character, and area information corresponding to the character based on the document to be parsed.
[0008] Optionally, the obtaining of feature information corresponding to the text information and the text layout information includes: representing each character in the document as a text character vector; representing the position information of each character in the document as a position index vector; and representing the area information corresponding to each character in the document as a bounding box vector.
[0009] Optionally, expressing the area information corresponding to each character in the document as a bounding box vector includes: obtaining the horizontal coordinates and vertical coordinates of the upper left corner and the lower right corner of the character relative to the page origin according to the area information, and obtaining the width and height of the character; normalizing the horizontal coordinate, the vertical coordinate, the width, and the height to a numerical value in an integer interval, each of which corresponds to a vector; and concatenating the vectors corresponding to the numerical values to obtain the bounding box vector corresponding to the character.
[0010] Optionally, extracting visual information of the document to be parsed specifically includes: converting the document to be parsed into a picture, and extracting a feature map of the picture based on a convolutional neural network.
[0011] Optionally, obtaining feature information corresponding to the visual information includes: performing a linear transformation on the feature map to obtain a visual vector corresponding to each feature map; obtaining a position number of each feature map, and expressing the position number as a position vector corresponding to each feature map; obtaining bounding box information of an area corresponding to each feature map in the image, and obtaining a bounding box vector of the feature map based on the bounding box information.
[0012] Optionally, the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information are fused to obtain target fusion information, including: summing the text character vector, the position index vector and the bounding box vector corresponding to each character, and the result of the summation is represented as the text representation of the character; summing the visual vector, the position vector and the bounding box vector corresponding to each feature map, and the result of the summation is represented as the visual representation of the feature map; wherein the text representation of the character and the visual representation of the feature map are the target fusion information.
[0013] Optionally, obtaining the parsing result of the document to be parsed based on the target fusion information includes: inputting the text representation of the characters and the visual representation of the feature map into a preset multimodal pre-trained language model to output a multimodal vector for each text character; inputting the multimodal vector into a preset classification model to output the parsing result of the document to be parsed.
[0014] To solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: to provide a document parsing device, including: a text acquisition module, used to extract text information and text layout information based on the acquired document to be parsed; a visual information acquisition module, used to extract visual information of the document to be parsed; a feature information acquisition module, used to obtain feature information corresponding to the text information and the text layout information, and obtain feature information corresponding to the visual information; a fusion information processing module, used to fuse the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information, to obtain target fusion information; a parsing result acquisition module, used to obtain the parsing result of the document to be parsed according to the target fusion information.
[0015] To solve the above technical problems, another technical solution adopted in the implementation mode of the present application is: to provide an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the document parsing method as described above.
[0016] Different from the related art, the document parsing method, device and electronic device provided in the embodiments of the present application extract text information and text layout information from the acquired document to be parsed; extract visual information of the document to be parsed; obtain feature information corresponding to the text information and the text layout information, and obtain feature information corresponding to the visual information; fuse the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information to obtain target fusion information; obtain the parsing result of the document to be parsed according to the target fusion information. The implementation method of the present application provides an end-to-end document parsing method, which can avoid the problems of mutual dependence, mutual influence and difficulty in maintenance of various resource modules in the two-stage method compared with the related art; in addition, the embodiments of the present application obtain the parsing result of the document according to the target fusion information including text information, text layout information and visual information, thereby enriching the feature information and improving the accuracy of the parsing result. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] One or more embodiments are exemplarily described by corresponding drawings, which do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and the figures in the drawings do not constitute proportional limitations unless otherwise stated.
[0018] Figure 1 is a flowchart of a document parsing method provided by an embodiment of the present application;
[0019] Figure 2 is a flowchart of a method for representing the area information corresponding to each character in the document as a bounding box vector provided by an embodiment of the present application;
[0020] Figure 3 is a flow chart of a method for obtaining feature information corresponding to the visual information provided in an embodiment of the present application;
[0021] Figure 4 It is a flowchart of a method for document parsing of a resume provided in an embodiment of the present application;
[0022] Figure 5 It is a structural diagram of a document parsing device provided in an embodiment of the present application;
[0023] Figure 6 It is a hardware structure diagram of an electronic device 30 for executing a document parsing method provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0025] It should be noted that, if there is no conflict, the various features in the embodiments of the present application can be combined with each other, all within the scope of protection of the present application. In addition, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described can be performed in a different order than the module division in the device schematic diagram or the order in the flow chart.
[0026] Unless otherwise defined, all technical and scientific terms used in this specification have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used in the specification of this application are only for the purpose of describing specific embodiments and are not intended to limit this application. The term "and / or" used in this specification includes any and all combinations of one or more of the related listed items.
[0027] For structured documents (such as resumes), related technologies usually parse documents by document text segmentation and field extraction. The two stages of text segmentation and field extraction usually use resource modules such as dictionaries, heuristic rule sets, text classification models, and named entity recognition models. There are dependencies and mutual influences between the resource modules in each stage. At the same time, as a pre-step, the effect of text segmentation will directly affect the effect of field extraction. In addition, the maintenance cost of a multi-module and multi-stage system is also high. In addition, text extraction tools usually scan document files from top to bottom and from left to right. The extracted text will be inconsistent with the reading order and will appear out of order. The out-of-order text directly affects the effect of text segmentation and field extraction.
[0028] Based on the above research, the embodiments of the present application provide a document parsing method, device and electronic device, which can obtain feature information of the document to be parsed in different dimensions, including text, location, bounding box, context information and visual features, etc., thereby enriching the feature information of the document, making the document parsing result more accurate, and also reducing the negative impact of the text extraction tool in the existing method extracting disordered text on the document parsing. Furthermore, the document parsing method of the present application is an end-to-end method, which can avoid the problems of mutual dependence, mutual influence and difficult maintenance of various resource modules in the prior art.
[0029] The defects existing in the above-mentioned solutions are the results obtained by the inventor after practice and careful research. Therefore, the discovery process of the above-mentioned problems and the solutions proposed by this application for the above-mentioned problems below should be the contributions made by the inventor to this application during the disclosure process of this application.
[0030] See also Figure 1 , Figure 1 : is a flowchart of a document parsing method provided by an embodiment of the present application. Figure 1 As shown, the following steps are included:
[0031] S11. Extracting text information and text layout information according to the acquired document to be parsed.
[0032] The document to be parsed may be in various forms, including but not limited to documents in plain text form and documents in image form, wherein the documents in plain text form and documents in image form include electronic documents, scanned documents, printed texts, handwritten texts, etc. The document to be parsed may be a document with a certain layout, such as a resume, an invoice, a brochure, a contract, a project book, an instruction manual, etc. Different layouts may constitute different document structures.
[0033] The text information refers to the words, phrases, sentences and paragraphs in the document. The text information also includes the position information of the text, such as the position information of the words. The text layout information refers to the area information corresponding to the text information, such as the area information occupied by the words in the document.
[0034] In this embodiment, the extracting of text information and text layout information from the acquired document to be parsed specifically includes: extracting each character in the document, the position information of the character, and the area information corresponding to the character, according to the document to be parsed. The character refers to a word in the document.
[0035] Among them, according to the format of the document, corresponding tools can be used to extract text information and text layout information from the document. For example, for documents in PDF format, PDF parsing tools such as pdfminer can be used to extract each token (character) and the area information of each character from the document. For documents in image format, OCR (Optical Character Recognition) tools can be used to extract each character and the area information of each character from the document. Among them, the area information can be specifically expressed as [t, x0, y0, x1, y1, w, h]. Wherein t is a token in the document; x0, y0, x1, y1 are the horizontal and vertical coordinates of the upper left corner and lower right corner of t relative to the page origin (such as the point in the upper left corner of the document page); w and h are the width and height of t, respectively.
[0036] The position information of the characters is related to the arrangement order of the characters in the document. For example, the position of each character in the document corresponds to a number, and each character is numbered according to the position of the character in the document. The number reflects the position information of the character.
[0037] Optionally, before executing the above step S11, the method further includes obtaining the document to be parsed. Obtaining the document to be parsed may be obtaining one or more documents to be parsed. When there are multiple documents to be parsed, the documents can be processed by the method of the present application. The program executing the document parsing method can process the parsing of multiple documents in parallel.
[0038] S12: extracting visual information of the document to be parsed.
[0039] The visual information refers to image feature information obtained from a picture after the document to be parsed is converted into a picture. The extracting the visual information of the document to be parsed specifically includes: converting the document to be parsed into a picture, and extracting a feature map of the picture based on a convolutional neural network.
[0040] In an embodiment of the present application, a ResNet (Deep residual network) model can be used to extract a series of feature maps from the document page as visual features. For example, first, all page images of the document are normalized to a fixed size and input into ResNet; then the feature map output by ResNet is pooled to obtain W*H feature maps, where W is the number of feature maps per horizontal row, and H is the number of feature maps per vertical column. For example, taking a resume document as an example, the page of the resume document can be converted into a picture, and the picture can be evenly divided into small blocks, such as 6*8 small blocks, and convolution is used to extract features from each small block, that is, to obtain the feature map of each small block. A picture of a resume can obtain 6*8 feature maps.
[0041] It should be noted that the model used for visual information extraction is not limited to the above-mentioned ResNet, but can also be other feature extraction models based on convolutional neural networks.
[0042] S13: Acquire feature information corresponding to the text information and the text layout information, and acquire feature information corresponding to the visual information.
[0043] Wherein, the obtaining of the feature information corresponding to the text information and the text layout information specifically includes: representing each character in the document as a text character vector; representing the position information of each character in the document as a position index vector; representing the area information corresponding to each character in the document as a bounding box vector. The text character vector represented by the character may be a vector of length L, which may be derived from a preset multimodal pre-trained language model after fine tuning. The position information of each character may be represented by the position index of the character, such as an index set of {1, 2, 3, 4, ..., n}, the numerical value in the index set may be the number of the position sequence of the character, and each numerical value in the index set corresponds to a vector of length L, which may also be derived from a preset multimodal pre-trained language model after fine tuning.
[0044] Among them, Figure 2 As shown, the step of expressing the area information corresponding to each character in the document as a bounding box vector includes:
[0045] S131, acquiring the horizontal coordinates and the vertical coordinates of the upper left corner and the lower right corner of the character relative to the page origin according to the area information, and acquiring the width and height of the character;
[0046] S133, normalizing the horizontal coordinate, the vertical coordinate, the width, and the height to a value in an integer interval, each of which corresponds to a vector;
[0047] S135 , concatenating the vectors corresponding to the numerical values to obtain a bounding box vector corresponding to the character.
[0048] For example, the x0, y0, x1, y1, w, and h in the bounding box information are normalized to an integer in the integer interval [0, 1000] (1000 is an example value, and it can also be other values). x0, x1, w are normalized by the function f(x) = (x / page width) * 1000, and then rounded down; y0, y1, h are normalized by the function f(x) = (x / page height) * 1000, and then rounded down. Each value in the integer interval [0, 1000] corresponds to a vector. After concatenating the vectors corresponding to the normalized values of x0, y0, x1, y1, w, and h, a linear transformation is performed to obtain a vector of length L, which is used as the bounding box vector of the character.
[0049] The length L is a hyperparameter that can be specified manually. For example, a vector of length L can be obtained in this way. Assuming that the size of a feature map is 20*30, a linear network layer with an input size of 20*30 and an output size of L can be used to convert a feature map into a vector of length L.
[0050] Among them, Figure 3 As shown, the acquiring of feature information corresponding to the visual information includes:
[0051] S132, performing a linear transformation on the feature map to obtain a visual vector corresponding to each feature map;
[0052] S134, obtaining a position number of each feature map, and representing the position number as a position vector corresponding to each feature map;
[0053] S136. Obtain bounding box information of a region corresponding to each feature map in the image, and obtain a bounding box vector of the feature map according to the bounding box information.
[0054] In the embodiment of the present application, the feature map is a small block divided from the original image of the document, which can be obtained by convolution feature extraction. The bounding box information refers to the bounding box of the original small block corresponding to the feature map in the original image of the document.
[0055] When obtaining the visual vector corresponding to each feature map, each feature map can be linearly transformed to obtain a vector with a length of L, and the L can be equivalent to the above L.
[0056] Among them, when obtaining the position vector and the bounding box vector, since each feature map has a position number, it can be understood as dividing a picture into several small blocks, numbering starting from 1, and the position of each feature map is a corresponding number. This number is an integer, not a vector. When implementing vector representation, for each integer, a randomly initialized vector can be used to represent this integer, thereby forming the position vector. Each bounding box can be represented by 6 numbers similar to the above x0, y0, x1, y1, w, h. Each number can be normalized to an integer, and each integer can also be represented by a randomly initialized vector; when normalized, similar to text characters, the above method can also be used to obtain the bounding box vector.
[0057] S14: Fusing the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information to obtain target fusion information.
[0058] Through the above steps, the character-related information of the document and the visual information corresponding to the characters can be obtained, so that the target fusion information can include the text representation of the characters and the visual representation of the feature map. Specifically, the text character vector, the position index vector and the bounding box vector corresponding to each character are summed, and the result of the summation is represented as the text representation of the character; the visual vector, the position vector and the bounding box vector corresponding to each feature map are summed, and the result of the summation is represented as the visual representation of the feature map.
[0059] S15. Obtain the parsing result of the document to be parsed according to the target fusion information.
[0060] Among them, the text representation of the character and the visual representation of the feature map can be input into a preset multimodal pre-trained language model to output a multimodal vector for each text character; and the multimodal vector can be input into a preset classification model to output the parsing result of the document to be parsed.
[0061] The preset multimodal pre-trained language model may specifically be LayoutLMv2. The vectors corresponding to the text representation of the character and the visual representation of the feature map are input into LayoutLMv2. After the multi-layer transformer model performs cross-modal interaction, each text character finally obtains a multimodal vector representation h. i , the h iThe multi-layer transformer model is a deep learning model based on the self-attention mechanism. i For the detailed process, please refer to the relevant technology.
[0062] The obtained h i As the input of the preset classification model, the output is the label of each character. In the embodiment of the present application, other classification or sequence labeling models such as softmax classification model or CRF (conditional random fields) sequence labeling model can be used to label text characters (tokens). The definition of the label set depends on the type of structured field to be extracted. For example, if the set of structured fields to be extracted is C = {name, phone number, email address, graduate school, company employed}, then the token label set can be Lset = {B-name, B-phone number, B-mail address, B-graduate school, B-company employed, I-name, I-phone number, I-mail address, I-graduate school, I-company employed, O}. Where B indicates that the token is the beginning character of a certain type of field, I indicates that the token is a non-beginning component character of a certain type of field, and O indicates that the token is not a component character of the target type field. For example, B-graduate school means that the token is the beginning character of the name of the graduate school. For example, B represents the first character, I represents the middle character, O represents other characters, and L represents the last character. When the structured field set to be extracted is C = {Xiao Ming graduated from Tsinghua University}, the token tag set can be Lset = {Tsinghua-B, Hua-I, Da-I, Xue-I, Xue-L}. It should be noted that the above letter tags are only examples, and other identifiers can also be used to represent the tags.
[0063] By outputting the label of each character through the above labeling model and merging the labels of related characters, the structured field to be extracted can be obtained. For example, taking the extraction of "graduation study" as an example, the extraction steps are as follows:
[0064] 1) Initialize an empty token set S = {}.
[0065] 2) Add a token t with the label “B-Graduation School” to the set, and now S = {t}.
[0066] 3) Loop through all tokens labeled "I-Graduation School" multiple times, and stop the loop when the number of elements in set S no longer increases. The traversal logic is: if the horizontal distance and vertical distance between the token and any token in set S are both less than a specific threshold, then add the token to set S. By setting the horizontal distance and vertical distance to be less than a specific threshold, characters with adjacent positions can be grouped into the same set.
[0067] 4) The tokens in S are sorted from left to right according to the horizontal coordinates to obtain a graduation school field.
[0068] The embodiment of the present application proposes an end-to-end resume parsing method, which avoids the problems of mutual dependence, mutual influence, and difficult maintenance of each resource module in the two-stage method; it also proposes the use of a multimodal pre-trained language model to fuse the text tokens in the document, the token position, the bounding box of the token in the page, and the visual features of the document page, extract the multimodal representation of the token, and extract the structured fields based on the multimodal representation. The negative impact of out-of-order text on resume parsing caused by the text extraction tool in the existing method is avoided. At the same time, compared with the existing method, this patent uses richer feature information, so that the obtained document parsing results are more accurate.
[0069] The document parsing method is described below by taking a resume as an example. Figure 4 As shown, t i Represents a text token vector, each token corresponds to a text token vector, p i Represents the position index vector of the token in the token sequence, where the index is a value in the set {1, 2, 3, 4, ..., n}. i The bounding box vector of the token. The visual feature extraction module extracts W*H feature maps, which are called visual tokens. After linear transformation, each feature map can be converted into a vector of length L, corresponding to Figure 4 v i , is the vector representation of the visual token. Similar to the text token, the visual token also has a corresponding position vector and bounding box vector. The multimodal pre-trained language model can be LayoutLMv2. The vector representation of the text token and the visual token is used as the input of the multimodal pre-trained language model. After the multi-layer transformer model performs cross-modal interaction, each text token finally obtains a multimodal vector representation h i .h iThe token’s text, location, bounding box, context, and visual features are integrated. Finally, the token tagging model and post-processing module output the token tag, merge the related token tags, and obtain the structured fields to be abstracted in the resume.
[0070] See also Figure 5 , Figure 5 Schematic diagram of the structure of a document parsing device provided in an embodiment of the present application. Figure 5 As shown, the document parsing device 20 includes: a text acquisition module 21, a visual information acquisition module 22, a feature information acquisition module 23, a fusion information processing module 24 and a parsing result acquisition module 25.
[0071] The text acquisition module 21 is used to extract text information and text layout information based on the acquired document to be parsed. The visual information acquisition module 22 is used to extract visual information of the document to be parsed. The feature information acquisition module 23 is used to obtain feature information corresponding to the text information and the text layout information, and to obtain feature information corresponding to the visual information. The fusion information processing module 24 is used to fuse the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information, to obtain target fusion information. The parsing result acquisition module 25 is used to obtain the parsing result of the document to be parsed based on the target fusion information.
[0072] It should be noted that the above document parsing device can execute the document parsing method provided in the embodiment of the present application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in the document parsing device embodiment, please refer to the document parsing method provided in the embodiment of the present application.
[0073] See also Figure 6 , Figure 6 is a schematic diagram of the hardware structure of an electronic device 30 for executing a document parsing method provided in an embodiment of the present application, such as Figure 6 As shown, the electronic device 30 includes:
[0074] One or more processors 31 and memory 32, Figure 6 A processor 31 is taken as an example.
[0075] The processor 31 and the memory 32 may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0076] The memory 32 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules, such as program instructions / modules corresponding to the document parsing method in the embodiment of the present application (for example, the attached Figure 5 The processor 31 executes various functional applications and data processing of the server by running the non-volatile software programs, instructions and modules stored in the memory 32, that is, implements the document parsing method of the above method embodiment.
[0077] The memory 32 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required by at least one function; the data storage area may store data created according to the use of the document parsing device, etc. In addition, the memory 32 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 32 may optionally include a memory remotely arranged relative to the processor 31, and these remote memories may be connected to the document parsing device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0078] The one or more modules are stored in the memory 32, and when executed by the one or more processors 31, execute the document parsing method in any of the above method embodiments, for example, execute the document parsing method described above. Figure 1 , Figure 2 , Figure 3 Method steps and implementation Figure 5 The functions of the modules in .
[0079] The above-mentioned product can execute the method provided in the embodiment of the present application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of the present application.
[0080] The electronic devices of the embodiments of the present application exist in various forms, including but not limited to: Personal computer devices: This type of device belongs to the category of personal computers, has computing and processing functions, and generally also has mobile Internet features. Server: A device that provides computing services. The server consists of a processor, hard disk, memory, system bus, etc. The server is similar to a general computer architecture, but because it needs to provide highly reliable services, it has higher requirements in terms of processing power, stability, reliability, security, scalability, manageability, etc. And other electronic devices with data interaction functions.
[0081] The embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by one or more processors, such as Figure 6 A processor 31 in the embodiment may enable the one or more processors to execute the document parsing method in any of the above method embodiments, for example, to execute the above described Figure 1 , Figure 2 , Figure 3 Method steps and implementation Figure 5 The functions of the modules in .
[0082] The present application provides a computer program product, wherein the computer program product includes a computer program stored on a non-volatile computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by the electronic device, the electronic device is enabled to execute the document parsing method in any of the above method embodiments, for example, to execute the above described Figure 1 , Figure 2 , Figure 3 Method steps and implementation Figure 5 The functions of the modules in .
[0083] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0084] Through the description of the above implementation methods, ordinary technicians in this field can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Ordinary technicians in this field can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0085] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Under the concept of the present application, the technical features in the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes in different aspects of the present application as described above, which are not provided in detail for the sake of simplicity. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present application.
Claims
1. A document parsing method, characterized in that: include: Extracting text information and text layout information according to the acquired document to be parsed; Extracting visual information of the document to be parsed; Acquire feature information corresponding to the text information and the text layout information, and acquire feature information corresponding to the visual information; Fusing the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information to obtain target fusion information; According to the target fusion information, a parsing result of the document to be parsed is obtained.
2. The document parsing method according to claim 1, characterized in that: The step of extracting text information and text layout information from the acquired document to be parsed specifically includes: According to the document to be parsed, each character in the document, position information of the character, and area information corresponding to the character are extracted.
3. The document parsing method according to claim 2, characterized in that: The acquiring of the feature information corresponding to the text information and the text layout information comprises: Representing each character in the document as a text character vector; Representing the position information of each character in the document as a position index vector; The region information corresponding to each character in the document is represented as a bounding box vector.
4. The document parsing method according to claim 3, characterized in that: The step of expressing the area information corresponding to each character in the document as a bounding box vector comprises: Acquire the horizontal coordinates and the vertical coordinates of the upper left corner and the lower right corner of the character relative to the page origin according to the area information, and acquire the width and height of the character; Normalizing the horizontal coordinate, the vertical coordinate, the width, and the height to a value in an integer interval, each of which corresponds to a vector; The vectors corresponding to the numerical values are concatenated to obtain a bounding box vector corresponding to the character.
5. The document parsing method according to claim 3, characterized in that: The step of extracting visual information of the document to be parsed specifically includes: The document to be parsed is converted into an image, and a feature map of the image is extracted based on a convolutional neural network.
6. The document parsing method according to claim 5, characterized in that: The acquiring of feature information corresponding to the visual information comprises: Performing a linear transformation on the feature map to obtain a visual vector corresponding to each feature map; Obtain a position number of each feature map, and represent the position number as a position vector corresponding to each feature map; Obtain bounding box information of a region corresponding to each feature map in the image, and obtain a bounding box vector of the feature map according to the bounding box information.
7. The document parsing method according to claim 6, characterized in that: The step of fusing the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information to obtain target fusion information includes: Performing a sum operation on the text character vector, the position index vector, and the bounding box vector corresponding to each character, wherein a result of the sum operation is represented as a text representation of the character; Performing a sum operation on the visual vector, the position vector, and the bounding box vector corresponding to each feature map, wherein a result of the sum operation is represented as a visual representation of the feature map; The text representation of the character and the visual representation of the feature map are the target fusion information.
8. The document parsing method according to claim 7, characterized in that: The obtaining the parsing result of the document to be parsed according to the target fusion information includes: Inputting the text representation of the character and the visual representation of the feature map into a preset multimodal pre-trained language model to output a multimodal vector for each text character; The multimodal vector is input into a preset classification model to output the parsing result of the document to be parsed.
9. A document parsing device, characterized in that: include: A text acquisition module, used to extract text information and text layout information based on the acquired document to be parsed; A visual information acquisition module, used to extract visual information of the document to be parsed; A feature information acquisition module, used to acquire feature information corresponding to the text information and the text layout information, and acquire feature information corresponding to the visual information; A fusion information processing module, used for fusing the feature information corresponding to the text information and the text layout information, and the feature information corresponding to the visual information, to obtain target fusion information; The parsing result acquisition module is used to acquire the parsing result of the document to be parsed according to the target fusion information.
10. An electronic device, characterized in that: include: at least one processor; and a memory communicatively coupled to the at least one processor; The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the document parsing method described in any one of claims 1 to 8.
Citation Information
Cited By
Self-adaptive multi-level document cutting method
CN119166600A
Contract document analysis method and system based on multi-modal adaptive feature fusion
CN121052243A
Contract document analysis method and system based on multi-modal adaptive feature fusion
CN121052243B
Browser control method and device, computer equipment and readable storage medium
CN121614058A
