Method and apparatus for extracting data from structured documents

By applying transfer learning and deep learning models to lease contracts, combined with NER, BERT, MLP and CRF, the problem of low efficiency in parsing and extracting information from complex structured documents is solved, and fast and accurate intelligent information extraction and business data calibration are achieved.

CN114356924BActive Publication Date: 2025-10-21SHENGDOUSHI SHANGHAI SCI & TECH DEV CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111658801.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-10-21
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

When processing complex structured documents such as lease contracts, existing technologies have problems with low efficiency and high cost in information parsing and extraction, especially the inability to accurately extract content corresponding to customized requirements.

Method used

By employing a transfer learning-based strategy and combining a large amount of document-level corpus for specific pre-training, and using named entity recognition (NER) models and deep learning models such as BERT, MLP, and CRF, we can intelligently parse and extract text data from lease contracts. We can also extract text data corresponding to preset data field types through sequence labeling and position embedding techniques.

Benefits of technology

It enables fast, accurate, and intelligent information identification and extraction from complex structured documents, optimizes data extraction results, provides a more user-friendly experience, and supports the evaluation and calibration of business data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114356924B_ABST
    Figure CN114356924B_ABST
Patent Text Reader

Abstract

The application provides a method and device for extracting data from a structured document. The method comprises obtaining a text data set of the structured document, determining sequence labeling data of the text data, determining a first data field type of the text data based on the sequence labeling data, determining a second data field type of the text data, and extracting text data corresponding to a preset data field type from the text data set based on the first field type and the second field type. By using the above method and device, valuable information can be quickly, accurately and intelligently parsed and extracted from the structured document.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to data extraction, and in particular, to a method, device, and computer storage medium for extracting text data with preset data field types from a structured document. Background Art

[0002] In automated information processing applications, it's necessary to parse and extract contract information from contract documents, such as lease agreements, according to predetermined data types. As a type of structured document, contract documents typically include a collection of data fields corresponding to multiple specific contract information item types.

[0003] The task of extracting information from lease contracts, which contain extensive information, is typically done manually or by treating them as standard contracts before extracting information. Manual parsing and extraction are inefficient and costly. Treating lease contracts as standard contracts limits the data fields extracted, making it impossible to capture content relevant to customized requirements and, therefore, unable to accurately extract complete information from the lease contract.

[0004] Therefore, there is a need for improvements in data parsing and extraction of structured text such as lease contracts. Summary of the Invention

[0005] The embodiments of the present application propose a method and device for extracting data from structured documents, which can at least partially solve the problem of extracting corresponding text data according to data field type from structured documents such as contract texts (especially complex lease contracts), thereby quickly, accurately and intelligently parsing and extracting valuable information from structured documents.

[0006] According to one aspect of the present application, a method for extracting data from a structured document is proposed, comprising: obtaining a text data set of a structured document, wherein the text data set includes a plurality of text data; determining sequence annotation data of the text data; determining a first data field type of the text data based on the sequence annotation data, wherein the first data field type is associated with text features of the text data that are adjacent or close in position in the text data set; determining a second data field type of the text data, wherein the second data field type is associated with text features of the text data that are far away in position in the text data set; and extracting text data corresponding to a preset data field type from the text data set based on the first field type and the second field type.

[0007] According to another aspect of the present application, a device for extracting data from a structured document is proposed, comprising: an acquisition unit configured to acquire a text data set of a structured document, wherein the text data set includes a plurality of text data; an extraction unit configured to determine sequence annotation data of the text data, determine a first data field type of the text data based on the sequence annotation data, wherein the first data field type is associated with text features of the text data that are adjacent or close in position in the text data set, determine a second data field type of the text data, wherein the second data field type is associated with text features of the text data that are far away in position in the text data set, and extract text data corresponding to a preset data field type from the text data set based on the first field type and the second field type.

[0008] According to another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. The computer program includes executable instructions. When the executable instructions are executed by a processor, the method described above is implemented.

[0009] According to another aspect of the present application, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the executable instructions to implement the method described above.

[0010] By adopting the data extraction scheme of the embodiment of the present application, an improved text parsing and extraction model is introduced for text data sets in complex structured documents with a large number of data field types, and a transfer learning strategy is used to combine structured documents such as lease contracts with a large amount of document-level corpus for specific pre-training, thereby achieving entity recognition and relationship extraction of small target corpus, and obtaining fast, accurate and intelligent information recognition and extraction effects for structured documents. The scheme of the present application can also expand data field types and support the evaluation and calibration of business data to further optimize the performance of the system model. After parsing and extracting valuable information, the extraction results of the text data can be optimized to facilitate user understanding and reading, providing a more user-friendly usage experience based on improving data recognition and extraction effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] The above and other features and advantages of the present application will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.

[0012] Figure 1 The figure is a schematic logical block diagram of a system for extracting data from a structured document according to an embodiment of the present application.

[0013] Figure 2 The diagram is a schematic flowchart of a method for extracting data from a structured document according to an embodiment of the present application.

[0014] Figure 3 The figure is a schematic structural block diagram of a device for extracting data from a structured document according to an embodiment of the present application.

[0015] Figure 4 1 is a schematic structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0016] The exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the disclosure of this application will be thorough and complete and will fully convey the concepts of the exemplary embodiments to those skilled in the art. In the drawings, the dimensions of some elements may be exaggerated or distorted for clarity. Identical reference numerals in the drawings represent identical or similar structures, and thus their detailed descriptions will be omitted.

[0017] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner.In the following description, many specific details are provided so as to provide a full understanding of the embodiments of the present application. However, it will be appreciated by those skilled in the art that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, elements, etc. can be adopted. In other cases, known structures, methods or operations are not shown or described in detail to avoid blurring the various aspects of the technical scheme of the present application.

[0018] In this application, the system, method, and device of the embodiments of this application are introduced by taking the parsing and extraction of the data information of interest from a lease contract as an example. However, the above examples are merely illustrative and not limiting of the technical solutions of this application. The data extraction solution proposed in this application can be applied not only to the intelligent parsing and extraction of key information of contract documents or texts such as lease contracts, but also to the parsing and extraction of key information of other structured documents or texts. These structured documents usually have multiple types of data fields, and their key data information is divided and stored in the corresponding parts of the document according to the classification rules defined by the type of data field. Structured documents include, for example, contracts, resumes, reports, etc. These structured documents can be used in a variety of industries, such as the catering industry, retail industry, leasing industry, transportation industry, trade industry, etc.

[0019] Structured documents typically include various information items represented in the form of text data. These information items correspond to information types that represent different information subjects and content. Hereinafter, the information types of text data are represented by data field types. A complete structured document includes multiple data field types, each of which includes text data of various types and lengths. For example, text in the form of natural language text can be one or more words or phrases, a phrase or sentence consisting of words or phrases, or a paragraph or multiple paragraphs consisting of multiple sentences. Text data can include character and numerical data, as well as various combinations of these characters and numerical values. Text data can also include character and numerical data that are overlaid, superimposed, or embedded in images. Within words, phrases, sentences, or paragraphs, numerical and non-numerical (digital) symbols can also serve as components of these words, phrases, or sentences, forming text data in a broad sense. In this article, text data is generally used to refer to a continuous string of characters and numerical values ​​that expresses a certain topic or piece of information. It can be a continuous phrase or sentence consisting of multiple words (e.g., characters and numerical values). A paragraph is considered to be a collection of multiple sentences, so the term "text data collection" in this article refers to a paragraph or a combination of multiple paragraphs whose character and numerical string length is longer than that of a phrase or sentence. A paragraph as a text data collection can be a paragraph under the same data field type or a paragraph under different data field types. For each information item or data field under each data field type in a structured document, it can include one or more words, phrases and sentences, as well as one or more paragraphs having these words, phrases and sentences. In other words, all text data under each data field type can include a text data collection consisting of one or more text data. For the entire structured document, the text data included in all types of data fields constitute the text data collection of the document. Therefore, the concept of a text data collection not only includes the collection of text data belonging to a single data field type, but also includes the collection of text data belonging to all data field types of a document. When a structured document includes multiple associated documents (for example, when a contract includes multiple sub-contracts), a text data collection can also refer to the combination of all text data included in these structured documents. Text data belonging to a certain data field type can be distributed in the same structured document or in different structured documents in a group of associated structured documents. Ideally, information items in a structured document correspond to data field types. In practice, text data under information items in a structured document may belong to the same or different data field types, or text data under multiple information items may all belong to the same data field type.

[0020] The task of parsing and extracting key information from structured documents such as lease contracts has evolved from inefficient manual solutions to intelligent information processing systems supported by technologies such as artificial intelligence (AI). In the process of automatic information parsing and extraction, structured documents with complex content are usually treated as ordinary contract documents, and corresponding text features are extracted from them according to the common data field types in ordinary contracts. The amount of information that the AI ​​model can extract, the efficiency, and the accuracy mainly depend on the preset configuration of the data field types associated with the contract-type documents. The data field type of the contract depends on the requirements for parsing and extracting information from the contract. Lease contracts, especially those used by catering restaurants in the catering industry, involve a large number of data field types, a wide range of content, and complex logic, resulting in unsatisfactory efficiency and accuracy of AI solutions for extracting key information based on the common data field types of ordinary contracts. For example, the data field types for information extraction from typical contract documents primarily include information items or types such as customer name, amount, signing date, and property rights holder. These fields cannot meet the customized requirements of restaurant lease contracts. Specifically, whether the rent payment method is fixed or commission-based, and whether the payment method is monthly or lease-based, are all unique to restaurant lease contracts. The pre-set data field types for typical contracts are few in number and simple in logic, making them unsuitable for complex data field types when applied to specific lease contracts.

[0021] For complex, structured documents like lease contracts, more complex data field types can be set to represent the complex information items within the document. For example, a restaurant lease contract can have 182 data field types to be parsed and relevant information extracted. In addition to the inherent data field type for the contract name, 181 data field types specific to lease contracts can also be included to meet the specific needs of lease scenarios. These unique data field types enable intelligent information parsing and extraction from text data sets with multiple (e.g., 116) logically complex, flexible, and subject-matter data field types that require contextual semantic understanding. These pre-defined specific data field types include, for example, rent payment method, whether there is an independent third-party property management fee, general ledger sales account data retrieval rules, compensation, security deposits, renovation time, and other specialized pre-defined contract information items or data field types. Extracting data from such a large number of pre-defined data field types specifically for lease contracts presents significant challenges for manual and simple intelligent contract information extraction solutions.

[0022] Furthermore, structured documents with large data volumes and complex logical relationships (such as detailed lease contracts) often contain interrelated text data. This means that text data within the same paragraph, different paragraphs, or even paragraphs, sentences, phrases, and collections of text data within different contract information items may all involve text data belonging to different pre-defined field types. In this case, contract information items within lease contracts are no longer limited to the data field types corresponding to document information parsing and extraction. This situation arises because many information items within complex structured documents are constructed based on document-specific logical relationships, which differ from the requirements of intelligent information parsing and extraction. Other factors include the lack of standardization in the drafting of lease contracts and the presence of logical recursive references and branches between contract information items. For example, within a contract or within a group of related contracts, references such as "see other contract information items or a contract information item or clause in another (sub-)contract" may exist within one or more contract information items or (sub-)contracts, further complicating the data field types of the text data within these contract information items. The contract information items include a combination of text data belonging to multiple data field types, and even the same text data may belong to multiple data field types at the same time, so that text data related to the same or similar contract information exists in different contract information items or multiple locations in the same contract information item, or even in different (sub)contract locations. The multiple locations of these contract information items may not always be located in adjacent or close positions from the perspective of words, phrases, sentences and paragraphs, and in some cases may even be far apart.

[0023] How to accurately and efficiently parse and extract the data field types corresponding to text data for structured documents with complex logical relationships and large amounts of data, and provide the text data corresponding to the preset data field types to business personnel in an integrated manner, is one of the important tasks that the solution proposed in the embodiments of this application focuses on.

[0024] The following combination Figure 1 , taking a lease contract as an example, the logical architecture of a system for extracting data from a structured document according to an embodiment of the present application is introduced.

[0025] The system first obtains a text data set 101 consisting of multiple text data contained in a structured document or a group of associated structured documents, as shown in the dotted box 100. The lease contract as the structured document of the information to be extracted can come from a catering store or a catering enterprise, or a subject or entity associated with the lease contract. As the lessee of the business premises (i.e., Party B of the lease contract), the catering store needs to submit a lease invitation to the building property, property owner, etc. as the lessee (i.e., Party A in the lease contract), so the source of the lease contract can also be the lessee of the lease contract. The provider of the lease contract can also be other participants related to the lease contract, such as regulators.

[0026] If the lease contract is not in electronic form, it must be digitized for easier processing. Typically, digitization involves scanning the contract to create a scanned document (e.g., PDF or image format). The scanned electronic document can then be further digitized using full or partial text recognition (e.g., using OCR technology) to create a coded file that can recognize and extract text data from the document.

[0027] The dashed box 100 also includes rules for parsing and extracting information from the document, namely, preset data field types 102. These preset data field types 102 can be pre-set based on different requirements when establishing the data extraction model or system, or can be input or updated based on user settings. These preset data field types 102 are associated with the requirements for information parsing and extracting structured documents (lease contracts). They can be provided and / or maintained by the business department of a restaurant or catering business, or by any user who needs to extract information from structured documents, as part of the information parsing and extraction rules. Generally speaking, the preset data field types 102 can be identical, similar, or at least related to the contract information items in the lease contract document, so as to fully reflect the accurate information in the lease contract. Ideally, the preset data field types 102 in the information extraction task for the lease contract document are identical to the various contract items in the contract. The primary purpose of the information parsing and extraction task is to intelligently and automatically extract the text of a logically complex and lengthy contract document into a concise combination of key information, making it easier for users to review and process.

[0028] After obtaining the text data set 101 of the lease contract, the system enters the data extraction process. The data extraction process can be implemented using a named entity recognition (NER) model.

[0029] The NER model is used to extract text data in a text paragraph and the entity type to which the text data belongs according to a predefined entity type (such as a preset data field type 102) in a text paragraph (i.e., a text data set). The output text data can be a sentence, phrase, word, or combination thereof in a paragraph. The entity type is embodied as different types in different application scenarios. For example, for a lease contract, the entity type is the data field type related to the contract, such as the name of the lessee and the lessee, the lease term, the rent payment method, the property management fee, etc. For a resume document, the entity type can be the name, educational background, professional experience, skills, etc. The NER model can also be applied to information extraction, relationship extraction, grammatical analysis, information retrieval, question-answering system, machine translation, etc. For the application scenarios of the embodiments of the present application, the information extraction of complex structured documents targeted by the NER model is mainly to complete the extraction and classification of lease contract information embodied in the text data set of the document, which has specific semantic relationships, especially the semantic relationships between text data and text features that are far apart in the text data set. Here, semantic relationships include semantic relationships between text data such as words, phrases, sentences, etc., or semantic relationships between text features extracted from text data that represent features or attributes of one or more dimensions of the text. The result of determining the entity type (data field type) to which the text data belongs is equivalent to the classification result of binary classification, multi-class classification or multi-label classification of the text data. When the text data has information of relevant dimensions for multiple data field types, the multi-label classification method is more suitable. The classification result includes not only the data field type that the text data has or belongs to, but also the probability or possibility of belonging to that type. For simple binary classification results, it can be divided into whether a certain text data belongs to or does not belong to a certain data field type.

[0030] The NER model can be implemented based on traditional algorithm models, such as rule knowledge bases maintained by experts, clustering, probabilistic sequence algorithms, etc. It can also be implemented based on machine learning models or neural network models. Neural network models can include convolutional neural networks (CNN) and recurrent neural networks (RNN), etc. Neural network models based on natural language processing (NLP) technology have significant speed and accuracy advantages for the classification and information extraction of text data sets containing natural language texts, and can bring many advantages to NER models when combined with statistical algorithms. Neural network models can also be pre-trained and trained using supervised, semi-supervised, or unsupervised training data sets to determine the optimal parameters of the model. In particular, neural network models using NLP technology can use large-scale corpora for unsupervised training to obtain sufficient text representation capabilities, and are more effective in entity recognition and relationship extraction of small target corpora.

[0031] Deep learning-based NER models can use neural network architectures such as ELMo, GPT, and BERT, with the BERT model offering superior performance. The BERT model can leverage massive amounts of data for unsupervised learning, achieving superior text feature extraction and classification prediction. For information parsing and extraction from structured Chinese documents, BERT and LSTM models can be combined with other models to form combined NER models, such as BERT+LSTM, LSTM+Conditional Random Field (CRF), and BERT+CRF, to achieve even better text information extraction performance.

[0032] In the process of NER model parsing and extracting information from text data sets, a modular processing approach can be adopted.

[0033] First, the NER model represents, processes and transforms features. The model performs an embedding operation on the character sequence in the original input text data or further adds some features used in traditional shallow supervised neural network models in addition to embedding. Here, the embedding operation refers to mapping high-dimensional original text data with multi-dimensional features or attributes (for example, a sentence with multiple words) to low-dimensional text data with multiple single-dimensional features or attributes (for example, a low-dimensional or single-dimensional feature vector). Embedding operations can include word embedding and character embedding, etc. Among them, in character embedding, the embedding operation for Chinese characters can be completed based on UTF-8 encoding or radicals and strokes. For example, the BERT model mentioned above can convert Chinese characters into encoding to extract the semantic relationship between text features during use.

[0034] After completing the feature representation, the model further implements feature encoding. Among them, the NER model can use a model structure such as CNN, RNN or transformer to perform feature transformation and encoding on the embedding results of the embedding operation. When the BERT model based on NLP technology is used for text feature extraction and text classification prediction, it uses a decoder (encoder) of the Transformer structure as a feature extractor, and can support partial model updates through Fine-tuning (for example, using a softmax sub-network structure). The reason for using the Transformer is that when applied to feature extraction, the performance of the Transformer, RNN and CNN decreases in turn. The Transformer architecture can perform feature combination (for example, splicing) of the embedded output to obtain graphs or feature vector data of larger size and dimension.

[0035] Finally, the NER model performs label decoding and outputs the corresponding type or label of the text data. When the BERT model is used as the main body of the NER model, it can complete similar steps related to feature representation, processing and conversion, as well as feature encoding. However, during the label decoding process, the output result is usually the label or type corresponding to the text feature extracted from the text data, and generally cannot be directly used to determine and predict the types of multiple text data in a text data set (for example, the data field type of the text data in a contract document). In addition, the BERT model can only extract semantic relationships for text features that are adjacent or very close in position in the text data (such as sentences or phrases). When it comes to structured documents with complex logical relationships and large amounts of data, or even text data in the form of words, phrases, and sentences that exist in multiple locations (especially locations that are far apart) in multiple structured documents, the semantic relationship extraction performance is poor.

[0036] exist Figure 1 In the illustrated embodiment, the NER model for implementing the data extraction process utilizes a BERT model structure combined with a multi-layer perceptron (MLP) model and a CRF model structure. This model structure combination is exemplary, and those skilled in the art may utilize other model structures or structure combinations based on the functions and requirements implemented by the NER model. The NER model primarily includes the components indicated by dashed boxes 110, 120, and 130.

[0037] Before extracting sequence annotation data 103 of text data in the text dataset 101 using the first BERT model 121, the text data in the text dataset may be preprocessed 110. The preprocessing operation may include a long document splitting operation 111, etc.

[0038] According to the length of the text, the text data can be divided into text data of normal length (such as words and simple phrases) and long text data of longer length (such as long complex phrases and sentences). Before the text data is input into the first BERT model 121 to determine the sequence annotation data 103 corresponding to the text data, the unnecessary data in the text data can be screened and eliminated, such as removing conjunctions, punctuation marks and modal particles. The text data of normal length contains fewer unnecessary data and is easy to process, so the text feature information of the text data, such as words, can be determined by simple screening and elimination. The long text data is long (for example, including multiple complex phrases and sentences), and even after removing the unnecessary data, it is still not convenient to extract text features, so it needs to be divided into multiple words or simple phrases that can be directly or after simple processing to extract text features. Text data of normal length usually includes a single or significantly related topic or semantics, so it can be provided to the first BERT model 121 as an input vector. Long text data (such as sentences) includes multiple topics or semantics, and these topics and semantics may be unrelated. Therefore, the role of the long text data segmentation operation 111 is to segment these long text data into multiple text data corresponding to single or significantly related topics or semantics, so as to facilitate the first BERT model 121 to extract sequence annotation data 103.

[0039] Specifically, the word embedding implemented by the BERT model may include tokenization (also known as token embedding), sequence embedding, and position embedding, etc. Among them, the tokenization operation can be used to convert text data of character type, such as Chinese characters, into text data of encoding type, especially the conversion of natural language text data, so as to facilitate text feature extraction and subsequent classification. Text features can be represented by words, numbers, and symbols corresponding to the encoding tokens. The preprocessing operation 110 can be performed independently of the BERT model before the first BERT model 121 determines the sequence annotation data 103 corresponding to the text data, or it can be integrated into the BERT model as a sub-function or sub-step performed by the first BERT model 121 to determine the sequence annotation data 103.

[0040] The text data of ordinary text data, long text data and / or character text data type in the text data set 101 are directly or after processing input into the first BERT model 121 in the data field type determination link (as shown in the dotted box 120) including the first data field type and the second data field type. As described above, the BERT model, as an NLP feature extraction and classification prediction model, can perform natural language embedding based on the input (preprocessed) text data, extract associated text features representing the text data, and output the text data in these text data sets 101 and the corresponding sequence annotation data 103. The first BERT model 121 has been trained based on a large-scale corpus, and its Transformer structure can better capture the semantic relationship between the codes (tokens) representing Chinese characters, so it can accurately extract text features associated with the preset data field types for use in subsequent processes.

[0041] According to an embodiment of the present application, the text features extracted by the first BERT model 121 can be further processed, for example, including sequence tagging and position embedding, to obtain sequence tagging data 103 representing the position information of these text data. As described above, the BERT model is generally good at extracting semantic relationships between keywords that are adjacent or very close in position in text data (such as sentences or phrases). Therefore, it is necessary to further extract semantic relationships for those keywords that are located farther away in the text data and text data sets, so as to more comprehensively extract text features related to the preset data field type 102 and the text data to which the text features come from or belong.

[0042] The sequence labeling operation and the position embedding operation can introduce more information for semantic extraction, wherein the sequence labeling can mark the sequence label (such as BIO label) of each text feature in the corresponding text data to obtain the sequence labeling data 103 of the text data, and the position embedding can extract the position of the text feature in the text data and the text data set to represent the closeness of the semantic relationship between multiple text features.

[0043] Sequence labeling can use the labeling and word segmentation method of BIO (Begin-Inner-Output) labeling. In the sequence labeling process. The text sequence of text data corresponds to a sentence or phrase, each word in which is an element, and each element has a label in the BIO labeling. Here, a word generally refers to a text feature or element with a unique token or a word, number, symbol, etc. represented by a token, which is used to represent a certain dimensional feature of the text data. The first word has a B label, the middle (multiple) words have an I label, and the last word has an O label. For a sentence or phrase with multiple words, it should have a label set consisting of multiple BIO labels. BIO labels can represent the multi-dimensional or multi-attribute text features of the text data represented by the sentence or phrase. BIO labels are particularly suitable for representing the semantic relationship between position-related text features of text data. The preset data field type can also be regarded as the data type corresponding to the sentence or phrase with multi-dimensional features or attributes of multiple BIO labels, or the code or value corresponding to the sentence or phrase with the multi-dimensional features or attributes.

[0044] The rule characterization of sequence annotation (such as BIO annotation) is to the mapping relation between the text feature relevant to the position of text data to the preset data field type 102, and can determine the structural parameters of the model that the semantic relationship between the text features is extracted.For example, when determining to have the semantic relationship between the text features of the farther position and adopting CRF neural network model, the network layer of the corresponding number of CRF neural network model can be selected according to the sequence annotation rule.When determining to have the semantic relationship between the text features of the closer position and adopting BERT model, the parameters relevant to the network structure of BERT model can also be selected according to the sequence annotation rule.

[0045] According to an embodiment of the present application, part or all of the operations of the preprocessing operation part 110 and at least one of the operations of sequence tagging and position embedding of text data (text features) can be integrated into the first BERT model 121.

[0046] Based on the position data extracted by the position embedding operation, the positional relationship between the text features can be determined. The sequence annotation data 103 output by the first BERT model 121 and the text data set 101 (and the preprocessed text data) including multiple text data are provided to the second BERT model 122. The second BERT model 122 performs a first feature extraction on the text data based on the text data set 101 and the sequence annotation data 103 corresponding to the text data in the text data set 101 to obtain the first feature data. Since the BERT model focuses on extracting semantic relationships between text features that are adjacent or close in position, the first feature data includes semantic relationships of text features that characterize the text data, especially information on the semantic relationships of text features associated with those text features that are adjacent or close in position in the text data set.

[0047] The second BERT model 122 predicts the preset data field type 102 corresponding to the text data with text features that are adjacent or close in position, or the preset data field type 102 corresponding to the text data tag. The data field type of the text data determined by the second BERT model 122 is called the first data field type 104, which reflects the data field type corresponding to the theme or semantic relationship embodied by the text features with closer relationships in the text data and / or text data set. In this article, the position of text features being adjacent or close refers to at least two text features being located in the same text data, that is, in the same words, phrases and sentences. At least two text features (such as words, numbers and symbols corresponding to the encoding token) can be text features within the same phrase or sentence. In the case of being within the same phrase or sentence, the two text features can be adjacent or non-adjacent, and the positional relationship of such text features is referred to as adjacent or close. According to an embodiment of the present application, at least two text features can also be text features within two adjacent phrases or sentences. In the case of being located within adjacent phrases or sentences, the two text features can be adjacent or non-adjacent, and the positional relationship of such text features is also referred to as adjacent or close. In certain cases, the text features that are adjacent to or close to each other in adjacent phrases or sentences mainly refer to different phrases or sentences in adjacent phrases or sentences but at least two text features that are still adjacent. For example, a text feature is located in the first phrase or sentence in two adjacent phrases or sentences, and another text feature is located in the second phrase or sentence. In the process of determining the data field type information of the text data based on the positional semantic relationship between the text features provided by the second BERT model 122 based on the sequence annotation data 103, it is possible and only possible to process and determine the data field type for the semantic relationship related to the text features that are adjacent to or close to the position, while the semantic relationship related to the text features that are not adjacent to or close to the position cannot be extracted by the second BERT model 122. However, the first feature data output by the second BERT model 122 includes the text feature relationship that can be extracted by the second BERT model 122 and the text feature relationship that cannot be extracted by the second BERT model 122 (this partial feature relationship can be extracted by the CRF model below), so that the complete information set from the text data set 101 and the sequence annotation data 103 is provided to the subsequent model and module processing.

[0048] In general, the performance of the BERT model in extracting text data of various types and lengths in structured documents in the application scenario of this application may not be good enough, so it can be considered to add additional models to improve the extraction performance of semantic relationships related to text features that are adjacent or close in position. According to an embodiment of the present application, the second BERT model 122 is followed by an MLP model 123 (including an input layer, multiple hidden layers and an output layer). The MLP model 123 is used to perform further feature extraction (also referred to as additional feature extraction) on the first feature data from the second BERT model 122, thereby obtaining additional first feature data that is more suitable for predicting the first data field type 104. The additional first feature extraction is used to extract further information about the topic or semantic relationship of text features associated with those text features that are adjacent or close in position in the text data set based on the first feature data, so as to facilitate the prediction of the first data field type of the text data. Therefore, the MLP model 123 can provide better extraction of text feature relationships and determination of the first data field type based on the second BERT model 122. Similar to the second BERT model 122, the additional first feature data output by the MLP model 123 also includes both text feature relationships that can be extracted by the MLP model 123 and text feature relationships that cannot be extracted by the MLP model 123 (these partial feature relationships can still be extracted by the CRF model below).

[0049] exist Figure 1 , the process of predicting the first data field type 104 using the second BERT model 122 in combination with the MLP model 123 is represented by the solid arrows between the second BERT model 122, the MLP model 123, and the CRF model 124, wherein the solid arrow from the MLP model 123 to the first data field type 104 represents the more accurate determination of the first data field type 104 of the text data by the MLP model 123. If a solution without the MLP model 123 is adopted, the first feature data output by the second BERT model 122 is directly input into the CRF model 124, and the first data field type 104 of the text data is directly determined by the second BERT model 122, as indicated by the dotted arrow.

[0050] The CRF model 124 is more suitable for the MLP model 131 that extracts semantic relationships between keywords that are farther apart. The first feature data (from the second BERT model 122) or the additional first feature data (from the MLP model 123) received by the CRF model 124 includes information about the topic or semantic relationship embodied by text features that are closer in the text data and / or text data set, as well as information about the topic or semantic relationship embodied by text features that are farther away. Therefore, the input of the CRF model 124 actually still contains all the information of the sequence annotation data 103 output by the first BERT model 121 and the text data set 101 including multiple text data (as well as preprocessed text data), except that this information is information that has been further processed (such as feature extraction) by the second BERT model 122 and / or the MLP model 123.

[0051] The location of text features is far away or very far away means that at least two text features (such as words, numbers and symbols corresponding to the encoding token) are located at far away positions in the text data, or are located in different text data. The different text data can belong to different paragraphs in the same data field type (such as contract information item), or can belong to words, phrases, sentences and paragraphs in different data field types in a structured document, or belong to different structured documents. Compared with the adjacent or close positions of text features, the at least two text features that are far away can be located in adjacent words or sentences in the text data set, but the text features are not adjacent, or they are located in non-adjacent phrases or sentences. Non-adjacent phrases or sentences can be located in the same paragraph, or in different paragraphs. When they are located in different paragraphs, the different paragraphs can be paragraphs belonging to the same data field type, or paragraphs belonging to different data field types, or even paragraphs belonging to different documents in a group of structured documents. For example, the text features are located in different paragraphs of the same contract information item, or in different words, phrases, sentences or paragraphs scattered under different contract information items.

[0052] The data field type ultimately output by the CRF model 124 is also selected from the preset data field type 102, which represents the data field type of text data identified and determined for the subject or semantic relationship between text features that are not adjacent or close in position, that is, those that are far away or very far away (such as words, numbers, and symbols corresponding to encoding tokens), and is called the second data field type 105.

[0053] The CRF model 124 can generate a rule for extracting semantic relationships between text features that are located far apart and determining the second data field type 105 based on the mapping relationship between the sequence annotation data 103 output from the first BERT model 121 and the second data field type 105 corresponding to the text data. Based on this rule, the CRF model 124 performs a second feature extraction on the first feature data, thereby determining the second data field type 105 of the text data. Therefore, the CRF model 124 actually determines the second data field type 105 associated with those text features of the text data in the text dataset 101 that are located far apart in the text dataset based on the information of the sequence annotation data 103 provided by the first BERT model 121.

[0054] Compared to the second BERT model 122, the CRF model 124 focuses more on the semantic relationship between text features that are located farther apart in the text data and the text data set 101. These text features can be text features of two words or phrases that are farther apart in a long sentence, text features of different words, phrases, and sentences that are farther apart in a paragraph, or even text features of words, phrases, and sentences that belong to the same preset data field type 102 across sentences but belong to the same paragraph or not, or further, text features of words, phrases, sentences, and paragraphs in different preset data field types 102 within the entire structured document. Through the semantic relationship between these text features that are farther apart, or even very far away, classification prediction of text features that are farther apart can be achieved. By using CRF model 124, in addition to the data field types extracted for semantic relationships between text features that are closer together by the second BERT model 122 (and / or MLP model 123), data field types extracted for semantic relationships between text features that are farther apart can be added. This allows for more accurate identification and extraction of at least one data field type 104 and 105 associated with a wider range of text data and text datasets. The CRF model 124 is highly robust, making its parsing and identification performance for data field types corresponding to text data very stable and reliable, thereby improving the effectiveness of the entire system.

[0055] From the distance of the semantic relationships of the text features that the model can extract, it can be seen that the BERT model can extract semantic relationships to determine those text features of the first data field type, that is, text features with adjacent or similar positions, while the BERT model cannot extract them and needs the CRF model to extract semantic relationships to determine those text features of the second data field type, that is, text features based on the position principle.

[0056] After obtaining the first data field type 104 and the second data field type 105, which respectively reflect the closer feature relationship and the more distant feature relationship of the text data, the system integrates the text data with the same data field type in the entire text data set of the structured document, extracts and annotates at least one text data corresponding to the preset data field type 102, and forms complete document information parsed and extracted based on the preset data field type 102, as shown in the post-classification processing portion of the dotted box 130. The text data corresponding to these data field types can be part or all of the text content in the words, phrases, sentences, and paragraphs in the original information items of the document (for example, the lease contract information items), or can be part or all of the text content in the words, phrases, sentences, and paragraphs in different original information items scattered in different structured documents in the same structured document or a group of structured documents.

[0057] The post-classification processing section 130 of the text data or text data set 101 based on the data field types 104 and 105 may include a sequence labeling decode 131 and a multi-text data fusion 132. The sequence labeling decode 131 is used to decode the correspondence between the sequence labeling data 103 and the data field types 104 and 105 based on the sequence labeling rules (e.g., the rules of BIO labeling) into a correspondence between the text data and the data field types 104 and 105 that can be understood and recognized by the user. The multi-text data fusion 132 is used to fuse the text data belonging to the same preset data field type 102 into a complete text data or text data set, for example, to fuse multiple words, phrases, sentences, and paragraphs marked as the same preset data field type 102 into a complete phrase, sentence, paragraph, or coherent paragraph. The fusion operation may include vector concatenation, numerical summation, etc. For example, for the data field type of lease area in a lease contract, the text data items or text data sets belonging to the same data field type related to lease area in data field types 104 and 105 are 40 square meters for the first layer and 30 square meters for the second layer, respectively. The predicted output of the fused NER model can be that the lease area is 40+30=70 square meters (the fusion operation here is numerical summation). For some text data corresponding to simple sequence annotation data 103, the sequence annotation decoding operation 131 can be skipped and the multi-text data fusion operation 132 can be directly performed.

[0058] Ideally, when the preset data field types are identical or semantically similar to the various information items in a structured document, the relevant data field types extracted by the NER model and the fused text data 107 corresponding to those data field types can accurately cover the information and content of the corresponding information items in the document, and can even parse and extract more information and content across information items from the document. Compared to traditional AI models, the structured document data extraction system of the present application has a higher average recognition accuracy rate for text data corresponding to the preset data field types, for example, exceeding 80%.

[0059] According to an embodiment of the present application, after the NER model outputs the data extraction results, the system can also add rules to adjust the preset data field types, optimizing the output results for easier understanding and reading by users. For example, the contract items of Party A and Party B in the body of a lease contract can be replaced with the names of the entities referred to in the contract (Party A of the lease is a specific property, and Party B of the lease is a restaurant store), making the text data or text data collection under the corresponding data field type more readable.

[0060] Before using the NER model, transfer learning technology can be applied to target text data types of entities such as contract information items in lease contracts. Large amounts of text data corpora at the level of hundreds of thousands of documents can be used as training data sets for the model for targeted and specific pre-training. This allows the model to achieve better results with smaller target corpora in new text data recognition and relationship extraction tasks.

[0061] Pre-training training data can be obtained by annotating the text data and the corresponding data field types in the OCR results of the document. The labeled data can be the entire document or a portion of it. A large corpus of document data can achieve better model training results.

[0062] At least one of the first BERT model 121 , the second BERT model 122 , the MLP model 123 and the CRF model 124 in the NER model may be pre-trained, trained and adjusted separately, or the NER model as a whole may be pre-trained, trained and adjusted.

[0063] During the use of the system, the auxiliary business personnel can also view and modify the extraction results of the document information through the background management system that can be interactive online in real time, collect and modify the records of the extraction results, and form calibration data 108 to guide the system model to perform self-learning iteration to optimize the model parameters in the model update iteration and optimization link (as shown in the dotted box 140). Figure 1The dashed arrows from the calibration data 108 to the various models 121, 122, 123, and 124 are shown in FIG. The preset data field types 102 can also be adjusted periodically or in real time based on updated structured document data and / or updated data of the model training dataset can be generated to fine-tune model parameters and improve the data parsing and extraction effect of the system model on structured text.

[0064] Figure 2 The method for extracting information of a structured document according to an embodiment of the present application is shown. Figure 1 The same or similar steps in the system will not be described in detail.

[0065] The method for extracting data from a structured document includes a step S210 for obtaining a text data set of a structured document, a step S220 of using a first BERT model to determine text features of the text data of the text data set (such as words, numbers and symbols corresponding to encoding tokens) and sequence annotation data corresponding to the text data, a step S230 of determining a first data field type of the text data based on the sequence annotation data corresponding to the text data and a step S240 of determining a second data field type of the text data, and a step S250 of extracting text data corresponding to a preset data field type from the text data set based on the first field type and the second field type, wherein the first and second data field types should be associated with text features of the text data that are adjacent or close in position in the text data set and text features that are far away in position, respectively.

[0066] Step S210 may include performing digitization processing on the non-electronic structured document to obtain the text data set, wherein the digitization processing may include OCR scanning and the like.

[0067] In step S220, before determining the sequence annotation data, the text data set may be preprocessed to conform to the data input format of the BERT model. These preprocessing operations may include, for example, segmentation of long text data. After extracting text features from the text data, step S220 may further include performing a sequence annotation operation and a position embedding operation on the text features of the text data, determining the sequence label of the text feature (for example, obtaining a sequence label such as a BIO label) based on the position of the text feature in the text data (set), thereby determining the sequence annotation data of the text data.

[0068] Step S230 further includes, for example, using a second BERT model to perform a first feature extraction based on sequence annotation data such as from the first BERT model and the text data set (the text data in) to obtain first feature data, and for those text features that are located in a position close or adjacent to each other in the text data set, determining the semantic relationship between these text features and determining and marking the first data field type of the text data having these text features based on the semantic relationship. Step S230 may also further include using, for example, an MLP model 123 to perform additional feature extraction on the first feature data to obtain further information about the topic or semantic relationship of the text features associated with those text features that are located in a position close or adjacent to each other in the text data set, thereby obtaining additional first feature data suitable for more accurately predicting the first data field type.

[0069] After step S230, step S240 further includes performing a second feature extraction using a CRF model, for example, based on the first feature data or additional first feature data from step S230, for those text features that are located farther away than those text features that are located similarly or adjacently. The second data field type of the text data having the text features that are located farther away is determined.

[0070] After obtaining the first and second data field types of the text data, in step S250, text data having the same data field type is further determined to obtain an extraction result. The extraction result can be further processed to determine multiple text data corresponding to the preset data field type based on the annotation rules of the sequence annotation data, and these text data are merged to facilitate user understanding and reading.

[0071] The method may also include the steps of pre-training model parameters using labeled training data and / or model parameters before using the BERT model (specifically the first and second BERT models), the MLP model and the CRF model and the overall NER model composed of these models, and fine-tuning and updating the model using calibration data from business personnel.

[0072] Furthermore, the method may further include step S260 of adjusting the data field type using the extracted text data content corresponding to the preset data field type to optimize the output result, such as Figure 2 As shown in the dotted box.

[0073] Figure 3 FIG. 3 shows a device 300 for extracting data from a structured document according to an embodiment of the present application.

[0074] The device 300 includes an acquisition unit 310 for acquiring a text data set of a structured document and a preset data field type, and an extraction unit 320 for extracting data from the structured document.

[0075] The extraction unit 320 further includes a first BERT model 321 for determining text features of text data of a text data set and sequence annotation data corresponding to the text data, a second BERT model 322 for performing a first feature extraction based on the sequence annotation data to obtain first feature data and determine a first data field type of the text data, an MLP model 323 for further performing additional feature extraction based on the second BERT model 322 to obtain additional first feature data and determine a more accurate first data field type of the text data based on the additional first feature data, and a CRF model 324 for performing a second feature extraction based on the first feature data or additional first feature data from the second BERT model 322 and / or the MLP model 323 to determine a second data field type of the text data, and a training unit 325 for pre-training based on the labeled training data and optimizing the models 321 to 324 based on the updated calibration data. When the models 321 to 324 constitute an overall NER model that implements the data extraction function, the training unit 325 can be used to pre-train and update the NER model. The extraction unit 320 can also extract text data corresponding to the preset data field type from the text data set based on the first field type output by the second BERT model 322 or the MLP model 323 and the second field type output by the CRF model 324. According to an embodiment of the present application, the extraction unit 320 can also implement the following Figure 1 The functions of the dashed box portions 110 to 140 shown in FIG. Figure 2 Further details of steps S220 to S260 are shown in FIG.

[0076] The device 300 may include an output unit (not shown) for providing the data extraction results to the user in a visual or readable form. The output unit may be a display or a touch screen, and may also provide a user interface for interacting with the user to receive user input and feedback. In this case, the output unit is equivalent to an input / output unit.

[0077] By adopting the data extraction scheme of the embodiment of the present application, an improved text parsing and extraction model is introduced for text data sets in complex structured documents with a large number of data field types, and a transfer learning strategy is used to combine structured documents such as lease contracts with a large amount of document-level corpus for specific pre-training, thereby achieving entity recognition and relationship extraction of small target corpus, and obtaining fast, accurate and intelligent information recognition and extraction effects for structured documents. The scheme of the present application can also expand data field types and support the evaluation and calibration of business data to further optimize the performance of the system model. After parsing and extracting valuable information, the extraction results of the text data can be optimized to facilitate user understanding and reading, providing a more user-friendly usage experience based on improving data recognition and extraction effects.

[0078] It should be noted that although several modules or units of the system for extracting data from structured documents are mentioned in the detailed description above, this division is not mandatory. In fact, according to the implementation mode of the present application, the features and functions of two or more modules or units described above can be concretized in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units for concretization. The components displayed as modules or units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of the present application. Those of ordinary skill in the art can understand and implement it without paying any creative work.

[0079] In exemplary embodiments of the present application, a computer-readable storage medium is further provided, on which a computer program is stored. The program includes executable instructions that, when executed by, for example, a processor, can implement the steps of the method for extracting data from a structured document described in any of the aforementioned embodiments. In some possible implementations, various aspects of the present application can also be implemented in the form of a program product, which includes program code. When the program product is executed on a terminal device, the program code is used to cause the terminal device to perform the steps described in the method for extracting data from a structured document according to various exemplary embodiments of the present disclosure.

[0080] According to an embodiment of the present application, a program product for implementing the above method can be a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0081] The program product may be implemented in any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable 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 thereof.

[0082] The computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. The data signal propagated may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, device, or component. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination thereof.

[0083] The program code for performing the operations of the present application can be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0084] In an exemplary embodiment of the present application, an electronic device is further provided, which may include a processor and a memory for storing executable instructions of the processor, wherein the processor is configured to execute the steps of the method for extracting data from a structured document in any of the above embodiments by executing the executable instructions.

[0085] Those skilled in the art will appreciate that various aspects of the present application can be implemented as systems, methods, or program products. Therefore, various aspects of the present application can be specifically implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation that combines hardware and software aspects, which may be collectively referred to herein as a "circuit," "module," or "system."

[0086] Refer to the following Figure 4 4 to describe an electronic device 400 according to this embodiment of the present application. Figure 4 The electronic device 400 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present application.

[0087] like Figure 4 As shown, electronic device 400 is implemented as a general-purpose computing device. Components of electronic device 400 may include, but are not limited to, at least one processing unit 410, at least one storage unit 420, a bus 430 connecting various system components (including storage unit 420 and processing unit 410), a display unit 440, and the like.

[0088] The storage unit stores program codes, which can be executed by the processing unit 410, so that the processing unit 410 performs the steps according to various exemplary embodiments of the present disclosure described in the method for extracting data from a structured document. For example, the processing unit 410 can perform the following steps: Figure 2 Follow the steps shown in .

[0089] The storage unit 420 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 4201 and / or a cache memory unit 4202 , and may further include a read-only memory unit (ROM) 4203 .

[0090] The storage unit 420 may also include a program / utility 4204 having a set (at least one) of program modules 4205, such program modules 4205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include an implementation of a network environment.

[0091] Bus 430 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0092] The electronic device 400 can also communicate with one or more external devices 500 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 400, and / or any device that enables the electronic device 400 to communicate with one or more other computing devices (e.g., a router, a modem, etc.). Such communication can occur via an input / output (I / O) interface 450. Furthermore, the electronic device 400 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 460. The network adapter 460 can communicate with other modules of the electronic device 400 via the bus 430. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with the electronic device 400, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0093] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the method for extracting data from a structured document according to the embodiments of the present application.

[0094] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the contents disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present application that follow the general principles of the present application and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered merely as exemplary, and the true scope and spirit of the present application are indicated by the appended claims.

Claims

1. A method for extracting data from a structured document, implemented by a named entity recognition (NER) model, comprising: Acquire a text data set of the structured document, wherein the text data set includes a plurality of text data; Determining sequence annotation data of the text data; Determining a first data field type of the text data based on the sequence annotation data, wherein the first data field type is associated with a text feature of the text data that is adjacent or close in position in the text data set; Determining a second data field type of the text data, wherein the second data field type is associated with a text feature of the text data that is located far away in the text data set; as well as Extracting text data corresponding to a preset data field type from the text data set based on the first data field type and the second data field type includes: determining text data having the same data field type based on the first data field type and the second data field type; Determining a plurality of text data corresponding to a preset data field type based on the annotation rule of the sequence annotation data; The multiple text data are fused, wherein: The named entity recognition (NER) model includes a first BERT model, a second BERT model and a conditional random field (CRF) model, wherein: The first BERT model is configured to determine sequence annotation data for the text data; The second BERT model is configured to perform a first feature extraction based on the sequence annotation data to obtain first feature data and determine the first data field type of the text data; The conditional random field (CRF) model is configured to perform second feature extraction and determine the second data field type.

2. The method according to claim 1, characterized in that Adjacent or close locations include at least one of the following location relationships: At least two text features are located in the same phrase or sentence; The at least two text features are respectively located in different phrases or sentences in adjacent phrases or sentences, and the at least two text features are adjacent.

3. The method according to claim 1, characterized in that The location distance includes at least one of the following location relationships: At least two text features are respectively located in different phrases or sentences in adjacent phrases or sentences, and the at least two text features are not adjacent; The at least two text features are respectively located in different phrases or sentences in non-adjacent phrases or sentences.

4. The method according to claim 1, wherein Acquiring the text data set of the structured document further includes: The structured document is digitized to obtain the text data set.

5. The method according to claim 4, characterized in that The digitization process includes OCR.

6. The method according to any one of claims 1 to 5, characterized in that The method further includes preprocessing the text data set, wherein the preprocessing includes at least one of the following: Segmenting the long text data in the text data set; Convert character-type text data into encoding-type text data.

7. The method according to any one of claims 1 to 5, characterized in that Determining the sequence annotation data of the text data further includes: extracting the text features of the text data; Determine the sequence labels of the text features in the corresponding text data.

8. The method according to claim 7, characterized in that The method further includes determining the sequence label based on a position of the text feature in the text dataset.

9. The method according to claim 7, characterized in that The sequence tag is a BIO tag.

10. The method according to claim 7, characterized in that Determining the first data field type of the text data based on the sequence annotation data further includes: A first feature extraction is performed on the text data based on the sequence labeling data to obtain first feature data and the first data field type of the text data is determined.

11. The method according to claim 10, characterized in that Performing first feature extraction on the text data based on the sequence labeling data to obtain first feature data and determining the first data field type of the text data further includes: Additional feature extraction is performed based on the first feature data to obtain additional first feature data and the first data field type of the text data is determined.

12. The method according to claim 10, characterized in that Determining the second data field type of the text data further includes: A second feature extraction is performed based on the first feature data to determine the second data field type of the text data.

13. The method according to claim 11, characterized in that Determining the second data field type of the text data further includes: A second feature extraction is performed based on the additional feature to determine the second data field type of the text data.

14. The method according to claim 12 or 13, characterized in that The text features that are located far away from each other belong to different text data.

15. The method according to claim 1, wherein The method further includes adjusting the preset data field type based on text data corresponding to the preset data field type.

16. The method according to claim 1, wherein The named entity recognition (NER) model further includes a multi-layer perceptron (MLP) model configured to perform additional feature extraction based on the first feature data and determine the first data field type.

17. The method according to claim 16, characterized in that The conditional random field (CRF) model is further configured to perform a second feature extraction based on the additional feature to determine the second data field type.

18. The method according to claim 1, wherein At least one of the named entity recognition (NER) model, the first BERT model, the second BERT model, and the conditional random field (CRF) model is pre-trained and / or trained using a training dataset.

19. The method according to claim 16, wherein The multi-layer perceptron (MLP) model is pre-trained and / or trained using a training dataset.

20. The method according to claim 1, wherein The named entity recognition (NER) model is updated based on calibration data of the first data field type and the second data field type of the text data.

21. The method according to any one of claims 1 to 5, characterized in that The structured document includes a lease contract, and the data field type includes a contract field type.

22. The method according to any one of claims 1 to 5, characterized in that The structured document is a combination of multiple structured documents.

23. A device for extracting data from a structured document, implemented by a named entity recognition (NER) model, comprising: an acquiring unit, configured to acquire a text data set of the structured document, wherein the text data set includes a plurality of text data; an extraction unit configured to determine sequence annotation data of the text data; Determining a first data field type of the text data based on the sequence annotation data, wherein the first data field type is associated with a text feature of the text data that is adjacent or close in position in the text data set; determining a second data field type of the text data, wherein the second data field type is associated with a text feature of the text data that is far away in position in the text data set; and extracting text data corresponding to a preset data field type from the text data set based on the first data field type and the second data field type, including: determining text data having the same data field type based on the first data field type and the second data field type; extracting text data corresponding to a preset data field type based on the sequence annotation data The method comprises the steps of: determining a plurality of text data corresponding to a preset data field type according to the annotation rules; fusing the plurality of text data, wherein the extraction unit includes the named entity recognition (NER) model, the named entity recognition (NER) model includes a first BERT model, a second BERT model and a conditional random field (CRF) model, wherein the first BERT model is configured to determine sequence annotation data of the text data; the second BERT model is configured to perform a first feature extraction based on the sequence annotation data to obtain first feature data and determine the first data field type of the text data; the conditional random field (CRF) model is configured to perform a second feature extraction and determine the second data field type.

24. The device according to claim 23, characterized in that Adjacent or close locations include at least one of the following location relationships: At least two text features are located in the same phrase or sentence; The at least two text features are respectively located in different phrases or sentences in adjacent phrases or sentences, and the at least two text features are adjacent.

25. The device according to claim 23, characterized in that The location distance includes at least one of the following location relationships: At least two text features are respectively located in different phrases or sentences in adjacent phrases or sentences, and the at least two text features are not adjacent; The at least two text features are respectively located in different phrases or sentences in non-adjacent phrases or sentences.

26. The apparatus according to any one of claims 23 to 25, characterized in that The named entity recognition (NER) model further includes a multi-layer perceptron (MLP) model.

27. The device according to claim 26, characterized in that It also includes a training unit, which is configured to pre-train and / or train at least one of the named entity recognition (NER) model, the first BERT model, the second BERT model, the multi-layer perceptron (MLP) model and the conditional random field (CRF) model using a training dataset.

28. A computer-readable storage medium having a computer program stored thereon, the computer program comprising executable instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 22.

29. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to execute the executable instructions to implement the method according to any one of claims 1 to 22.

Citation Information

Patent Citations

  • Information extraction method, information extraction device, computer readable storage medium and electronic equipment

    CN111223481A