Document processing, recognition model training method, device, equipment and storage medium

By identifying object categories and identifying object scores in the document, determining the identification results of the document, and adjusting network parameters to train the recognition model, the problem of length limitation and difficulty in nesting identification of entities in document information extraction is solved, and a more efficient and consistent information extraction effect is achieved.

CN114547301BActive Publication Date: 2025-03-18BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210159137.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-21
Publication Date
2025-03-18
Estimated Expiration
2042-02-21

AI Technical Summary

Technical Problem

In the prior art, in document information extraction, there are problems such as processing document length limitation, difficulty in entity nesting recognition, and inconsistent training and prediction results, resulting in poor information extraction effect.

Method used

By obtaining pending documents, identifying the object collection, including object categories, identifying objects and their scores, determining the identification results of the document, and training the recognition model to solve the problems of entity nesting and training prediction consistency by adjusting preset network parameters.

Benefits of technology

It improves the accuracy and consistency of document information extraction, enhances the processing ability of long documents and complex structure documents, and improves the effect of information extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547301B_ABST
    Figure CN114547301B_ABST
Patent Text Reader

Abstract

The present disclosure provides a document processing, recognition model training method, device, equipment and storage medium, which relate to the field of data processing technology, and in particular to the field of deep learning, natural language processing, and deep search technology. Among them, the document processing method includes: processing the acquired document to be processed to obtain a set of recognition objects in the document to be processed, and determining the recognition result of the document to be processed according to the recognition score of the recognition object included in the object category in the recognition object set. The recognition model training method includes: inputting the text sample of the acquired text sample set into a preset network to obtain the object recognition result of the text sample, and then combining the object annotation information carried by the text sample, adjusting the parameters of the preset network to obtain an object recognition model. This technical solution can accurately identify the object category in the document and the recognition object corresponding to the object category, thereby improving the information extraction effect of the document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical fields of deep learning, natural language processing, and deep search in data processing, and in particular to a document processing, recognition model training method, device, equipment, and storage medium. Background Art

[0002] Document intelligence refers to the process of computers automatically reading, understanding and analyzing documents. The popularity of deep learning technology has greatly promoted the development of document intelligence represented by document information extraction. Document information extraction refers to identifying or extracting key information from documents.

[0003] In the related art, document information extraction methods mainly use named entity recognition (NER) schemes and machine reading comprehension (MRC) methods to extract key information from documents. However, the above methods have requirements on the length of the processed documents, and when there are entity nesting in the document, there may be inconsistencies between the training and prediction results, resulting in poor information extraction effects. Summary of the invention

[0004] The present invention provides a document processing, recognition model training method, device, equipment and storage medium.

[0005] According to a first aspect of the present disclosure, there is provided a document processing method, comprising:

[0006] Get the documents to be processed;

[0007] Processing the document to be processed to obtain a set of recognized objects in the document to be processed, wherein the set of recognized objects includes: an object category, recognized objects included in the object category, and recognition scores of the recognized objects;

[0008] The recognition result of the document to be processed is determined according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects.

[0009] According to a second aspect of the present disclosure, a recognition model training method is provided, comprising:

[0010] Acquire a text sample set, wherein the text samples in the text sample set carry object annotation information;

[0011] Inputting a text sample in the text sample set into a preset network to obtain an object recognition result of the text sample, wherein a target recognition object corresponding to an object recognition category in the object recognition result is determined based on a recognition score;

[0012] According to the object annotation information carried by the text sample and the object recognition result of the text sample, the parameters of the preset network are adjusted to obtain an object recognition model.

[0013] According to a third aspect of the present disclosure, there is provided a document processing device, comprising:

[0014] An acquisition unit, used for acquiring documents to be processed;

[0015] A processing unit, configured to process the document to be processed to obtain a set of recognized objects in the document to be processed, wherein the set of recognized objects includes: an object category, recognized objects included in the object category, and recognition scores of the recognized objects;

[0016] The determination unit is used to determine the recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects.

[0017] According to a fourth aspect of the present disclosure, a recognition model training device is provided, comprising:

[0018] An acquisition unit, used to acquire a text sample set, wherein the text samples in the text sample set carry object annotation information;

[0019] A processing unit, configured to input a text sample in the text sample set into a preset network to obtain an object recognition result of the text sample, wherein a target recognition object corresponding to an object recognition category in the object recognition result is determined based on a recognition score;

[0020] The adjustment unit adjusts the parameters of the preset network according to the object annotation information carried by the text sample and the object recognition result of the text sample to obtain an object recognition model.

[0021] According to a fifth aspect of the present disclosure, there is provided an electronic device, including:

[0022] at least one processor; and

[0023] a memory communicatively connected to the at least one processor; wherein,

[0024] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the method described in the first aspect, or execute the method described in the second aspect.

[0025] According to a sixth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute the method described in the first aspect, or to execute the method described in the second aspect.

[0026] According to the seventh aspect of the present disclosure, a computer program product is provided, comprising: a computer program, wherein the computer program is stored in a readable storage medium, and at least one processor of an electronic device can read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the electronic device executes the method described in the first aspect, or executes the method described in the second aspect.

[0027] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.

[0029] Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure;

[0030] Figure 2 is a flowchart of a document processing method provided by the first embodiment of the present disclosure;

[0031] Figure 3 is a flowchart of a document processing method provided by the second embodiment of the present disclosure;

[0032] Figure 4 is a flowchart of a document processing method provided by the third embodiment of the present disclosure;

[0033] Figure 5 is a flowchart of a recognition model training method provided by the first embodiment of the present disclosure;

[0034] Figure 6 is a flowchart of a recognition model training method provided in the second embodiment of the present disclosure;

[0035] Figure 7 is a flowchart of a recognition model training method provided in the third embodiment of the present disclosure;

[0036] Figure 8 It is a schematic diagram of an architecture provided by an embodiment of the present disclosure;

[0037] Fig. 9 It is a flowchart of splitting and processing of plain text documents;

[0038] Fig.10 is a structural schematic diagram of a document processing device provided by an embodiment of the present disclosure;

[0039] Fig.11 is a structural schematic diagram of a recognition model training device provided by an embodiment of the present disclosure;

[0040] Fig.12 A schematic block diagram of an example electronic device for implementing an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0041] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.

[0042] At present, for the extraction of document information, such as word documents, PDF documents, and text documents, the industry usually uses NER solutions and MRC methods to extract key information from documents. However, mainstream information extraction is usually dedicated to processing shorter documents. For example, the maximum number of tokens processed by bidirectional encoder representations from transformers (BERT) is generally 512, and it is helpless for document data with tens of thousands of tokens or dozens or hundreds of pages (for example, Word documents). Moreover, real document data not only has the characteristics of long length, but also has multiple layouts and complex article structures. These document characteristics bring challenges to information extraction. Among them, BERT is a pre-trained language representation model.

[0043] In the deep learning of related technologies, the extended position encoding method is usually used to extract key information from long texts. For example, relative position encoding is used instead of absolute position encoding or rotary position encoding (RoPE) to expand the number of tokens that models such as BERT can process from the limit of 512 to very long sequences. The advantage of this method is that when the model is input, very long text (the entire text information of a word document) can be passed in for encoding processing; the disadvantage is that the increase in the length of the input text means that the consumption of processing (graphics card) resources will also increase sharply during training and inference. Moreover, for very long texts, the model cannot capture the contextual semantics of a very large span, resulting in poor extraction results.

[0044] For example, the NER task used in the related art for entity extraction will have the problem of inconsistency between training and prediction. For example, the BIO labeling method is used for entity extraction in the NER task. The BIO labeling method refers to labeling each element as "BX", "IX" or "O", where "BX" means that the segment where this element is located belongs to type X and this element is at the beginning of this segment, "IX" means that the segment where this element is located belongs to type X and this element is in the middle of this segment, and "O" means that it does not belong to any type. That is, when using the NER task for entity extraction, for an entity, each character is marked as one of the three types of B, I, and O, and then the probability of each entity character being divided into B and I is optimized in the model training stage to maximize it; however, when the model is predicting and evaluating, it is necessary to evaluate the dimensions of the entity, that is, to calculate whether the entity is recognized and whether the recognition is accurate, and then calculate multiple evaluation indicators, such as accuracy, precision, recall, and F1 value. So there is a problem, that is, the model is trained and optimized at the character level, but when evaluated at the entity level, there will be inconsistencies between training and prediction.

[0045] Among them, the accuracy rate (Accuracy) in the evaluation index is positioned as: for a given test data set, the ratio of the number of samples correctly classified by the classifier to the total number of samples; precision rate (precision) is the ratio of all "correctly retrieved items (TP)" to all "actually retrieved items (correct retrieved items (TP) + incorrectly retrieved items (FP))"; recall rate (recall) is the ratio of all "correctly retrieved items (TP)" to all "items that should be retrieved (TP+FN)"; F1 value = accuracy rate * recall rate * 2 / (accuracy rate + recall rate).

[0046] For example, the BIO tagging method cannot solve the problem of entity nesting. For example, "xx University" is nested with two entities, "place name" and "institution name", where "xx" belongs to the place name and "xx University" belongs to the institution name. In the extraction process, both "xx" and "xx University" need to be identified at the same time. However, when annotating before model training, they can only be annotated in one form, that is, either annotated as:

[0047] [B-Location, I-Location, O, O], or marked as: [B-Organization, I-Organization, I-Organization, I-Organization]. Therefore, a marking sequence cannot extract "place name" and "organization name", so there is a problem that cannot solve the entity nesting problem.

[0048] In addition, in related technologies, the MRC method is usually used for entity extraction or question-answering. For example, for a text, there will be a question (or query, question), and then an answer will be given to the question. The answer is the target entity, which is one or more subsequences existing in the text. Its essence is the use of a pointer network, that is, generally two modules are required to identify the index of the first and last parts of the entity respectively. Similarly, when predicting, it is also an entity-level prediction, and there will also be problems of inconsistency between training and prediction.

[0049] In response to the above technical problems, the technical conception process of the technical solution of the present invention is as follows: the inventors found that using NER tasks or MRC tasks for entity extraction will face inconsistency between training and prediction to a certain extent. This is mainly due to the inability to solve the problem of entity nesting due to the inability of one annotation sequence to annotate multiple entities at the same time. Therefore, during the document processing process, the embodiment of the present invention can determine the object category in the document to be processed, the recognition objects included in the object category, and the recognition scores of the recognition objects, thereby determining the recognition objects included in the object category based on the recognition scores of the recognition objects. This method can obtain a higher accuracy rate for each object category. In addition, due to the consistency of training and reasoning tasks, the recall rate index is also greatly improved, thereby improving the information extraction effect.

[0050] Based on the above-mentioned conceptual process, an embodiment of the present disclosure provides a document processing method, which processes the acquired document to be processed to obtain a set of recognition objects in the document to be processed, and the recognition object set includes: object categories, recognition objects included in the object categories, and recognition scores of the recognition objects. According to the recognition objects included in the object categories in the recognition object set and the recognition scores of the recognition objects, the recognition result of the document to be processed is determined, thereby improving the information processing result.

[0051] Furthermore, an embodiment of the present disclosure also provides a recognition model training method, by obtaining a text sample set, the text samples in the text sample set carrying object annotation information, inputting the text samples in the text sample set into a preset network, obtaining an object recognition result of the text sample, and the target recognition object corresponding to the object recognition category in the object recognition result is determined based on the recognition score, and according to the object annotation information carried by the text sample and the object recognition result of the text sample, the parameters of the preset network are adjusted to obtain an object recognition model, thereby solving the problem of inconsistency between training and prediction.

[0052] It is understood that in the embodiments of the present disclosure, the "object recognition model" is also referred to as a "model", which can receive a document to be processed and determine a set of recognized objects in the document to be processed based on the received document to be processed and the current model parameters. Optionally, the object recognition model can be a regression model, an artificial neural network (ANN), a deep neural network (DNN), a support vector machine (SVM) or other machine learning models, etc. The embodiments of the present disclosure do not limit them.

[0053] For example, Figure 1 is a schematic diagram of an application scenario provided by an embodiment of the present disclosure. Figure 1 As shown, the application scenario may include: two stages; wherein:

[0054] The first stage is the training stage of the recognition model.

[0055] In the training phase of the recognition model, the object recognition model is a model for identifying the object categories included in the document to be processed, the recognition objects included in the object categories, and the recognition scores of the recognition objects. In the application scenario of the present disclosure, by inputting text samples in the text sample set into a preset network, the preset network is trained based on the object recognition results of the text samples and the object annotation information carried by the text samples, and the object recognition model is obtained.

[0056] Optionally, the text sample in the embodiment of the present disclosure is a text that has been segmented, and the annotation of the text sample adopts an annotation method that ensures the context of the object, which can ensure consistency during training and subsequent applications.

[0057] For example, in the embodiments of the present disclosure, see Figure 1 The training device can obtain a document collection from N document libraries, then extract at least one document from the document collection, and obtain a text collection after segmentation, and then obtain a text sample set formed by object annotation of the text in the text collection, and then use the preset network to perform object recognition on the text samples in the text sample set to obtain the object recognition result of the text sample, and finally adjust the parameters of the preset network according to the object annotation information carried by the text sample and the object recognition result of the text sample to obtain the object recognition model.

[0058] The second stage is the stage of object recognition using the object recognition model.

[0059] In the stage of using the object recognition model to perform object recognition, continue to refer to Figure 1The object recognition model obtained by the training in the first stage can be loaded into the processing device. The processing device processes the document to be processed using the object recognition model. Optionally, the processing device can also be called an intelligent device.

[0060] Exemplarily, the document to be processed is input into a processing device for processing to obtain a set of recognition objects in the document to be processed, the set of recognition objects including: object categories, object categories including recognition objects, and recognition scores of recognition objects, and the recognition result of the document to be processed is determined based on the recognition objects included in the object categories in the recognition object set and the recognition scores of the recognition objects.

[0061] It is understandable that the embodiments of the present disclosure do not limit the number of object categories included in the identification object set and the number of identification objects included in each object category, which can be determined according to the actual scenario. For example, the number of object categories and the number of identification objects included in each object category can both be at least one.

[0062] It should be noted that Figure 1 It is only a schematic diagram of an application scenario provided by an embodiment of the present disclosure. The embodiment of the present disclosure does not limit the specific devices included in the application scenario. For example, the application scenario may also include: a document parsing device, a storage device, etc.

[0063] For example, in Figure 1 In the application scenario shown, the document parsing device can parse the acquired non-text document based on the received parsing instruction, and transmit the parsed text document to the processing device for processing to obtain the recognition result of the text document.

[0064] Optionally, the storage device in this embodiment may be used to store recognition results, and may be an independent device or integrated in a processing platform.

[0065] Understandable, Figure 1 The positional relationship between the devices shown in the figure does not constitute any limitation. For example, when the application scenario also includes a storage device, the storage device can be an external memory relative to the training device or the processing device. In other cases, the storage device can also be placed in the processing device.

[0066] It should also be noted that the training device and the processing device in the embodiments of the present disclosure may be the same device or different devices. The training device and / or the processing device may be a terminal device, which includes but is not limited to: a smart phone, a laptop computer, a desktop computer, a platform computer, a vehicle-mounted device, a smart wearable device, etc., or a server or a virtual machine, etc., or a distributed computer system composed of one or more servers and / or computers, etc., which is not limited in the embodiments of the present disclosure. Among them, the server may be an ordinary server or a cloud server, which is also called a cloud computing server or a cloud host, and is a host product in the cloud computing service system. The server may also be a server of a distributed system, or a server combined with a blockchain.

[0067] It is worth noting that the product implementation form of the present disclosure is a program code contained in the machine learning and deep learning platform software and deployed on a server (or hardware with computing capabilities such as a computing cloud or a mobile terminal). Figure 1 In the system structure diagram shown, the program code of the present disclosure can be stored in the processing device and the training device. When running, the program code runs in the host memory and / or GPU memory of the server.

[0068] In the technical solution of the present disclosure, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0069] It should be noted that the object recognition model in this embodiment is not a recognition model for a specific object and cannot reflect the information of a specific object; moreover, the document or text sample set to be processed in this embodiment comes from a public data set.

[0070] The embodiments of the present disclosure provide a document processing and recognition model training method, apparatus, device and storage medium, which are applied to the fields of deep learning, natural language processing and deep search technology in data processing to improve the effect of document information extraction.

[0071] In the embodiments of the present disclosure, "multiple" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0072] The technical solution of the present disclosure is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0073] Exemplarily, the document processing process is first described in detail below in conjunction with several specific embodiments.

[0074] Figure 2 is a flowchart of a document processing method provided by the first embodiment of the present disclosure. The method of this embodiment can be Figure 1 The method may be executed by a processing device in the processing device, or may be executed by a processor in the processing device. In this embodiment, the method is described by taking the processing device as executing the method. Figure 2 As shown, the document processing method provided in this embodiment may include:

[0075] S201, obtaining documents to be processed.

[0076] Exemplarily, the processing device may receive documents to be processed transmitted from other devices, or read documents to be processed from its own stored document library (in this case, the processing device is deployed with a document library), or generate documents to be processed based on its own document components. The embodiments of the present disclosure do not limit the process of obtaining documents to be processed, which can be determined according to actual scenarios.

[0077] S202: Process the document to be processed to obtain a set of recognized objects in the document to be processed, where the set of recognized objects includes: an object category, recognized objects included in the object category, and a recognition score of the recognized object.

[0078] In this embodiment, the processing device has the function of document processing, for example, document parsing, text serialization, text category recognition, text object recognition, etc. This embodiment does not limit the functions of the processing device.

[0079] Exemplarily, when the length of the document to be processed is shorter than the length that the processing device can process and the document to be processed is a text document, the processing device can use the object recognition model loaded by itself to process the document to be processed to obtain a set of recognized objects in the document to be processed.

[0080] Optionally, when there is an object category in the text of the document to be processed and the object category includes a recognition object, the processing device can identify at least one object category in the document to be processed, at least one recognition object included in the at least one object category, and a recognition score of the at least one recognition object.

[0081] S203: Determine a recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects.

[0082] In the disclosed embodiments, for an object category in a recognition object set, a final recognition object of the object category may be determined based on the recognition scores of the recognition objects included in the object category.

[0083] Exemplarily, when the recognition object set includes multiple object categories, the processing device can compare the scores of all recognized objects in at least one object category among the multiple object categories, and determine the final recognized object of the object category based on the scores of all recognized objects.

[0084] In an embodiment of the present disclosure, by processing the acquired document to be processed, a set of recognition objects in the document to be processed is obtained, and the recognition object set includes: an object category, recognition objects included in the object category, and a recognition score of the recognition object. According to the recognition objects included in the object category in the recognition object set and the recognition score of the recognition object, the recognition result of the document to be processed is determined. This technical solution can accurately identify the recognition objects in the object category, thereby improving the information extraction effect of the document.

[0085] exist Figure 2 Based on the illustrated embodiment, the document processing method provided by the embodiment of the present disclosure is introduced in more detail as follows.

[0086] For example, Figure 3 FIG. 2 is a flowchart of a document processing method provided by the second embodiment of the present disclosure. Figure 3 As shown, in the embodiment of the present disclosure, the above S202 can be implemented by the following steps:

[0087] S301: Split the text sequence corresponding to the document to be processed to obtain at least one text to be processed.

[0088] Exemplarily, by serializing the document to be processed, a text sequence corresponding to the document to be processed can be obtained. In order to solve the problem that the maximum number of sequences that can be processed in conventional information extraction solutions is limited, in this embodiment, if the length of the text sequence is greater than the longest sequence that the processing device can process, the processing device can split the text sequence to obtain at least one text to be processed.

[0089] In a possible design of this embodiment, the text sequence corresponding to the document to be processed may be split based on a preset sliding window length and sliding step size to obtain at least one text to be processed.

[0090] The sliding window length is greater than or equal to the sliding step length.

[0091] Exemplarily, this embodiment adopts the idea of ​​sliding windows, which can split text whose length exceeds the maximum number of sequences that the processing device can handle into shorter texts to be processed, and then perform object recognition. This means that it can process extremely long texts (word documents of hundreds of pages and tens of thousands of characters), greatly improving the recognition performance.

[0092] Exemplarily, the embodiment of the present disclosure performs sliding window on the text sequence (long sequence) corresponding to the document to be processed, and splits it into multiple texts to be processed. For example, taking a word plain text with a length of 10000 as an example, the sliding window length can be set to 512, and the sliding step length can be set to 384, then the sequence from position 0 to position 9999 is subjected to sliding window processing, and the word plain text sequence with a length of 10000 is split into multiple texts to be processed with a sliding window length of 512, and about 10000 / 384≈26 texts to be processed can be obtained.

[0093] S302: Input at least one to-be-processed text into a pre-trained object recognition model to determine a set of recognized objects in the to-be-processed document.

[0094] Among them, the training principles of the object recognition model include: Transformer-based Bidirectional Encoding Representation (BERT) and Global Pointer.

[0095] In an embodiment of the present disclosure, a pre-trained object recognition model is deployed or loaded on the processing device. In a possible design of this embodiment, after the processing device obtains a document to be processed, if the document to be processed is a text document and the text sequence length of the text document meets the requirement, the document to be processed can be input into the object recognition model, so that the recognition object set corresponding to the document to be processed can be directly output.

[0096] In an example of this embodiment, when the text sequence corresponding to the document to be processed does not meet the requirements, after obtaining at least one text to be processed through the splitting process of the above S301, the at least one text to be processed can be input into the object recognition model respectively, and the recognition object set corresponding to the at least one text to be processed is output.

[0097] It can be understood that in this embodiment, in order to solve the problems of object nesting (entity nesting), training and application inconsistency, the object recognition model in this embodiment uses a combination of BERT and GlobalPointer for object recognition during training. It regards the head and tail of each object category as a whole for judgment, and thus has a more global view (more global).

[0098] Specifically, assuming that the length of a text sequence of a certain text to be processed is n, for simplicity, it can be assumed that there is only one object to be identified in the text to be processed, and assuming that each object to be identified is a continuous segment of the text sequence, with unlimited length, and can be nested with each other (there is an intersection between two different identification objects), then it can be concluded that the number of "candidate identification objects" in the sequence is: n(n+1) / 2, that is, the text sequence of length n has n(n+1) / 2 different continuous subsequences, which contain all possible objects. At this time, what the processing device has to do is to pick out the real object from these n(n+1) / 2 "candidate identification objects", which is actually a "n(n+1) / 2 select k" multi-label classification problem. If there are m types of object categories to be identified in the text to be processed, then it is made into m "n(n+1) / 2 select k" multi-label classification problems. This is the basic idea of ​​the GlobalPointer module, which uses objects as the basic unit for discrimination.

[0099] In an embodiment of the present disclosure, by splitting the text sequence corresponding to the document to be processed, at least one text to be processed is obtained, and the at least one text to be processed is input into a pre-trained object recognition model to determine the set of recognized objects in the document to be processed. Since the training principle of the object recognition model includes: BERT and GlobalPointer, the problems of nested recognition objects, inconsistent training and application can be solved, and the recognition accuracy of the object recognition model can be improved.

[0100] Optionally, in this embodiment, at least one text to be processed may be input into the corresponding object recognition model. Since the model can independently predict the samples to be processed, it can be processed in parallel, greatly improving the efficiency of model reasoning.

[0101] Optionally, in an embodiment of the present disclosure, if Figure 3 As shown, before step S202, that is, before step S301, the document processing method may further include the following steps:

[0102] S300a, determine whether the document to be processed is a plain text document; if so, execute S300c first, then execute S301; if not, execute S300b and S300c first, then execute S301.

[0103] In the embodiments of the present disclosure, since the pre-trained object recognition model is trained based on a text sequence, after the processing device obtains the document to be processed, it first determines whether the text to be processed is a plain text document, and then performs subsequent operations based on the determination result.

[0104] S300b, parsing the document to be processed to obtain a plain text document corresponding to the document to be processed.

[0105] In one example, in response to the document to be processed being a non-plain text document, the document to be processed is parsed to obtain a plain text document corresponding to the document to be processed.

[0106] For example, if the document to be processed is a Word document, you can use the open source module python-docx to read the Word document, get the Document object, then get the text attribute in the Paragraph object, concatenate all its text into a long text string, and get the plain text document corresponding to the Word document.

[0107] It is understandable that the document object can be interpreted as a file object, which is a computer term that refers to an object in an HTML file. The Paragraph object represents a paragraph in a selection, range, or document. The Paragraph object is a member of the Paragraphs collection, which contains all paragraphs in the selection, range, or document.

[0108] S300c: Process the plain text document to obtain a text sequence corresponding to the document to be processed.

[0109] Exemplarily, when the document to be processed is a plain text document or after parsing the document to be processed which is not a plain text document to obtain a plain text document corresponding to the document to be processed, the processing device can perform space symbol cleaning and other operations on the plain text document.

[0110] For example, the processing device can clean space symbols for word documents: all \n, \t, \r, spaces, and characters (separators, blanks) with a character encoding (Unicode) category of Zs are uniformly replaced with a space, and then multiple consecutive spaces are replaced with a space, thus achieving the cleaning operation of the text document and obtaining the text sequence corresponding to the document to be processed.

[0111] In the embodiment of the present disclosure, the document to be processed is processed to obtain a text sequence corresponding to the plain text document, which is then split to obtain at least one text to be processed, and finally the at least one text to be processed is input into a pre-trained object recognition model to determine the set of recognized objects in the document to be processed. In this technical solution, by processing the document to be processed, the validity of the text to be processed input into the object recognition model can be guaranteed to a certain extent, thereby improving the information processing effect.

[0112] For example, Figure 4 FIG. 1 is a flowchart of a document processing method provided by the third embodiment of the present disclosure. Figure 4As shown, in the embodiment of the present disclosure, the above S203 can be implemented by the following steps:

[0113] S401: Determine the number of identification objects included in the object category.

[0114] Exemplarily, at least one piece of text to be processed included in the document to be processed is input into the object recognition model for recognition, and a set of recognized objects can be obtained, that is, the object category included in the recognition object set, at least one recognized object included in the object category, and the prediction score of GlobalPointer for each recognized object (referred to as recognition score in this embodiment). At this time, the number of recognized objects included in the object category can be determined first.

[0115] For example, suppose that a certain school announcement document is processed, and two object categories can be obtained, namely "announcement agency" and "announcement location". Moreover, the recognition objects and recognition scores included in "announcement agency" and "announcement location" are as follows:

[0116] [{“Notified Body”:

[0117] {"First Grade, Second Grade, Third Grade, Fourth Grade, Fifth Grade": 0.98,

[0118] "Student Affairs Office": 0.18},

[0119] "Medical Room": 0.09},

[0120] {“Announcement Location”:

[0121] {“blackboard”: 0.78}}].

[0122] S402: In response to the object category including at least two recognition objects, determine a target recognition object among the at least two recognition objects according to recognition scores of the at least two recognition objects.

[0123] S403: Determine that the recognition result of the document to be processed includes the target recognition object in the object category. Optionally, for each object category, a score of at least one recognition object in the object category may be obtained, and the recognition object with the highest recognition score in the object category may be determined as the target recognition object in the recognition category. Accordingly, the recognition result of the document to be processed includes the target recognition object in the object category.

[0124] For example, for "Notified Body", the object with the largest GlobalPointer score, that is, 0.98, is selected as the recognition result, that is, "Grade 1, Grade 2, Grade 3, Grade 4, Grade 5".

[0125] It can be understood that in this embodiment, if a certain object category includes only one identification object, then the identification object is the identification result of the object category.

[0126] Optional, such as Figure 4 As shown, in the embodiment of the present disclosure, the document processing method may further include the following steps:

[0127] S404: Determine whether there is a whole object in at least one recognized object included in the recognition result, and the whole object includes at least two sub-objects with the same context.

[0128] Illustratively, in an embodiment of the present disclosure, after determining a recognition result of a document to be processed, it may be determined whether at least one recognition object included in the recognition result is a whole object.

[0129] It can be understood that when training, the object recognition model uses a text sample set that is annotated using a labeling method based on the object context, which processes multiple objects with the same context as a whole object. Therefore, when the object recognition model is used to process the text sequence corresponding to the document to be processed, the recognition result obtained may include a whole object formed by at least two sub-objects with the same context.

[0130] S405: In response to the existence of a whole object in the recognition object, the whole object is segmented to obtain a final recognition result of the document to be processed.

[0131] In a possible design, when it is determined that there is a whole object among the recognized objects included in the recognition result, the whole object is segmented according to spaces to obtain various sub-objects, that is, the final recognition result of the document to be processed.

[0132] For example, the recognition result for “announcement agency” is: “first grade, second grade, third grade, fourth grade, fifth grade”. After splitting by spaces, the final output of “announcement agency” can be obtained: [“first grade”, “second grade”, “third grade”, “fourth grade”, “fifth grade”].

[0133] In the disclosed embodiment, by determining the number of recognition objects included in the object category, in response to the object category including at least two recognition objects, according to the recognition scores of the at least two recognition objects, the target recognition object among the at least two recognition objects is determined, thereby determining that the recognition result of the document to be processed includes the target recognition object in the object category, and in response to the existence of an overall object in the recognition result, the overall object includes at least two sub-objects with the same context, object segmentation is performed on the overall object to obtain the final recognition result of the document to be processed. This technical solution can not only improve the accuracy of object recognition, but also meet business needs and improve information processing efficiency.

[0134] The above embodiments describe the process of document processing. The following describes the process of training the object recognition model used in the document processing process in conjunction with several specific embodiments.

[0135] Figure 5 is a flow chart of the recognition model training method provided by the first embodiment of the present disclosure. The method of this embodiment can be Figure 1 The training device in the training device may also execute the method. In this embodiment, the training device executes the method. Figure 5 As shown, the recognition model training method provided in this embodiment may include:

[0136] S501: Obtain a text sample set, where text samples in the text sample set carry object annotation information.

[0137] Exemplarily, the training device may obtain a large number of text samples from multiple text libraries.

[0138] In a possible design of this embodiment, the text samples acquired by the training device are labeled, and optionally, the labeled text samples carry object labeling information.

[0139] Optionally, the object annotation information may be obtained based on a method of ensuring the context of the entity.

[0140] S502: Input text samples in the text sample set into a preset network to obtain object recognition results of the text samples.

[0141] The target recognition object corresponding to the object recognition category in the object recognition result is determined based on the recognition score.

[0142] In an embodiment of the present disclosure, during the training process of the object recognition model, the training device can input the text samples in the text sample set into a preset network respectively (when there are multiple text samples, they can be input in parallel or serially), and can output the object recognition results of the text samples, that is, the object recognition category in the text sample and the target recognition object corresponding to the object recognition category.

[0143] Optionally, in this embodiment, the formats of the two text samples input into the preset network are as follows:

[0144] {["Text sample 1", [first character of object 11, last character of object 11, marked object 1], [first character of object 12, last character of object 12, marked object 2], ...];

[0145] [“Text sample 2”, [first character of object 21, last character of object 21, marked object 1], [first character of object 22, last character of object 22, marked object 2], [...], ...}.

[0146] S503: According to the object annotation information carried by the text sample and the object recognition result of the text sample, adjust the parameters of the preset network to obtain an object recognition model.

[0147] In this embodiment, the training device can compare the object recognition result of the text sample with the object annotation information carried by the text sample to determine the degree of consistency between the object recognition result of the preset network for the text sample and the object annotation information. When the degree of consistency is lower than the preset requirement, the parameters of the preset network are adjusted to obtain an object recognition model.

[0148] In an embodiment of the present disclosure, a text sample set is obtained, wherein the text samples in the text sample set carry object annotation information, and the text samples in the text sample set are input into a preset network to obtain object recognition results of the text samples, and then the parameters of the preset network are adjusted according to the object annotation information carried by the text samples and the object recognition results of the text samples to obtain an object recognition model. In this technical solution, since the target recognition object corresponding to each object recognition category in the object recognition result is determined based on the recognition score, the problem of object nesting and the inconsistency problem in training and recognition can be solved, thereby improving the accuracy of object recognition in text samples.

[0149] exist Figure 5 Based on the illustrated embodiment, the recognition model training method provided by the embodiment of the present disclosure is introduced in more detail as follows.

[0150] Figure 6 1 is a flow chart of the recognition model training method provided by the second embodiment of the present disclosure. In the embodiment of the present disclosure, the preset network includes: a BERT part and a GlobalPointer part. The embodiment of the present disclosure mainly describes the training of the GlobalPointer part.

[0151] In practical applications, since the use of NER tasks or MRC tasks for entity (object) extraction in related technologies will face the problem of inconsistency between training and prediction to a certain extent, in this embodiment, the traditional BERT+CRF for NER is replaced by BERT+GlobalPointer for NER. Moreover, when BERT+GlobalPointer is used for the entity extraction task, the beginning and the end are regarded as a whole for judgment, so it has a better "global view" (more global).

[0152] Correspondingly, such as Figure 6As shown, the above S502 can be implemented by the following steps:

[0153] S601: Use the BERT part to perform object recognition on text samples in the text sample set to determine all recognized objects included in the text samples.

[0154] Exemplarily, the BERT part uses a masked language model (MLM) to generate a deep bidirectional language representation. Specifically, it considers the context from both sides (left and right) of each word. This bidirectionality helps the model better understand the context in which the words are used. Therefore, when the BERT part is used to perform object recognition on text samples in a text sample set, all the recognized objects included in the text samples can be determined.

[0155] S602: Classify all recognition objects included in the text sample based on the global pointer part, and determine the object recognition category included in the text sample and at least one recognition object included in the object recognition category.

[0156] Exemplarily, the basic idea of ​​the global pointer part is the problem of multi-label classification. Therefore, after determining all the recognition objects included in the text sample, the global pointer part can be used to classify all the recognition objects included in the text sample to obtain the object recognition category included in the text sample, and then determine at least one recognition object included in the object recognition category.

[0157] S603: Determine a target recognition object corresponding to the object recognition category according to a recognition score of at least one recognition object in the object recognition category.

[0158] Exemplarily, in an embodiment of the present disclosure, since the global pointer part can give the recognition score of each recognition object in the object recognition category, the recognition scores of each recognition object can be sorted from high to low, and the recognition object with the highest score can be used as the target recognition object corresponding to the current object recognition category.

[0159] Optionally, in an embodiment of the present disclosure, the object annotation information includes: an object annotation category and an annotation object corresponding to the object annotation category, and the object recognition result includes: an object recognition category and an recognition object corresponding to the object recognition category; accordingly, Figure 6 As shown, the above S503 can be implemented by the following steps:

[0160] S604: Determine a category recognition result of the text sample according to the object annotation category carried by the text sample and the object recognition category of the text sample.

[0161] Exemplarily, in this embodiment, the object recognition category of the text sample is compared with the object annotation category carried by the text sample to determine whether the category recognition of the text sample is correct, that is, the category recognition result.

[0162] S605: Determine the category recognition accuracy of the preset network according to the category recognition results of at least two text samples in the text sample set.

[0163] Optionally, after determining the category recognition results of at least two text samples, the number of text samples with correct category recognition in the text sample set can be counted, and the percentage of the number of text samples with correct category recognition to all text samples in the text sample set can be calculated to obtain the category recognition accuracy of the preset network.

[0164] S606, determine whether the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold; if so, execute S607; if not, first execute S610, and then go to execute S601.

[0165] As an example, a category accuracy threshold may be preset in the training device, so after determining the category recognition accuracy of the preset network, it may be compared with the category accuracy threshold, and then subsequent operations may be determined based on the comparison result.

[0166] S607: Determine the object recognition result of the text sample according to the annotation object corresponding to the object annotation category and the target recognition object corresponding to the object recognition category.

[0167] As an example, when the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold, it indicates that a category indicator of the preset network has met the requirement, and at this time, the object recognition result of the text sample is calculated.

[0168] Optionally, in this embodiment, the recognition object corresponding to the object recognition category in the text sample can be compared with the annotated object corresponding to the object annotation category in the text sample to determine whether the recognition object and the annotated object of the text sample are consistent to obtain the object recognition result.

[0169] S608: Determine the object recognition accuracy of the preset network according to the object recognition results of at least two text samples in the text sample set.

[0170] Optionally, after determining the object recognition results of at least two text samples, the number of text samples with correct object recognition in the text sample set can be counted, and the percentage of the number of correctly recognized object text samples to all text samples in the text sample set can be calculated to obtain the object recognition accuracy of the preset network.

[0171] S609, determining whether the object recognition accuracy of the preset network is greater than or equal to the object accuracy threshold, if so, proceed to S610; if not, execute S610, and then proceed to execute S601.

[0172] As an example, an object accuracy threshold may be preset in the training device, so after determining the object recognition accuracy of the preset network, it may be compared with the object accuracy threshold, and then subsequent operations may be determined based on the comparison result.

[0173] S610: Adjust parameters of the preset network.

[0174] S611: Obtain an object recognition model.

[0175] Exemplarily, when the category recognition accuracy of the preset network is less than the category accuracy threshold and / or the object recognition accuracy of the preset network is less than the object accuracy threshold, it indicates that the current parameter values ​​of the preset network cannot meet the preset accuracy indicators. Therefore, the parameters of the preset network can be adjusted, and the above steps are executed in a loop until the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold and the object recognition accuracy of the preset network is greater than or equal to the object accuracy threshold, so as to obtain an object recognition model.

[0176] Furthermore, in the model training stage of the embodiment of the present disclosure, in order to ensure the generalization of general NER extraction, fast gradient method (FGM) adversarial training is added: that is, a. keep the parameters of the preset network unchanged, and for each text sample, add a small perturbation △x to the embedding layer of the preset network, so that an adversarial sample corresponding to each text sample is produced, that is, the obtained adversarial sample can maximize the loss of the preset network; b. for these adversarial samples, input the preset network, perform gradient descent to minimize the loss, and then optimize the parameters θ of the preset network, repeatedly perform a and b, and so on, to form adversarial training, thereby ensuring the generalization of object recognition.

[0177] In this embodiment, the idea of ​​global normalization is used to perform named entity recognition (NER), which can recognize nested entities and non-nested entities indiscriminately, and can achieve good results in the case of non-nested NER (Flat NER), and also have good results in the case of nested NER (Nested NER). Moreover, in theory, the design idea of ​​GlobalPointer is also relatively reasonable, and in practice, it is fully parallelized and has low complexity.

[0178] In this embodiment, the BERT+GlobalPointer model is used to train the NER task. After the reasoning is completed, aggregation is performed, and the maximum score is used to obtain the final result. For each object category, extremely high precision can be obtained, and due to the consistency of training and reasoning tasks, the recall rate index is also greatly improved. Finally, FGM adversarial training is used to greatly improve the generalization ability of the model.

[0179] Figure 7 FIG. 1 is a flow chart of a recognition model training method provided in the third embodiment of the present disclosure. In the embodiment of the present disclosure, Figure 6 As shown, the above S501 can be implemented by the following steps:

[0180] S701: Obtain a document sample set.

[0181] Optionally, in this embodiment, the training device may obtain a text sample set from other devices or its own storage location, and the document samples in the document sample set may be documents in various formats, such as PDF documents, Word documents, and plain text documents. This embodiment does not limit the format of the document samples.

[0182] S702, determine whether the document sample in the document sample set is a plain text document; if not, execute S703 first, then execute S704; if so, execute S704.

[0183] Optionally, in actual applications, since the preset network is a BERT and global pointer structure, its usual processing object is a text sequence. Therefore, after obtaining the document sample set, it is first detected whether the document sample in the document sample set is a plain text document. If so, the document is serialized. If not, the non-plain text document is first converted into a plain text document and then serialized.

[0184] S703: Convert the non-plain text documents in the document sample set into plain text documents to obtain a text document sample set.

[0185] As an example, in response to the existence of non-plain text documents in the document sample set, the non-plain text documents in the document sample set are converted into plain text documents to obtain a text document sample set.

[0186] For example, a PDF document is already a paginated document, while a Word document does not have fixed pagination. Moreover, a Word document may have different pagination due to differences in the software used to open it. Therefore, in order to improve processing accuracy and the wide applicability of the model, a Word document parser can be used to parse the Word document to obtain a plain text document. Similarly, for PDF, a PDF document parser can be used to parse the PDF document, or the PDF document can be first converted into a Word document, and then the PDF document can be parsed using a PDF document parser to obtain a plain text document.

[0187] S704: Serialize the plain text documents in the text document sample set to obtain a text sequence corresponding to the plain text documents.

[0188] Optionally, when it is determined that the document samples in the text document sample set are all plain text documents, the text therein can be extracted, and all the text contents can be processed into a long plain text string to obtain a text sequence corresponding to the plain text document, for example: the number of characters ranges from hundreds to tens of thousands.

[0189] In addition, in order to address the problem that the maximum number of sequences that can be processed by conventional key information extraction technologies is limited, in this embodiment, a sliding window is performed on the text sequence corresponding to the plain text document to split it into multiple text samples.

[0190] S705: Obtain object annotation information of a text sequence corresponding to a plain text document to obtain a text sample set.

[0191] The object annotation information is based on the object context annotation.

[0192] Optionally, during the training phase of the present embodiment, the trainer may first perform object annotation on the text samples, and input the text samples with object annotation information into a preset network for model training. In this way, the preset network can learn the object information features in the text samples for the above text samples. Since the text samples in the text sample set can be trained independently, multiple text samples can be trained in parallel at this step, greatly improving the model training efficiency.

[0193] It can be understood that when there is no object in some text samples, they can be regarded as negative text samples for data enhancement.

[0194] Optionally, the embodiments of the present disclosure adopt a labeling method that prioritizes the context of entities. For example, when identifying "announcement agency", the objects are "first grade", "second grade", "third grade", "fourth grade", and "fifth grade". If the labeling is performed in the most fine-grained manner, the above five announcement agencies will be labeled separately, which will result in the failure to learn the contextual semantics near the object during the model training process, and then cause a lot of false recalls during model reasoning. For example, when "Academic Affairs Office" and "Medical Room" exist in the text sample, "Academic Affairs Office" and "Medical Room" may be mistakenly recalled, and neither of them is a "announcement agency".

[0195] Therefore, the disclosed embodiment provides a labeling method that prioritizes the object context. In the announcement document, although the names of the "announcement agencies" are different, they have similar contexts. Therefore, multiple sub-objects with the same context can be labeled as one identification object. During training and inference, the model can learn the overall object that satisfies this context. In the post-processing process after the overall object is inferred, the overall object can be divided by spaces to obtain each more fine-grained object, ultimately meeting business needs.

[0196] The disclosed embodiment adopts a labeling method that prioritizes entity context during labeling. During the training and reasoning stages, entities in a fixed context can be accurately learned and predicted, solving the problem of false recall of fine-grained entities.

[0197] Illustratively, the overall solution of the embodiment of the present disclosure is explained below using a specific example. Figure 8 Schematic diagram of an architecture provided by an embodiment of the present disclosure. In this embodiment, the document to be processed is a Word document, and the corresponding text sequence of the Word document exceeds the preset processing length for explanation. Figure 8 As shown, the architecture diagram may include four parts: a Word parsing module 801, a preprocessing module 802, a model training module 803 and an object recognition module 804.

[0198] The Word parsing module 801 mainly converts the Word document into a plain text document and processes it into a text that can be used for annotation.

[0199] The preprocessing module 802 performs data preprocessing Sliding, which mainly performs sliding window processing on the plain text obtained by the Word parsing module 801, splits it into multiple texts (entity annotation is performed after splitting in the training phase), and generates the input format required for model training and reasoning.

[0200] For example, Fig. 9 This is a flowchart of splitting and processing a plain text document. Fig. 9As shown, by segmenting the plain text document, n parts of the plain text document are obtained, namely, sub-samples corresponding to the plain text document.

[0201] like Figure 8 and Fig. 9 As shown, the model training module 803 is a simplified version of automated modeling, including functions such as model parameter adjustment, global pointer model training, and model publishing. It is used to train the data (with annotations) provided by the preprocessing module 802 to obtain a model file, that is, an object recognition model (BERT+global pointer model).

[0202] The object recognition module 804 is applied in the inference stage, and the subsample corresponding to the plain text document is input into the object recognition model to obtain an object recognition set.

[0203] For the specific implementation of each module, please refer to the records in the above embodiments and will not be repeated here.

[0204] Fig.10 is a schematic diagram of the structure of a document processing device provided by an embodiment of the present disclosure. The document processing device provided by this embodiment can be Figure 1 A processing device in a processing device or a device in a processing device. Fig.10 As shown, the document processing device 1000 provided by the embodiment of the present disclosure may include:

[0205] An acquisition unit 1001 is used to acquire a document to be processed;

[0206] The processing unit 1002 is used to process the document to be processed to obtain a set of recognized objects in the document to be processed, wherein the set of recognized objects includes: an object category, recognized objects included in the object category, and recognition scores of the recognized objects;

[0207] The determination unit 1003 is configured to determine the recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects.

[0208] In a possible implementation of this embodiment, the processing unit 1002 includes:

[0209] A splitting module, used for splitting the text sequence corresponding to the document to be processed to obtain at least one text to be processed;

[0210] The recognition module is used to input the at least one text to be processed into a pre-trained object recognition model to determine the set of recognized objects in the document to be processed, and the training principle of the object recognition model includes: bidirectional encoding representation BERT based on converter and global pointer.

[0211] Optionally, the splitting module is specifically used to split the text sequence corresponding to the document to be processed based on a preset sliding window length and sliding step to obtain at least one text to be processed, and the sliding window length is greater than or equal to the sliding step.

[0212] In a possible implementation of this embodiment, the determining unit 1003 includes:

[0213] A first determination module, used to determine the number of identification objects included in the object category;

[0214] A second determination module is configured to determine, in response to the object category including at least two recognition objects, a target recognition object among the at least two recognition objects according to recognition scores of the at least two recognition objects;

[0215] The third determination module is used to determine that the recognition result of the document to be processed includes the target recognition object in the object category.

[0216] In a possible implementation of this embodiment, the document processing device further includes:

[0217] a detection unit (not shown), configured to determine whether there is a whole object in the recognized object included in the recognition result, wherein the whole object includes at least two sub-objects having the same context;

[0218] A segmentation unit (not shown) is used for segmenting the whole object in response to the existence of the whole object in the recognition object, so as to obtain the final recognition result of the document to be processed.

[0219] In a possible implementation of this embodiment, the document processing device further includes:

[0220] A detection unit (not shown), configured to determine whether the document to be processed is a plain text document;

[0221] A parsing unit (not shown) for:

[0222] In response to the document to be processed being a non-plain text document, parsing the document to be processed to obtain a plain text document corresponding to the document to be processed;

[0223] The plain text document is processed to obtain a text sequence corresponding to the document to be processed.

[0224] The document processing apparatus provided in this embodiment can be used to execute the document processing method executed by the processing device in any of the above method embodiments. Its implementation principle and technical effects are similar and will not be elaborated here.

[0225] Fig.11is a schematic diagram of the structure of a recognition model training device provided by an embodiment of the present disclosure. The recognition model training device provided by this embodiment can be Figure 1 A training device or a device in a training device. Fig.11 As shown, the recognition model training device 1100 provided in the embodiment of the present disclosure may include:

[0226] An acquisition unit 1101 is used to acquire a text sample set, wherein the text samples in the text sample set carry object annotation information;

[0227] A processing unit 1102 is used to input the text sample in the text sample set into a preset network to obtain an object recognition result of the text sample, wherein the target recognition object corresponding to the object recognition category in the object recognition result is determined based on the recognition score;

[0228] The adjustment unit 1103 adjusts the parameters of the preset network according to the object annotation information carried by the text sample and the object recognition result of the text sample to obtain an object recognition model.

[0229] In a possible implementation of this embodiment, the preset network includes: a converter-based bidirectional encoding representation BERT part and a global pointer part;

[0230] Accordingly, the processing unit 1102 includes:

[0231] A first processing module is used to perform object recognition on the text samples in the text sample set by using the converter-based bidirectional encoding representation BERT part to determine all recognized objects included in the text samples;

[0232] A second processing module is used to classify all recognition objects included in the text sample based on the global pointer part, and determine the object recognition category included in the text sample and at least one recognition object included in the object recognition category;

[0233] The third processing module is used to determine the target recognition object corresponding to the object recognition category according to the recognition score of the at least one recognition object in the object recognition category.

[0234] Optionally, the object annotation information includes: an object annotation category and an annotation object corresponding to the object annotation category, and the object recognition result includes: an object recognition category and a target recognition object corresponding to the object recognition category;

[0235] Accordingly, the adjustment unit 1103 includes:

[0236] A first determination module, configured to determine a category recognition result of the text sample according to the object annotation category carried by the text sample and the object recognition category of the text sample;

[0237] A second determination module, configured to determine the category recognition accuracy of the preset network according to the category recognition results of at least two text samples in the text sample set;

[0238] A third determination module is used to determine the object recognition result of the text sample according to the annotated object corresponding to the object annotation category and the target recognition object corresponding to the object recognition category in response to the category recognition accuracy of the preset network being greater than or equal to the category accuracy threshold;

[0239] A fourth determination module, configured to determine the object recognition accuracy of the preset network according to the object recognition results of at least two text samples in the text sample set;

[0240] A fifth determination module is used to adjust the parameters of the preset network in response to the category recognition accuracy of the preset network being less than the category accuracy threshold and / or the object recognition accuracy of the preset network being less than the object accuracy threshold, until the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold and the object recognition accuracy of the preset network is greater than or equal to the object accuracy threshold, so as to obtain an object recognition model.

[0241] In a possible implementation of the embodiment of the present disclosure, the acquiring unit 1101 includes:

[0242] An acquisition module is used to acquire a document sample set;

[0243] A detection module, used to determine whether a document sample in the document sample set is a plain text document;

[0244] A conversion module, configured to, in response to the presence of non-plain text documents in the document sample set, convert the non-plain text documents in the document sample set into plain text documents to obtain a text document sample set;

[0245] A serialization module, used to serialize the plain text documents in the text document sample set to obtain a text sequence corresponding to the plain text document;

[0246] The acquisition module is further used to acquire object annotation information of a text sequence corresponding to the plain text document to obtain the text sample set, wherein the object annotation information is annotated based on object context.

[0247] The recognition model training device provided in this embodiment can be used to execute the recognition model training method performed by the training device in any of the above method embodiments. Its implementation principle and technical effects are similar and will not be elaborated here.

[0248] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0249] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0250] Fig.12 A schematic block diagram of an example electronic device for implementing an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0251] like Fig.12 As shown, the device 1200 includes a computing unit 1201, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1202 or a computer program loaded from a storage unit 1208 into a random access memory (RAM) 1203. In the RAM 1203, various programs and data required for the operation of the device 1200 can also be stored. The computing unit 1201, the ROM 1202, and the RAM 1203 are connected to each other via a bus 1204. An input / output (I / O) interface 1205 is also connected to the bus 1204.

[0252] A number of components in the device 1200 are connected to the I / O interface 1205, including: an input unit 1206, such as a keyboard, a mouse, etc.; an output unit 1207, such as various types of displays, speakers, etc.; a storage unit 1208, such as a disk, an optical disk, etc.; and a communication unit 1209, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1209 allows the device 1200 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0253] The computing unit 1201 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1201 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1201 performs the various methods and processes described above, such as document processing methods and recognition model training methods. For example, in some embodiments, the document processing method and the recognition model training method may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1208. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 1200 via the ROM 1202 and / or the communication unit 1209. When the computer program is loaded into the RAM 1203 and executed by the computing unit 1201, one or more steps of the document processing method and the recognition model training method described above may be executed. Alternatively, in other embodiments, the computing unit 1201 may be configured to execute the document processing method and the recognition model training method in any other appropriate manner (eg, by means of firmware).

[0254] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0255] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0256] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0257] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0258] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0259] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server of a distributed system, or a server combined with a blockchain.

[0260] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0261] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.

Claims

1. A document processing method, comprising: Get the documents to be processed; Processing the document to be processed by a pre-trained object recognition model to obtain a set of recognized objects in the document to be processed, wherein the set of recognized objects includes: an object category, recognized objects included in the object category, and recognition scores of the recognized objects; Determining a recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects; Determining whether there is a whole object in the recognized objects included in the recognition result, the whole object including at least two sub-objects having the same context; In response to the existence of a whole object in the identified object, segmenting the whole object to obtain a final recognition result of the document to be processed; The method further comprises: Acquire a text sample set, wherein the text samples in the text sample set carry object annotation information; Using the transformer-based bidirectional encoding representation BERT to perform object recognition on the text samples in the text sample set, and determine all recognized objects included in the text samples; Classifying all recognition objects included in the text sample based on the global pointer, determining the object recognition category included in the text sample and at least one recognition object included in the object recognition category; Determining a target recognition object corresponding to the object recognition category according to a recognition score of at least one recognition object in the object recognition category; According to the object annotation information carried by the text sample and the object recognition result of the text sample, the parameters of the preset network are adjusted to obtain the object recognition model.

2. The method according to claim 1, wherein: The step of processing the document to be processed to obtain a set of identification objects in the document to be processed includes: Splitting the text sequence corresponding to the document to be processed to obtain at least one text to be processed; The at least one text to be processed is input into a pre-trained object recognition model to determine a set of recognized objects in the document to be processed.

3. The method according to claim 2, wherein: The step of splitting the text sequence corresponding to the document to be processed to obtain at least one text to be processed includes: Based on a preset sliding window length and a sliding step length, the text sequence corresponding to the document to be processed is split to obtain at least one text to be processed, and the sliding window length is greater than or equal to the sliding step length.

4. The method according to any one of claims 1 to 3, wherein: The step of determining the recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects includes: Determining the number of identified objects included in the object category; In response to the object category including at least two recognition objects, determining a target recognition object among the at least two recognition objects according to recognition scores of the at least two recognition objects; Determine that the recognition result of the document to be processed includes the target recognition object in the object category.

5. The method according to any one of claims 1 to 3, before processing the document to be processed to obtain the set of identified objects in the document to be processed, further comprising: Determine whether the document to be processed is a plain text document; In response to the document to be processed being a non-plain text document, parsing the document to be processed to obtain a plain text document corresponding to the document to be processed; The plain text document is processed to obtain a text sequence corresponding to the document to be processed.

6. The method according to claim 1, wherein: The object annotation information includes: an object annotation category and an annotation object corresponding to the object annotation category, and the object recognition result includes: an object recognition category and a target recognition object corresponding to the object recognition category; The step of adjusting the parameters of the preset network according to the object annotation information carried by the text sample and the object recognition result of the text sample to obtain the object recognition model includes: Determining a category recognition result of the text sample according to the object annotation category carried by the text sample and the object recognition category of the text sample; Determining the category recognition accuracy of the preset network according to the category recognition results of at least two text samples in the text sample set; In response to the category recognition accuracy of the preset network being greater than or equal to a category accuracy threshold, determining an object recognition result of the text sample according to the annotated object corresponding to the object annotation category and the target recognition object corresponding to the object recognition category; Determining the object recognition accuracy of the preset network according to the object recognition results of at least two text samples in the text sample set; In response to the category recognition accuracy of the preset network being less than the category accuracy threshold and / or the object recognition accuracy of the preset network being less than the object accuracy threshold, the parameters of the preset network are adjusted until the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold and the object recognition accuracy of the preset network is greater than or equal to the object accuracy threshold, thereby obtaining an object recognition model.

7. The method according to claim 6, wherein: The step of obtaining a text sample set includes: Get a sample set of documents; Determining whether a document sample in the document sample set is a plain text document; In response to the presence of non-plain text documents in the document sample set, converting the non-plain text documents in the document sample set into plain text documents to obtain a text document sample set; Serializing the plain text documents in the text document sample set to obtain text sequences corresponding to the plain text documents; Obtain object annotation information of a text sequence corresponding to the plain text document to obtain the text sample set, wherein the object annotation information is annotated based on an object context.

8. A document processing device, comprising: An acquisition unit, used for acquiring documents to be processed; A processing unit, configured to process the document to be processed by using a pre-trained object recognition model to obtain a set of recognized objects in the document to be processed, wherein the set of recognized objects includes: an object category, recognized objects included in the object category, and recognition scores of the recognized objects; A determination unit, configured to determine a recognition result of the document to be processed according to the recognition objects included in the object category in the recognition object set and the recognition scores of the recognition objects; a detection unit, configured to determine whether there is a whole object in the recognized object included in the recognition result, wherein the whole object includes at least two sub-objects having the same context; A segmentation unit, configured to segment the whole object in response to the existence of the whole object in the recognition object, so as to obtain a final recognition result of the document to be processed; The acquisition unit is further used to acquire a text sample set, wherein the text samples in the text sample set carry object annotation information; The processing unit comprises: A first processing module is used to perform object recognition on the text samples in the text sample set by using a bidirectional encoding representation based on a converter, and determine all recognized objects included in the text samples; A second processing module is used to classify all recognition objects included in the text sample based on the global pointer, and determine the object recognition category included in the text sample and at least one recognition object included in the object recognition category; A third processing module, configured to determine a target recognition object corresponding to the object recognition category according to a recognition score of at least one recognition object in the object recognition category; The device also includes: The adjustment unit adjusts the parameters of the preset network according to the object annotation information carried by the text sample and the object recognition result of the text sample to obtain the object recognition model.

9. The device according to claim 8, wherein: The processing unit comprises: A splitting module, used for splitting the text sequence corresponding to the document to be processed to obtain at least one text to be processed; The recognition module is used to input the at least one text to be processed into a pre-trained object recognition model to determine a set of recognized objects in the document to be processed.

10. The device according to claim 9, wherein: The splitting module is specifically used to split the text sequence corresponding to the document to be processed based on a preset sliding window length and sliding step length to obtain at least one text to be processed, and the sliding window length is greater than or equal to the sliding step length.

11. The device according to any one of claims 8 to 10, wherein: The determining unit comprises: A first determination module, used to determine the number of identification objects included in the object category; A second determination module is configured to determine, in response to the object category including at least two recognition objects, a target recognition object among the at least two recognition objects according to recognition scores of the at least two recognition objects; The third determination module is used to determine that the recognition result of the document to be processed includes the target recognition object in the object category.

12. The device according to any one of claims 8 to 10, wherein: The detection unit is further used to determine whether the document to be processed is a plain text document; The device also includes: Parsing unit, used to: In response to the document to be processed being a non-plain text document, parsing the document to be processed to obtain a plain text document corresponding to the document to be processed; The plain text document is processed to obtain a text sequence corresponding to the document to be processed.

13. The device according to claim 8, wherein: The object annotation information includes: an object annotation category and an annotation object corresponding to the object annotation category, and the object recognition result includes: an object recognition category and a target recognition object corresponding to the object recognition category; The adjustment unit comprises: A first determination module, configured to determine a category recognition result of the text sample according to the object annotation category carried by the text sample and the object recognition category of the text sample; A second determination module, configured to determine the category recognition accuracy of the preset network according to the category recognition results of at least two text samples in the text sample set; A third determination module is used to determine the object recognition result of the text sample according to the annotated object corresponding to the object annotation category and the target recognition object corresponding to the object recognition category in response to the category recognition accuracy of the preset network being greater than or equal to the category accuracy threshold; A fourth determination module, configured to determine the object recognition accuracy of the preset network according to the object recognition results of at least two text samples in the text sample set; A fifth determination module is used to adjust the parameters of the preset network in response to the category recognition accuracy of the preset network being less than the category accuracy threshold and / or the object recognition accuracy of the preset network being less than the object accuracy threshold, until the category recognition accuracy of the preset network is greater than or equal to the category accuracy threshold and the object recognition accuracy of the preset network is greater than or equal to the object accuracy threshold, so as to obtain an object recognition model.

14. The device according to claim 8, wherein: The acquisition unit comprises: An acquisition module is used to acquire a document sample set; A detection module, used to determine whether a document sample in the document sample set is a plain text document; A conversion module, configured to, in response to the presence of non-plain text documents in the document sample set, convert the non-plain text documents in the document sample set into plain text documents to obtain a text document sample set; A serialization module, used to serialize the plain text documents in the text document sample set to obtain a text sequence corresponding to the plain text document; The acquisition module is further used to acquire object annotation information of a text sequence corresponding to the plain text document to obtain the text sample set, wherein the object annotation information is annotated based on object context.

15. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, 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 to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1 to 7.

17. A computer program product, comprising a computer program, which implements the steps of the method according to any one of claims 1 to 7 when executed by a processor.

Citation Information

Patent Citations

  • Long text processing method, related equipment and readable storage medium

    CN112527992A