Document named entity recognition processing method and device and electronic equipment
The adaptive sliding window method is used to encode documents and construct association relationships, which solves the problem of low accuracy of named entity recognition caused by the uncertain input order of document boundary text in optical character recognition technology, and improves the accuracy of named entity recognition.
Patent Information
- Application Number
- CN202410682730.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-29
- Publication Date
- 2024-09-10
AI Technical Summary
In the existing technology, when text at the boundary of a document is recognized through optical character recognition technology, the input sequence cannot be guaranteed, resulting in low accuracy of document named entity recognition and a lack of effective solutions.
The adaptive sliding window method is used to encode the label map of the document, build the association between text blocks, and input the pre-trained target model for named entity recognition to improve the accuracy of named entity recognition.
By building the association between text blocks, the impact of incorrect input order on named entity recognition is avoided, and the accuracy of named entity recognition is improved.
Smart Images

Figure CN118629061A
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, financial technology or other technical fields, and specifically, to a processing method, device and electronic device for document named entity recognition. Background Art
[0002] With the rapid development of the Internet and digital technology, visually rich documents (such as documents, contracts, reports, etc.) are increasingly used in various fields. These documents usually contain multiple modal information such as text and images. It is a challenging task for machines to understand and extract information from them.
[0003] Traditional methods for extracting information from visually rich documents usually use rule-based or template-based methods. These methods work well when processing simple documents, but they are often unsatisfactory for complex documents, especially those containing a large amount of modal information. In recent years, the development of deep learning technology has provided a new solution for extracting information from visually rich documents. Deep learning technology can automatically learn the feature representation of data, thereby achieving tasks such as automatic classification, recognition, and extraction of data. However, traditional deep learning models usually only process information of a single modality, and the processing effect is often poor for visually rich documents that contain multiple modal information such as text and images.
[0004] In the existing technology, multimodal deep learning models can be used to process multiple modal information such as text and images, and by fusing the feature representations of different modalities, effective information extraction of visually rich documents can be achieved. However, there are still some problems with multimodal deep learning models in practical applications. For text that appears at the boundary of rich documents, existing models generally process it through optical character recognition. This processing method relies on the correct input order, which is not always guaranteed in real-world visually rich documents, thereby hindering the accuracy of named entity recognition of boundary text and reducing the recognition effect of the model.
[0005] Regarding the problem in the related art that when optical character recognition technology is used to recognize text that appears at the document boundary, the accuracy of identifying document named entities is low because the input order of the document cannot be guaranteed. No effective solution has been proposed yet. Summary of the invention
[0006] The main purpose of the present application is to provide a processing method, device and electronic device for document named entity recognition, so as to solve the problem in the related art that when optical character recognition technology is used to recognize text appearing at the document boundary, the input order of the document cannot be guaranteed, resulting in low accuracy in identifying document named entities.
[0007] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a processing method for document named entity recognition is provided, the method comprising: obtaining a document to be named entity recognized to obtain a target document, wherein the target document contains content in multiple forms of expression; determining path marks between text blocks in the target document to obtain a tag map of the target document, wherein the path marks refer to the association relationship between the text blocks; encoding the tag map using an adaptive sliding window method to obtain document encoding information; inputting the document encoding information into a target model, performing named entity recognition on the target document, and obtaining a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document dataset and training a preset model using the encoding result.
[0008] Furthermore, an adaptive sliding window method is used to encode the tag graph to obtain document encoding information, including: taking each path tag in the tag graph as a path entity, and determining the entity type corresponding to each path entity in the tag graph; extracting the named entities in the target document, and determining the association relationship between the entity types based on the obtained named entities; expanding the association relationship between the entity types corresponding to each path entity through an adaptive sliding window method, and encoding them to obtain the document encoding information.
[0009] Furthermore, the association relationship between the entity types corresponding to each path entity is expanded through an adaptive sliding window method, and encoded to obtain the document encoding information, including: constructing a sliding window according to a preset initial window size, and placing the sliding window in the text content contained in the target document, and counting the first frequency information of the entity type in the sliding window; position encoding and text encoding the text content in the sliding window according to the first frequency information to obtain partial encoding information of the target document; adjusting the window size of the sliding window according to the partial encoding information of the target document after a preset time period to obtain an adjusted sliding window; encoding the unencoded text content in the target document according to the adjusted sliding window to obtain the document encoding information.
[0010] Furthermore, the unencoded text content in the target document is encoded according to the adjusted sliding window to obtain the document encoding information, including: counting the second frequency information of the entity type in the adjusted sliding window; performing position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information, and updating the encoding information of the target document; and using the adjusted sliding window to perform position encoding and text encoding on the remaining text content of the target document to obtain the document encoding information.
[0011] Furthermore, after position encoding and text encoding are performed on the text content of the adjusted sliding window according to the second frequency information and the encoding information of the target document is updated, the method also includes: evaluating the compression effect of the encoding information obtained through the sliding window to obtain a first score; evaluating the compression effect of the encoding information obtained through the adjusted sliding window to obtain a second score; when the second score is greater than the first score, configuring the window size of the adjusted sliding window to be a first window size, wherein the first window size is greater than the window size of the adjusted sliding window; when the second score is less than or equal to the first score, configuring the window size of the adjusted sliding window to be a second window size, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0012] Furthermore, the path markings between the text blocks in the target document are determined to obtain a marking graph of the target document, including: dividing the target document into blocks to obtain a plurality of text blocks; determining the association relationship between the plurality of text blocks through a preset model to obtain the path markings between the plurality of text blocks; and constructing the marking graph of the target document based on the path markings between the plurality of text blocks.
[0013] Furthermore, before determining the path marks between text blocks in the target document and obtaining the mark map of the target document, the method also includes: removing preset characters contained in the target document to obtain a processed target document; and adjusting the color values of pixels in the processed target document.
[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a processing device for document named entity recognition is provided, which includes: an acquisition unit, used to acquire a document to be named entity recognized, and obtain a target document, wherein the target document contains content in multiple forms of expression; a determination unit, used to determine the path marks between text blocks in the target document, and obtain a tag map of the target document, wherein the path marks refer to the association relationship between the text blocks; an encoding unit, used to encode the tag map using an adaptive sliding window method, and obtain document encoding information; an identification unit, used to input the document encoding information into a target model, perform named entity recognition on the target document, and obtain a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and training a preset model using the encoding result.
[0015] Furthermore, the encoding unit includes: a first determination subunit, used to take each path mark in the tag graph as a path entity, and determine the entity type corresponding to each path entity in the tag graph; an extraction subunit, used to extract the named entities in the target document, and determine the association relationship between the entity types based on the obtained named entities; an encoding subunit, used to expand the association relationship between the entity types corresponding to each path entity through an adaptive sliding window method, and encode to obtain the document encoding information.
[0016] Furthermore, the encoding subunit includes: a calculation module, which is used to construct a sliding window according to a preset initial window size, and place the sliding window in the text content contained in the target document, and count the first frequency information of the entity type in the sliding window; a first encoding module, which is used to perform position encoding and text encoding on the text content in the sliding window according to the first frequency information to obtain partial encoding information of the target document; an adjustment module, which is used to adjust the window size of the sliding window according to the partial encoding information of the target document every preset time period to obtain an adjusted sliding window; a second encoding module, which is used to encode the unencoded text content in the target document according to the adjusted sliding window to obtain the document encoding information.
[0017] Furthermore, the second encoding module includes: a calculation submodule, which is used to count the second frequency information of the entity type in the adjusted sliding window; a first encoding submodule, which is used to perform position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information, and update the encoding information of the target document; and a second encoding submodule, which is used to perform position encoding and text encoding on the remaining text content of the target document using the adjusted sliding window to obtain the document encoding information.
[0018] Furthermore, the second encoding module also includes: a first evaluation submodule, which is used to evaluate the compression effect of the encoded information obtained through the sliding window to obtain a first score after position encoding and text encoding are performed on the text content of the adjusted sliding window according to the second frequency information and the encoding information of the target document is updated; a second evaluation submodule, which is used to evaluate the compression effect of the encoded information obtained through the adjusted sliding window to obtain a second score; a first configuration submodule, which is used to configure the window size of the adjusted sliding window to a first window size when the second score is greater than the first score, wherein the first window size is greater than the window size of the adjusted sliding window; and a second configuration submodule, which is used to configure the window size of the adjusted sliding window to a second window size when the second score is less than or equal to the first score, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0019] Furthermore, the determination unit includes: a segmentation subunit, used to segment the target document into blocks to obtain a plurality of text blocks; a second determination subunit, used to determine the association relationship between the plurality of text blocks through a preset model to obtain path markings between the plurality of text blocks; and a construction subunit, used to construct a marking graph of the target document based on the path markings between the plurality of text blocks.
[0020] Furthermore, the device also includes: a processing unit, which is used to remove preset characters contained in the target document before determining the path marks between text blocks in the target document and obtaining the mark map of the target document to obtain a processed target document; and an adjustment unit, which is used to adjust the color values of pixels in the processed target document.
[0021] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a computer program product is provided, including a computer program, which, when executed by a processor, implements any one of the above-mentioned processing methods for document named entity recognition, and which, when executed by a processor, implements the steps of the processing method for document named entity recognition described in each embodiment of the present application.
[0022] In order to achieve the above-mentioned purpose, according to one aspect of the present application, an electronic device is provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors implement any one of the above-mentioned processing methods for document named entity recognition.
[0023] Through the present application, the following steps are adopted: obtaining a document to be recognized by named entities to obtain a target document, wherein the target document contains content in multiple forms of expression; determining the path marks between text blocks in the target document to obtain a markup map of the target document, wherein the path marks refer to the association relationship between the text blocks; encoding the markup map using an adaptive sliding window method to obtain document encoding information; inputting the document encoding information into a target model, performing named entity recognition on the target document, and obtaining a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and using the encoding result to train a preset model, thereby solving the problem in the related art that when optical character recognition technology is used to recognize text that appears at the document boundary, the accuracy of identifying document named entities is low due to the inability to ensure the input order of the document. By analyzing the document to be recognized by named entities, constructing a markup map containing the association relationship between text blocks, encoding the target document according to the markup map, and performing named entity recognition on the document encoding information, the association relationship between text blocks can be understood more clearly, and the problem that the accuracy of named entity recognition is affected by the wrong document input order is avoided, thereby achieving the effect of improving the accuracy of named entity recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0025] Figure 1 It is a flowchart of a method for processing document named entity recognition provided in Example 1 of the present application;
[0026] Figure 2 It is a schematic diagram of an optional method for processing document named entity recognition provided according to the first embodiment of the present application;
[0027] Figure 3 is a schematic diagram of a processing device for document named entity recognition provided in Embodiment 2 of the present application;
[0028] Figure 4 It is a schematic diagram of an electronic device for processing document named entity recognition provided in Example 5 of the present application. DETAILED DESCRIPTION
[0029] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0030] It should be noted that the methods and devices determined by the processing methods, devices, storage media and electronic devices of the present application documents can be used in the field of financial technology for named entity recognition, thereby improving the accuracy of recognition results, and can also be used in any field other than the field of financial technology. The application fields of the methods and devices determined by the processing methods, devices, storage media and electronic devices of the present application documents are not limited.
[0031] It should be noted that the user information (including but not limited to user device information, user personal information, collected information, used information, generated information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, collected data, used data, generated data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of the relevant areas, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0032] The information collected is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of relevant countries and regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] Provide users with corresponding operation entrances for them to choose to agree or reject the automated decision-making results; if the user chooses to reject, the expert decision-making process will be entered.
[0034] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0036] Embodiment 1
[0037] The present invention is described below in conjunction with preferred implementation steps. Figure 1 is a flowchart of a method for processing document named entity recognition provided in Example 1 of the present application, such as Figure 1 As shown, the method comprises the following steps:
[0038] Step S101, obtaining a document to be recognized by named entities, and obtaining a target document, wherein the target document contains contents in multiple forms.
[0039] In the first embodiment, in order to perform named entity recognition, it is necessary to obtain a target document, wherein the target document refers to a visually rich document, that is, a document containing multiple modal information such as text, images, and links.
[0040] Step S102, determining the path markings between the text blocks in the target document, and obtaining a marking graph of the target document, wherein the path markings refer to the association relationship between the text blocks.
[0041] In the first embodiment of the present invention, in order to understand the text information more accurately, it is necessary to construct a path mark between two text blocks in the target document to characterize the association relationship between the text blocks and obtain the above-mentioned mark graph, so as to more clearly understand the association relationship between the text blocks and more effectively locate and extract relevant information.
[0042] Step S103, encoding the marker image using an adaptive sliding window method to obtain document encoding information.
[0043] In the first embodiment, in order to reduce the impact of document input order on named entity recognition, it is necessary to adopt an adaptive sliding window method to encode according to the obtained tag map, convert the target document into document encoding information, and then perform named entity recognition based on the document encoding information.
[0044] Step S104, input the document encoding information into the target model, perform named entity recognition on the target document, and obtain a recognition result, wherein the target model refers to a model obtained by encoding an unlabeled document dataset and training a preset model using the encoding result.
[0045] In the first embodiment, in order to improve the accuracy of named entity recognition, a self-supervised learning method can be used to train with an unlabeled document data set to obtain the above target model to improve the generalization ability of the model. Then, the target document is input into the trained target model to perform named entity recognition and obtain a recognition result.
[0046] In summary, the processing method for document named entity recognition provided in the first embodiment of the present application obtains a target document by acquiring a document to be named entity recognized, wherein the target document contains content in multiple forms of expression; determines the path marks between text blocks in the target document, and obtains a markup map of the target document, wherein the path marks refer to the association relationship between text blocks; encodes the markup map using an adaptive sliding window method to obtain document encoding information; inputs the document encoding information into a target model, performs named entity recognition on the target document, and obtains a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and training a preset model using the encoding result, which solves the problem in the related art that when optical character recognition technology is used to recognize text appearing at the document boundary, the accuracy of identifying document named entities is low due to the inability to ensure the input order of the document. By analyzing the document to be named entity recognized, constructing a markup map containing the association relationship between text blocks, encoding the target document according to the markup map, and performing named entity recognition on the document encoding information, the association relationship between text blocks can be understood more clearly, and the problem that the incorrect document input order affects the accuracy of named entity recognition can be avoided, thereby achieving the effect of improving the accuracy of named entity recognition.
[0047] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, an adaptive sliding window method is used to encode the tag graph to obtain document encoding information, including: taking each path tag in the tag graph as a path entity, and determining the entity type corresponding to each path entity in the tag graph; extracting the named entities in the target document, and determining the association relationship between the entity types based on the obtained named entities; expanding the association relationship between the entity types corresponding to each path entity through an adaptive sliding window method, and encoding them to obtain document encoding information.
[0048] In an optional embodiment, the document layout can be modeled as a complete tag graph, in which each tag represents a path tag between two text blocks in the document, each path tag in the tag graph is used as a path entity, and a preset entity type is assigned to each tag path, wherein the preset entity type can be: logical connection type, semantic connection type, time connection type, spatial connection type, etc. The logical connection type refers to the existence of a logical relationship between text blocks, such as causal relationship, conditional relationship, comparative relationship, etc.; the semantic connection type refers to the existence of a semantic association between text blocks, such as contrast, transition, continuation, text blocks with the same meaning, text blocks with opposite meanings, and a text block explaining another text block in detail, etc.; the time connection type refers to the existence of a time relationship between text blocks, including sequence, simultaneous occurrence, etc.; the spatial connection type refers to the existence of a spatial relationship between text blocks, such as position relationship, orientation relationship, etc. Then, named entity recognition is performed on the target document to obtain named entities, and the connection between each entity type is obtained based on the obtained named entities. Finally, an adaptive sliding window operation is performed on the entity types at the document boundary to expand the association relationship between entity types.
[0049] By determining the entity type corresponding to each path entity in the tag graph, we can more clearly understand the association relationship between text blocks. By extracting the named entities in the target document and using the adaptive sliding window method to expand the association relationship between entity types, we can extract more comprehensive association relationships in the entire target document, thereby encoding the target document and recognizing named entities, thereby improving the accuracy of named entity recognition.
[0050] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, the association relationship between the entity types corresponding to each path entity is expanded by an adaptive sliding window method, and encoded to obtain document encoding information, including: constructing a sliding window based on a preset initial window size, and placing the sliding window in the text content contained in the target document, and counting the first frequency information of the entity type in the sliding window; position encoding and text encoding the text content in the sliding window based on the first frequency information to obtain partial encoding information of the target document; adjusting the window size of the sliding window based on the partial encoding information of the target document after a preset time period to obtain an adjusted sliding window; encoding the unencoded text content in the target document based on the adjusted sliding window to obtain document encoding information.
[0051] In an optional embodiment, a fixed-size initial window is selected (i.e., the above-mentioned sliding window, which is usually a relatively small window to quickly adapt to the characteristics of the input data), and the frequency of occurrence of the encoded entity type is counted at each window position in the sliding window to obtain the above-mentioned first frequency information, and then position encoding and text encoding are performed according to the first frequency information to obtain partial encoding information of the target document. Then, after a preset time, the window size of the sliding window is adaptively and dynamically adjusted, and the adjusted sliding window is used to continue encoding to obtain the above-mentioned document encoding information.
[0052] By constructing a sliding window and adaptively and dynamically adjusting the window size of the sliding window, the window size can be flexibly adjusted according to actual conditions, better adapting to changes in the encoded data, improving the accuracy and reliability of data encoding, and further achieving the effect of improving the accuracy of named entity recognition.
[0053] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, the unencoded text content in the target document is encoded according to the adjusted sliding window to obtain document encoding information, including: counting the second frequency information of the entity type in the adjusted sliding window; position encoding and text encoding the text content of the adjusted sliding window according to the second frequency information, and updating the encoding information of the target document; and using the adjusted sliding window to position encode and text encode the remaining text content of the target document to obtain document encoding information.
[0054] In an optional embodiment, after adjusting the window size of the sliding window, it is necessary to re-count the frequencies of different entity types in the encoded data to obtain the above-mentioned second frequency information, generate a valid coding table based on the second frequency information, and obtain the above-mentioned document coding information.
[0055] By recounting the frequency of occurrence of different entity types after the sliding window changes, the performance of the encoder is ensured to match the characteristics of the input data, which is beneficial to improving the accuracy of document encoding information and achieving the effect of improving the accuracy of named entity recognition.
[0056] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, after position encoding and text encoding are performed on the text content of the adjusted sliding window based on the second frequency information and the encoding information of the target document is updated, the above method also includes: evaluating the compression effect of the encoding information obtained by the sliding window to obtain a first score; evaluating the compression effect of the encoding information obtained by the adjusted sliding window to obtain a second score; when the second score is greater than the first score, configuring the window size of the adjusted sliding window to be the first window size, wherein the first window size is greater than the window size of the adjusted sliding window; when the second score is less than or equal to the first score, configuring the window size of the adjusted sliding window to be the second window size, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0057] In an optional embodiment, the sliding window encoding process can be as follows: a sliding window is set at the unencoded character, and the string in the sliding window is matched. If a matching string is found in the sliding window, a three-element symbol group (off, len, c) is output, indicating that the data at the current position can be replaced by a string at a certain position in the sliding window and an additional character, wherein off is the offset of the matched string in the window relative to the boundary position of the sliding window, len is the length of the matched string, and c is the next character following the matched string; if no matching string is found in the sliding window, a special three-element symbol group (0, 0, c) is output, indicating that the current character is the latest and no string is matched, wherein c represents the character at the current position; then, according to the output three-element symbol group, the sliding window is moved backward by a certain distance (for example, len+1 characters are moved backward), so that the sliding window contains new unencoded data, and the next compression is performed until all data has been encoded.
[0058] In an optional embodiment, the size of the window can be dynamically adjusted according to the data that has been encoded and the data to be encoded. Specifically, the compression effect before the sliding window changes (i.e., the first score mentioned above) and the compression effect before the sliding window changes (i.e., the second score mentioned above) can be evaluated. If the first score is greater than the second score, it proves that the compression effect after the sliding window changes is better than before the change, and the window size of the sliding window can continue to increase, that is, the window size of the sliding window after the above configuration adjustment is the first window size; if the first score is less than or equal to the second score, it proves that the compression effect before the sliding window changes is better than after the change, so the window size of the sliding window can be reduced, that is, the window size of the sliding window after the above configuration adjustment is the second window size.
[0059] By evaluating the compression effect before and after the sliding window changes, the window size of the sliding window can be flexibly adjusted according to actual conditions, thereby achieving the effect of improving the compression effect of the encoding.
[0060] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, the path marks between text blocks in the target document are determined to obtain a marking graph of the target document, including: dividing the target document into blocks to obtain multiple text blocks; determining the association relationship between the multiple text blocks through a preset model to obtain the path marks between the multiple text blocks; and constructing a marking graph of the target document based on the path marks between the multiple text blocks.
[0061] In an optional embodiment, the target document can be divided into blocks. For example, the document can be divided into different parts according to the subject or content of the document, each part contains a specific subject or content; or different text blocks can be identified according to the title and subtitle in the document; or the document can be divided into blocks according to the paragraphs, sentences or words in the document. Then, a preset model (for example, a transformer model, etc.) is used to extract the association relationship between the text blocks to obtain the path markings between the above-mentioned multiple text blocks. Finally, a marking graph of the target document is constructed according to the path markings between the multiple text blocks.
[0062] By constructing a label graph of the target document, the association between text blocks in the target document can be captured, thereby avoiding the problem of incorrect document input order leading to low accuracy in named entity recognition, thereby achieving the effect of improving the accuracy of named entity recognition.
[0063] Optionally, in the processing method for document named entity recognition provided in Example 1 of the present application, before determining the path marks between text blocks in the target document and obtaining the mark map of the target document, the above method also includes: removing preset characters contained in the target document to obtain a processed target document; and adjusting the color values of pixels in the processed target document.
[0064] In the first embodiment, in order to avoid reducing the impact of redundant information in the target document on named entity recognition, the target document can be preprocessed before determining the path markers between text blocks, including text cleaning, image enhancement and other operations, to improve the training effect of the model. Text cleaning refers to removing some unimportant text in the target document (i.e., the preset characters mentioned above, for example, modal particles, stop words, etc.). Image enhancement refers to adjusting the color values of pixels in the target document after text cleaning (i.e., the processed target document mentioned above), or removing background information in the target document.
[0065] Optionally, in the first embodiment, the process of performing named entity recognition in the present solution can be as follows: Figure 2As shown in FIG, visually rich document data is collected to obtain a document dataset; preprocessing operations (for example, the above-mentioned text cleaning and image enhancement) are performed on the documents in the document dataset to update the document dataset; a multimodal pre-training technology is used to train a preset model (such as Figure 2 The document boundary information extraction model in is used for training to obtain a target model, wherein the multimodal pre-training technology refers to a method of extracting features from multimodal data and effectively combining multimodal features to improve the performance and generalization ability of the model. The multimodal pre-training technology may include the following steps: data preprocessing (e.g., text cleaning, image cropping, audio processing, etc.), extracting features from each modal information and fusing multiple modal features, using the fused multimodal features to train the model, optimizing and adjusting the trained model according to different tasks (e.g., named entity recognition tasks, entity linking tasks, reading order prediction tasks, etc.); using the target model (e.g., Figure 2 The document boundary information extraction model trained in the training is used to perform multiple visual rich document tasks. For example, in the named entity recognition task, the target model is used to process the text information to achieve effective recognition of entities in the text information; in the entity linking task, the target model's ability to process image and text information is used to achieve effective linking of entities in the image; in the reading order prediction task, the target model is used to predict the reading order of visual rich documents to improve the model's reading comprehension ability.
[0066] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0067] Embodiment 2
[0068] Embodiment 2 of the present application also provides a processing device for document named entity recognition. It should be noted that the processing device for document named entity recognition of Embodiment 2 of the present application can be used to execute the processing method for document named entity recognition provided in Embodiment 1 of the present application. The processing device for document named entity recognition provided in Embodiment 2 of the present application is introduced below.
[0069] Figure 3 Schematic diagram of a device for processing document named entity recognition according to Embodiment 2 of the present application. Figure 3 As shown, the device includes: an acquisition unit 301, a determination unit 302, an encoding unit 303 and an identification unit 304.
[0070] Specifically, the acquisition unit 301 is used to acquire a document to be recognized by a named entity to obtain a target document, wherein the target document contains contents in multiple forms.
[0071] The determination unit 302 is used to determine the path marks between the text blocks in the target document to obtain a mark map of the target document, wherein the path marks refer to the association relationship between the text blocks.
[0072] The encoding unit 303 is used to encode the tag image using an adaptive sliding window method to obtain document encoding information.
[0073] The recognition unit 304 is used to input the document encoding information into the target model, perform named entity recognition on the target document, and obtain a recognition result, wherein the target model refers to a model obtained by encoding an unlabeled document data set and using the encoding result to train a preset model.
[0074] The processing device for document named entity recognition provided in the second embodiment of the present application obtains the document to be named entity recognized by the acquisition unit 301 to obtain the target document, wherein the target document contains content in multiple forms; the determination unit 302 determines the path marks between the text blocks in the target document to obtain the tag map of the target document, wherein the path marks refer to the association relationship between the text blocks; the encoding unit 303 encodes the tag map by an adaptive sliding window method to obtain document encoding information; the recognition unit 304 inputs the document encoding information into the target model, performs named entity recognition on the target document, and obtains a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and training a preset model with the encoding result, thereby solving the problem in the related art that when recognizing text appearing at the document boundary by optical character recognition technology, the accuracy of recognizing document named entities is low due to the inability to ensure the input order of the document. By analyzing the documents to be named entities recognized, constructing a label graph containing the association relationships between text blocks, encoding the target document according to the label graph, and performing named entity recognition on the document encoding information, we can more clearly understand the association relationships between text blocks and avoid the problem of incorrect document input order affecting the accuracy of named entity recognition, thereby achieving the effect of improving the accuracy of named entity recognition.
[0075] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned encoding unit 303 includes: a first determination subunit, used to take each path mark in the marking graph as a path entity, and determine the entity type corresponding to each path entity in the marking graph; an extraction subunit, used to extract the named entities in the target document, and determine the association relationship between the entity types based on the obtained named entities; an encoding subunit, used to expand the association relationship between the entity types corresponding to each path entity through an adaptive sliding window method, and encode it to obtain document encoding information.
[0076] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned encoding subunit includes: a calculation module, which is used to construct a sliding window based on a preset initial window size, and place the sliding window in the text content contained in the target document, and count the first frequency information of the entity type in the sliding window; a first encoding module, which is used to perform position encoding and text encoding on the text content in the sliding window based on the first frequency information to obtain partial encoding information of the target document; an adjustment module, which is used to adjust the window size of the sliding window based on the partial encoding information of the target document after a preset time period to obtain an adjusted sliding window; and a second encoding module, which is used to encode the unencoded text content in the target document based on the adjusted sliding window to obtain document encoding information.
[0077] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned second encoding module includes: a calculation submodule, used to count the second frequency information of the entity type in the adjusted sliding window; a first encoding submodule, used to perform position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information, and update the encoding information of the target document; a second encoding submodule, used to use the adjusted sliding window to perform position encoding and text encoding on the remaining text content of the target document to obtain document encoding information.
[0078] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned second encoding module also includes: a first evaluation submodule, which is used to perform position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information, and after updating the encoding information of the target document, evaluate the compression effect of the encoding information obtained by the sliding window to obtain a first score; a second evaluation submodule, which is used to evaluate the compression effect of the encoding information obtained by the adjusted sliding window to obtain a second score; a first configuration submodule, which is used to configure the window size of the adjusted sliding window to the first window size when the second score is greater than the first score, wherein the first window size is greater than the window size of the adjusted sliding window; and a second configuration submodule, which is used to configure the window size of the adjusted sliding window to the second window size when the second score is less than or equal to the first score, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0079] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned determination unit 302 includes: a segmentation sub-unit, used to segment the target document to obtain multiple text blocks; a second determination sub-unit, used to determine the association relationship between multiple text blocks through a preset model, and obtain path marks between multiple text blocks; a construction sub-unit, used to construct a marking graph of the target document based on the path marks between multiple text blocks.
[0080] Optionally, in the processing device for document named entity recognition provided in Example 2 of the present application, the above-mentioned device also includes: a processing unit, which is used to remove preset characters contained in the target document before determining the path marks between text blocks in the target document and obtaining the mark map of the target document to obtain a processed target document; and an adjustment unit, which is used to adjust the color values of pixels in the processed target document.
[0081] The processing device for document named entity recognition includes a processor and a memory. The above-mentioned acquisition unit 301, determination unit 302, encoding unit 303 and recognition unit 304 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0082] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the recognition accuracy of named entity recognition can be improved by adjusting kernel parameters.
[0083] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0084] Embodiment 3 of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, a processing method for document named entity recognition is implemented.
[0085] Embodiment 4 of the present invention provides a processor, which is used to run a program, wherein the program executes a processing method for document named entity recognition when running.
[0086] like Figure 4 As shown, embodiment 5 of the present invention provides an electronic device, the device includes a processor, a memory, and a program stored in the memory and executable on the processor, and the processor implements the following steps when executing the program: obtaining a document to be named entity recognized to obtain a target document, wherein the target document contains content in multiple forms; determining path marks between text blocks in the target document to obtain a marking graph of the target document, wherein the path marks refer to the association relationship between text blocks; encoding the marking graph using an adaptive sliding window method to obtain document encoding information; inputting the document encoding information into a target model, performing named entity recognition on the target document, and obtaining a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and training a preset model using the encoding result.
[0087] When the processor executes the program, the following steps are also implemented: the tag graph is encoded using an adaptive sliding window method to obtain document encoding information, including: taking each path tag in the tag graph as a path entity, and determining the entity type corresponding to each path entity in the tag graph; extracting the named entities in the target document, and determining the association relationship between the entity types based on the obtained named entities; expanding the association relationship between the entity types corresponding to each path entity through an adaptive sliding window method, and encoding them to obtain document encoding information.
[0088] When the processor executes the program, the following steps are also implemented: the association relationship between the entity types corresponding to each path entity is expanded by an adaptive sliding window method, and encoding is performed to obtain document encoding information, including: constructing a sliding window according to a preset initial window size, and placing the sliding window in the text content contained in the target document, and counting the first frequency information of the entity type in the sliding window; position encoding and text encoding the text content in the sliding window according to the first frequency information to obtain partial encoding information of the target document; adjusting the window size of the sliding window according to the partial encoding information of the target document after each preset time period to obtain an adjusted sliding window; encoding the unencoded text content in the target document according to the adjusted sliding window to obtain document encoding information.
[0089] When the processor executes the program, the following steps are also implemented: encoding the unencoded text content in the target document based on the adjusted sliding window to obtain document encoding information, including: counting the second frequency information of the entity type in the adjusted sliding window; performing position encoding and text encoding on the text content of the adjusted sliding window based on the second frequency information, and updating the encoding information of the target document; using the adjusted sliding window to perform position encoding and text encoding on the remaining text content of the target document to obtain document encoding information.
[0090] When the processor executes the program, the following steps are also implemented: after position encoding and text encoding are performed on the text content of the adjusted sliding window according to the second frequency information and the encoding information of the target document is updated, the above method also includes: evaluating the compression effect of the encoding information obtained through the sliding window to obtain a first score; evaluating the compression effect of the encoding information obtained through the adjusted sliding window to obtain a second score; when the second score is greater than the first score, configuring the window size of the adjusted sliding window to be the first window size, wherein the first window size is greater than the window size of the adjusted sliding window; when the second score is less than or equal to the first score, configuring the window size of the adjusted sliding window to be the second window size, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0091] When the processor executes the program, the following steps are also implemented: determining the path marks between text blocks in the target document to obtain a marking graph of the target document, including: dividing the target document into blocks to obtain multiple text blocks; determining the association relationship between the multiple text blocks through a preset model to obtain the path marks between the multiple text blocks; and constructing a marking graph of the target document based on the path marks between the multiple text blocks.
[0092] When the processor executes the program, the following steps are also implemented: before determining the path marks between text blocks in the target document and obtaining the mark map of the target document, the above method also includes: removing preset characters contained in the target document to obtain a processed target document; and adjusting the color values of pixels in the processed target document.
[0093] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0094] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program that initializes the following method steps: obtaining a document to be named entity recognized to obtain a target document, wherein the target document contains content in multiple forms; determining path marks between text blocks in the target document to obtain a tag map of the target document, wherein the path marks refer to the association relationship between text blocks; encoding the tag map using an adaptive sliding window method to obtain document encoding information; inputting the document encoding information into a target model, performing named entity recognition on the target document, and obtaining a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and training a preset model using the encoding result.
[0095] When executed on a data processing device, it is also suitable for executing a program that is initialized with the following method steps: using an adaptive sliding window method to encode the tag graph to obtain document encoding information, including: taking each path tag in the tag graph as a path entity, and determining the entity type corresponding to each path entity in the tag graph; extracting named entities in the target document, and determining the association relationship between entity types based on the obtained named entities; expanding the association relationship between entity types corresponding to each path entity through an adaptive sliding window method, and encoding them to obtain document encoding information.
[0096] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: expanding the association relationship between entity types corresponding to each path entity through an adaptive sliding window method, and encoding to obtain document encoding information, including: constructing a sliding window according to a preset initial window size, and placing the sliding window in the text content contained in the target document, and counting the first frequency information of the entity type in the sliding window; position encoding and text encoding the text content in the sliding window according to the first frequency information to obtain partial encoding information of the target document; adjusting the window size of the sliding window according to the partial encoding information of the target document after a preset time period, to obtain an adjusted sliding window; encoding the unencoded text content in the target document according to the adjusted sliding window to obtain document encoding information.
[0097] When executed on a data processing device, it is also suitable for executing an initialization program having the following method steps: encoding the unencoded text content in the target document according to the adjusted sliding window to obtain document encoding information, including: counting the second frequency information of the entity type in the adjusted sliding window; position encoding and text encoding the text content of the adjusted sliding window according to the second frequency information, and updating the encoding information of the target document; using the adjusted sliding window to position encode and text encode the remaining text content of the target document to obtain document encoding information.
[0098] When executed on a data processing device, it is also suitable for executing a program initialized with the following method steps: after position encoding and text encoding are performed on the text content of the adjusted sliding window based on the second frequency information and the encoding information of the target document is updated, the above method also includes: evaluating the compression effect of the encoding information obtained by the sliding window to obtain a first score; evaluating the compression effect of the encoding information obtained by the adjusted sliding window to obtain a second score; when the second score is greater than the first score, configuring the window size of the adjusted sliding window to be the first window size, wherein the first window size is greater than the window size of the adjusted sliding window; when the second score is less than or equal to the first score, configuring the window size of the adjusted sliding window to be the second window size, wherein the second window size is smaller than the window size of the adjusted sliding window.
[0099] When executed on a data processing device, it is also suitable for executing a program that initializes the following method steps: determining the path marks between text blocks in the target document to obtain a marking map of the target document, including: dividing the target document into blocks to obtain multiple text blocks; determining the association relationship between the multiple text blocks through a preset model to obtain the path marks between the multiple text blocks; and constructing the marking map of the target document based on the path marks between the multiple text blocks.
[0100] When executed on a data processing device, it is also suitable for executing an initialized program having the following method steps: before determining the path marks between text blocks in the target document and obtaining the mark map of the target document, the above method also includes: removing preset characters contained in the target document to obtain a processed target document; and adjusting the color values of pixels in the processed target document.
[0101] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0102] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0103] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0104] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0105] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0106] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0107] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0108] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0110] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the claims of the present application.
Claims
1. A method for processing document named entity recognition, characterized in that: include: Acquire a document to be recognized by named entities to obtain a target document, wherein the target document contains content in multiple forms; Determine path marks between text blocks in the target document to obtain a markup graph of the target document, wherein the path marks refer to association relationships between the text blocks; Encoding the tag image using an adaptive sliding window method to obtain document encoding information; The document encoding information is input into the target model, and named entity recognition is performed on the target document to obtain a recognition result, wherein the target model refers to a model obtained by encoding an unlabeled document dataset and training a preset model using the encoding result.
2. The method according to claim 1, characterized in that: The tag image is encoded using an adaptive sliding window method to obtain document encoding information, including: Taking each path mark in the marked graph as a path entity, determining an entity type corresponding to each path entity in the marked graph; Extracting named entities from the target document, and determining association relationships between entity types based on the obtained named entities; The association relationship between entity types corresponding to each path entity is expanded through an adaptive sliding window method, and encoded to obtain the document encoding information.
3. The method according to claim 2, characterized in that The association relationship between entity types corresponding to each path entity is expanded by an adaptive sliding window method, and encoded to obtain the document encoding information, including: Constructing a sliding window according to a preset initial window size, placing the sliding window in the text content contained in the target document, and counting first frequency information of the entity type in the sliding window; Performing position encoding and text encoding on the text content in the sliding window according to the first frequency information to obtain partial encoding information of the target document; Adjusting the window size of the sliding window according to the partial encoding information of the target document every preset time period to obtain an adjusted sliding window; The unencoded text content in the target document is encoded according to the adjusted sliding window to obtain the document encoding information.
4. The method according to claim 3, characterized in that Encoding the unencoded text content in the target document according to the adjusted sliding window to obtain the document encoding information includes: Counting second frequency information of the entity type in the adjusted sliding window; Performing position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information, and updating the encoding information of the target document; The adjusted sliding window is used to perform position encoding and text encoding on the remaining text content of the target document to obtain the document encoding information.
5. The method according to claim 4, characterized in that After performing position encoding and text encoding on the text content of the adjusted sliding window according to the second frequency information and updating the encoding information of the target document, the method further includes: Evaluating the compression effect of the encoded information obtained through the sliding window to obtain a first score; evaluating a compression effect of the coded information obtained by the adjusted sliding window to obtain a second score; When the second score is greater than the first score, configuring the adjusted window size of the sliding window to be a first window size, wherein the first window size is greater than the adjusted window size of the sliding window; When the second score is less than or equal to the first score, the window size of the adjusted sliding window is configured to be a second window size, wherein the second window size is smaller than the window size of the adjusted sliding window.
6. The method according to claim 1, characterized in that Determining path marks between text blocks in the target document to obtain a markup graph of the target document includes: Dividing the target document into blocks to obtain multiple text blocks; Determine the association relationship between the multiple text blocks through a preset model to obtain path marks between the multiple text blocks; A tag graph of the target document is constructed according to the path tags between the multiple text blocks.
7. The method according to claim 1, characterized in that Before determining the path marks between the text blocks in the target document and obtaining the mark map of the target document, the method further includes: Removing the preset characters contained in the target document to obtain a processed target document; The color values of the pixels in the processed target document are adjusted.
8. A device for processing document named entity recognition, characterized in that: include: An acquisition unit, used to acquire a document to be recognized by a named entity, and obtain a target document, wherein the target document contains contents in multiple forms of expression; A determination unit, configured to determine path marks between text blocks in the target document to obtain a mark graph of the target document, wherein the path marks refer to association relationships between the text blocks; An encoding unit, used for encoding the tag image by using an adaptive sliding window method to obtain document encoding information; The recognition unit is used to input the document encoding information into the target model, perform named entity recognition on the target document, and obtain a recognition result, wherein the target model refers to a model obtained after encoding an unlabeled document data set and using the encoding result to train a preset model.
9. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method for processing document named entity recognition described in any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the processing method for document named entity recognition as described in any one of claims 1 to 7.
