Key contract field extraction method, device, electronic device and storage medium
By performing text analysis and page classification of contract files, filtering key pages and extracting field information using BiLSTM model, the problem of low efficiency in extracting key contract fields in the existing technology is solved, and a more efficient extraction process is achieved.
Patent Information
- Application Number
- CN202211230213.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-08
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2042-10-08
AI Technical Summary
The existing key contract field extraction method is inefficient because field extraction operations are required for every page of the contract, resulting in inefficiency.
By obtaining the contract file and determining its format, using the preset file analysis algorithm library to filter the target file analysis algorithm, text analysis and page classification for each page, filtering key pages and field extraction, and using BiLSTM model and classification model to extract key contracts Field information.
The accuracy and efficiency of key contract field extraction is improved. Just perform field extraction on key pages, which significantly improves the efficiency of the entire process.
Smart Images

Figure CN115546814B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to artificial intelligence technology, and in particular to a method, device, electronic device and storage medium for extracting key contract fields. Background Art
[0002] Contract verification plays an important role in trade background verification. Since the contract information to be reviewed is only some key fields that need to be reviewed, in order to conduct contract review more quickly, the key contract field extraction method is usually used to identify the contents of the fields to be reviewed in the contract for contract review.
[0003] However, the existing key contract field extraction directly performs field extraction operations on each page of the contract, resulting in low efficiency in key contract field extraction. Summary of the invention
[0004] The present invention provides a key contract field extraction method, device, electronic equipment and storage medium, the main purpose of which is to improve the accuracy of key contract field extraction.
[0005] Obtain contract documents and corresponding contract document formats;
[0006] Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm;
[0007] Using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document;
[0008] Classifying each page of the contract document using a pre-built classification model based on the text content to obtain a page category for each page of the contract document;
[0009] Filter key pages in the contract document based on the page categories, and determine the text content of the key pages as target text content;
[0010] Field extraction is performed on the target text content to obtain key contract field information.
[0011] Optionally, classifying each page of the contract document using a pre-built classification model based on the text content to obtain a page category of each page of the contract document includes:
[0012] Analyzing the text content of each page of the contract document using multiple classification models to obtain an initial page category of each page of the contract document corresponding to each classification model;
[0013] The initial page category with the highest frequency of occurrence among all initial page categories corresponding to each page of the contract document is determined as the page category of the page.
[0014] Optionally, determining the initial page category with the highest appearance frequency among all initial page categories corresponding to each page of the contract document as the page category of the page includes:
[0015] Determine whether the type of the initial page category that appears most frequently among all the initial page categories corresponding to each page in the contract document is one;
[0016] When the type of the initial page category that appears most frequently among all the initial page categories corresponding to each page of the contract document is one, the initial page category that appears most frequently among all the initial page categories corresponding to each page of the contract document is determined as the page category of the page;
[0017] When the type of initial page category that appears most frequently among all initial page categories corresponding to each page in the contract document is not one;
[0018] Determine the initial page category with the highest frequency of occurrence among all initial page categories corresponding to each page in the contract document as the page category to be selected for the page;
[0019] All the candidate page categories corresponding to each page in the contract document are sorted using a preset text sorting rule, and the candidate page category ranked first is selected as the page category of the page.
[0020] Optionally, the extracting fields from the target text content to obtain key contract field information includes:
[0021] Segmenting the target text content to obtain a plurality of segmented words;
[0022] Convert the segmented words into vectors to obtain segmented word vectors;
[0023] The BiLSTM model is used to extract features from the word vector, and the extracted features are identified and classified using a pre-built classification function to obtain entity probabilities corresponding to preset field types;
[0024] Determine the segmentation words corresponding to the segmentation word vectors whose entity probability corresponding to the preset field type is greater than the preset entity threshold as entity words of the preset field type;
[0025] Calculate the order coefficient of the entity words corresponding to each preset field type by using a serialization annotation algorithm, and combine all the entity words corresponding to the preset field type according to the order coefficient to obtain an extraction field corresponding to the preset field type;
[0026] All the extracted fields are aggregated to obtain the key contract field information.
[0027] Optionally, converting the segmented words into vectors to obtain segmented word vectors includes:
[0028] Convert each character in the segmented word into a character vector;
[0029] All the character vectors are combined according to the order of the corresponding characters in the segmented words to obtain the segmented word vector.
[0030] Optionally, the using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document includes:
[0031] Using the target file parsing algorithm to segment each page of the contract file to obtain a contract page file;
[0032] Convert the contract page file into a preset target file type to obtain a converted page file;
[0033] The conversion page file is parsed using OCR recognition technology to obtain the text content.
[0034] Optionally, screening key pages in the contract document based on the page category includes:
[0035] Calculate the intersection of a preset key page category set and all the page categories to obtain a target page category set;
[0036] The page corresponding to each page category in the target page category set is determined as the key page.
[0037] In order to solve the above problem, the present invention also provides a key contract field extraction device, the device comprising:
[0038] A page parsing module is used to obtain a contract document and a corresponding contract document format; select a file parsing algorithm in a preset file parsing algorithm library according to the contract document format to obtain a target file parsing algorithm; and perform text parsing on each page of the contract document using the target file parsing algorithm to obtain the text content of each page of the contract document;
[0039] A page classification module, used to classify each page of the contract document based on the text content using a pre-built classification model to obtain a page category of each page of the contract document;
[0040] A field extraction module is used to filter key pages in the contract document based on the page category, and determine the text content of the key page as the target text content; perform field extraction on the target text content to obtain key contract field information.
[0041] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0042] a memory storing at least one computer program; and
[0043] A processor executes the computer program stored in the memory to implement the above-mentioned key contract field extraction method.
[0044] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned key contract field extraction method.
[0045] The embodiment of the present invention classifies each page of the contract document based on the text content using a pre-built classification model to obtain the page category of each page of the contract document; based on the page category, the key pages in the contract document are screened, and the text content of the key pages is determined as the target text content; key contract field extraction requires the extraction of the text content of the key pages. The embodiment of the present invention performs field extraction in the determined key pages to extract the required contract key fields. Compared with field extraction for each page of the contract document, field extraction only needs to be performed on the key pages, which improves the efficiency of key contract field extraction. Therefore, the key contract field extraction method, device, electronic device and readable storage medium proposed in the embodiment of the present invention improve the efficiency of key contract field extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A flowchart of a method for extracting key contract fields provided by an embodiment of the present invention;
[0047] Figure 2 A schematic diagram of a module of a key contract field extraction device provided by an embodiment of the present invention;
[0048] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a method for extracting key contract fields provided by an embodiment of the present invention;
[0049] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0051] An embodiment of the present invention provides a method for extracting key contract fields. The execution subject of the key contract field extraction method includes but is not limited to at least one of the electronic devices such as a server and a terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the key contract field extraction method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc. The server can be an independent server, or it can be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
[0052] Reference Figure 1 FIG. 1 is a flow chart of a method for extracting key contract fields provided by an embodiment of the present invention. In the embodiment of the present invention, the method for extracting key contract fields includes:
[0053] S1. Obtain the contract documents and the corresponding contract document format;
[0054] The contract document described in the embodiment of the present invention is a contract document that needs to be reviewed and verified. Furthermore, since the formats of the contract documents are different, in order to more specifically parse and identify the text content in the contract document, the embodiment of the present invention needs to obtain the contract file format of the contract document, and the text format can be doc, docx, pdf, jpg and other formats.
[0055] Optionally, in one embodiment of the present invention, the contract file may be one of multiple contract files received in the Redis message middleware. Receiving the contract file through the Redis message middleware can avoid service crashes caused by too many contract files that need to be processed and cannot be processed in time.
[0056] S2. Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm;
[0057] In an embodiment of the present invention, the file parsing algorithm library contains file parsing algorithms corresponding to different contract file formats. In an embodiment of the present invention, a suitable file parsing algorithm can be screened out from the parsing algorithm library according to the contract file format to parse the contract file.
[0058] S3, using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document;
[0059] In order to better parse the text content in the contract file and prevent all the text content in the contract file from being mixed together, resulting in too much recognized text content, which affects the speed of subsequent field extraction, the embodiment of the present invention uses the target file parsing algorithm to perform text parsing on each page of the contract file to obtain the text content of each page of the contract file. Specifically, the embodiment of the present invention can locate each page of the contract file by identifying the page number in the contract file.
[0060] In detail, in the embodiment of the present invention, the target file parsing algorithm is used to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document, including:
[0061] Using the target file parsing algorithm to segment each page of the contract file to obtain a contract page file;
[0062] Convert the contract page file into a preset target file type to obtain a converted page file;
[0063] The conversion page file is parsed using OCR recognition technology to obtain the text content.
[0064] Specifically, the target file type in the embodiment of the present invention is a file type such as PDF, JPG, GIF, PNG, BMP, TIF, etc.
[0065] S4, classifying each page of the contract document using a pre-built classification model based on the text content to obtain a page category of each page of the contract document;
[0066] Because not all the text contents of the pages in the contract document need to be subjected to field extraction, only the text contents of some key pages need to be subjected to field extraction. Therefore, in order to determine the key pages in the contract document, the embodiment of the present invention needs to classify each page of the contract document to determine the page category corresponding to the page, so as to judge whether the corresponding page is a key page, wherein the page category of the key page can be page categories such as cover page, subject page, price page, payment page, effective terms page, signature page, etc.
[0067] One embodiment of the present invention can use multiple pre-built classification models to classify each page of the contract document respectively, and integrate the classification results of all models to obtain the page category of each page of the contract document.
[0068] Specifically, S4 in the embodiment of the present invention includes:
[0069] Analyzing the text content of each page of the contract document using multiple classification models to obtain an initial page category of each page of the contract document corresponding to each classification model;
[0070] The initial page category with the highest frequency of occurrence among all initial page categories corresponding to each page of the contract document is determined as the page category of the page.
[0071] Furthermore, in the embodiment of the present invention, the initial page category with the highest frequency of occurrence among all initial page categories corresponding to each page of the contract document is determined as the page category of the page, including:
[0072] Determine whether the type of the initial page category that appears most frequently among all the initial page categories corresponding to each page in the contract document is one;
[0073] When the type of the initial page category that appears most frequently among all the initial page categories corresponding to each page of the contract document is one, the initial page category that appears most frequently among all the initial page categories corresponding to each page of the contract document is determined as the page category of the page;
[0074] When the type of initial page category that appears most frequently among all initial page categories corresponding to each page in the contract document is not one;
[0075] Determine the initial page category with the highest frequency of occurrence among all initial page categories corresponding to each page in the contract document as the page category to be selected for the page;
[0076] All the candidate page categories corresponding to each page in the contract document are sorted using a preset text sorting rule, and the candidate page category ranked first is selected as the page category of the page.
[0077] The classification model in the embodiment of the present invention may be a deep learning model trained using a training set, and the deep learning model may be a modified BERT model, a modified Ernie-Doc model, or a Transformer-xl model. The modified BERT model is a BERT model in which the loss function is replaced by Focal Loss instead of Cross Entropy Loss, and the modified Ernie-Doc model is an Ernie-Doc model in which the loss function is replaced by Focal Loss instead of Cross Entropy Loss.
[0078] Furthermore, in the embodiment of the present invention, before using the training set to train the deep learning model, the training set can also be data enhanced, such as resampling the data in the training set, positive sample EDA enhancement, etc. to perform data enhancement. Among them, data resampling includes: undersampling of negative samples, oversampling of fewer positive samples, and positive sample EDA data enhancement methods include: synonym replacement, back translation, random insertion, random exchange, random deletion, etc., among which the data enhancement methods of synonym replacement and back translation can be selected in this embodiment. Back translation refers to translating the Chinese contract text into a foreign language, and then translating the foreign language back to Chinese.
[0079] S5, screening key pages in the contract document based on the page categories, and determining the text content of the key pages as target text content;
[0080] The key pages described in the embodiment of the present invention include pages from which information needs to be extracted, and the corresponding page categories are cover page, subject page, price page, payment page, effective terms page, and signature page.
[0081] In an embodiment of the present invention, filtering key pages in the contract document based on the page category includes:
[0082] Calculate the intersection of a preset key page category set and all the page categories to obtain a target page category set;
[0083] The page corresponding to each page category in the target page category set is determined as the key page.
[0084] Specifically, the embodiment of the present invention aggregates all the page categories to obtain a page category set; and calculates the intersection of the key page category set and the page category set to obtain the target page category set.
[0085] Specifically, the key page category set described in the embodiment of the present invention is a set of page categories corresponding to preset key pages, including but not limited to cover page, subject page, price page, payment page, effective terms page, signature page and other page categories.
[0086] S6. Extract fields from the target text content to obtain key contract field information.
[0087] In the embodiment of the present invention, field extraction can be performed on the target text content based on a rule matching algorithm and / or a pre-built field extraction model to obtain key contract field information.
[0088] Specifically, in the embodiment of the present invention, field extraction is performed on the target text content to obtain key contract field information, including:
[0089] Step A: segmenting the target text content to obtain a plurality of segmented words;
[0090] Step B: converting the segmented words into vectors to obtain segmented word vectors;
[0091] Step C: Use the BiLSTM model to extract features from the word vector, and use a pre-built classification function to identify and classify the extracted features to obtain entity probabilities corresponding to preset field types;
[0092] Step D: Determine the segmentation words corresponding to the segmentation word vectors whose entity probability corresponding to the preset field type is greater than the preset entity threshold as entity words of the preset field type;
[0093] Step E: Calculate the order coefficient of the entity words corresponding to each preset field type using a serialization annotation algorithm, and combine all the entity words corresponding to the preset field type according to the order coefficient to obtain an extraction field corresponding to the preset field type;
[0094] Step F: Summarize all the extracted fields to obtain the key contract field information.
[0095] Specifically, in the embodiment of the present invention, the segmentation words are converted into vectors to obtain the segmentation word vectors, including:
[0096] Convert each character in the segmented word into a character vector;
[0097] All the character vectors are combined according to the order of the corresponding characters in the segmented words to obtain the segmented word vector.
[0098] Optionally, in the embodiment of the present invention, the word segmentation words may be converted into vectors using a model or algorithm such as a word2vec model or a One-Hot algorithm. The specific method of converting into vectors is not limited in the embodiment of the present invention.
[0099] The character vector combination method in the embodiment of the present invention can be to combine by connecting the first digits together or constructing a matrix with each character vector as a column of the matrix. The embodiment of the present invention does not limit the combination method.
[0100] Specifically, in the embodiment of the present invention, a BiLSTM model is used to perform feature extraction on the word segmentation word vector to obtain a word segmentation feature vector, and the word segmentation feature vector is used as a function variable to calculate the classification function to obtain the entity probability corresponding to the preset field type.
[0101] Optionally, the classification function in the embodiment of the present invention may be a softmax function.
[0102] Furthermore, since the entity words are only isolated words, in order to correctly combine the entity words, it is also necessary to determine the order of the entity words. Therefore, the embodiment of the present invention uses the serialization annotation algorithm to calculate the order labels of all the entity words corresponding to each preset field type. Among them, the order label is an identifier that identifies the order of the entity words. The embodiment of the present invention uses the serialization annotation algorithm to calculate the order coefficient of each entity word, and combines all the entity words corresponding to the field type according to the size of the order coefficient to obtain the extraction field corresponding to the field type. For example: the preset field type is "name", and the field type corresponds to three entity words, namely "Zhang", "San", and "Someone", and the order coefficient corresponding to "Zhang" is 0.9, the order coefficient corresponding to "Someone" is 0.88, and the order coefficient corresponding to "Three" is 0.85. Then, according to the size of the order coefficient, all the entity words corresponding to the "name" field type are combined to obtain the extraction field "Zhang Mou San"; the order coefficient in the embodiment of the present invention can also be identified by text, such as: starting character, middle character, and the corresponding entity words are combined according to the order of text representation to obtain the key contract field information.
[0103] In an embodiment of the present invention, field extraction rules constructed based on regular expressions can also be used to perform field extraction on the target text content to extract extraction fields corresponding to preset field types in the target text content, and all the extraction fields are summarized to obtain the key contract field information.
[0104] Furthermore, the embodiment of the present invention performs field extraction on the target text content, and after obtaining key contract field information, compares the extracted fields corresponding to each field type in the key contract field information with the standard fields corresponding to the field type to implement the review of the contract document.
[0105] like Figure 2 The figure shows a functional module diagram of the key contract field extraction device of the present invention.
[0106] The key contract field extraction device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the key contract field extraction device can include a page parsing module 101, a page classification module 102, and a field extraction module 103. The module described in the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, and is stored in the memory of the electronic device.
[0107] In this embodiment, the functions of each module / unit are as follows:
[0108] The page parsing module 101 is used to obtain a contract document and a corresponding contract document format; select a file parsing algorithm in a preset file parsing algorithm library according to the contract document format to obtain a target file parsing algorithm; use the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document;
[0109] The page classification module 102 is used to classify each page of the contract document based on the text content using a pre-built classification model to obtain a page category of each page of the contract document;
[0110] The field extraction module 103 is used to filter the key pages in the contract document based on the page category, and determine the text content of the key page as the target text content; perform field extraction on the target text content to obtain key contract field information.
[0111] In detail, each module described in the key contract field extraction device 100 in the embodiment of the present invention adopts the same method as above when used. Figure 1 The key contract field extraction method described in the present invention is the same technical means and can produce the same technical effect, so it will not be repeated here.
[0112] like Figure 3 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing the key contract field extraction method of the present invention.
[0113] The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a key contract field extraction program.
[0114] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 may not only be used to store application software and various types of data installed in the electronic device, such as the code of the key contract field extraction program, but also be used to temporarily store data that has been output or is to be output.
[0115] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules (such as key contract field extraction programs, etc.) stored in the memory 11, and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0116] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to realize connection and communication between the memory 11 and at least one processor 10, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0117] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0118] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to various components. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include any components such as one or more DC or AC power sources, recharging devices, power failure classification circuits, power converters or inverters, power status indicators, etc. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0119] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0120] Optionally, the communication interface 13 may also include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0121] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0122] The key contract field extraction program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0123] Obtain contract documents and corresponding contract document formats;
[0124] Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm;
[0125] Using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document;
[0126] Classifying each page of the contract document using a pre-built classification model based on the text content to obtain a page category for each page of the contract document;
[0127] Filter key pages in the contract document based on the page categories, and determine the text content of the key pages as target text content;
[0128] Field extraction is performed on the target text content to obtain key contract field information.
[0129] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0130] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. The computer-readable medium can be non-volatile or volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).
[0131] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
[0132] Obtain contract documents and corresponding contract document formats;
[0133] Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm;
[0134] Using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document;
[0135] Classifying each page of the contract document using a pre-built classification model based on the text content to obtain a page category for each page of the contract document;
[0136] Filter key pages in the contract document based on the page categories, and determine the text content of the key pages as target text content;
[0137] Field extraction is performed on the target text content to obtain key contract field information.
[0138] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0139] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0140] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0141] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0142] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0143] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0144] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0145] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0146] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A method for extracting key contract fields, characterized in that: The method comprises: Obtain contract documents and corresponding contract document formats; Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm; Using the target file parsing algorithm to perform text parsing on each page of the contract document to obtain the text content of each page of the contract document; Analyze the text content of each page of the contract document using multiple classification models to obtain the initial page category of each page of the contract document corresponding to each classification model, and determine whether the type of the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page in the contract document is one; when the type of the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page in the contract document is one, determine the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page in the contract document as the page category of the page; when the type of the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page in the contract document is not one, determine the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page in the contract document as the candidate page category of the page; sort all the candidate page categories corresponding to each page in the contract document using a preset text sorting rule, and select the candidate page category ranked first as the page category of the page; Filter key pages in the contract document based on the page categories, and determine the text content of the key pages as target text content; Field extraction is performed on the target text content to obtain key contract field information.
2. The key contract field extraction method as claimed in claim 1, characterized in that: The field extraction of the target text content to obtain key contract field information includes: Segmenting the target text content to obtain a plurality of segmented words; Convert the segmented words into vectors to obtain segmented word vectors; The BiLSTM model is used to extract features from the word vector, and the extracted features are identified and classified using a pre-built classification function to obtain entity probabilities corresponding to preset field types; Determine the segmentation words corresponding to the segmentation word vectors whose entity probability corresponding to the preset field type is greater than the preset entity threshold as entity words of the preset field type; Calculate the order coefficient of the entity words corresponding to each preset field type by using a serialization annotation algorithm, and combine all the entity words corresponding to the preset field type according to the order coefficient to obtain an extraction field corresponding to the preset field type; Summarize all the extracted fields to obtain key contract field information.
3. The key contract field extraction method as claimed in claim 2, characterized in that: The step of converting the segmented words into vectors to obtain segmented word vectors includes: Convert each character in the segmented word into a character vector; All the character vectors are combined according to the order of the corresponding characters in the segmented words to obtain the segmented word vector.
4. The key contract field extraction method as claimed in claim 1, characterized in that: The method of performing text parsing on each page of the contract document using the target file parsing algorithm to obtain the text content of each page of the contract document includes: Using the target file parsing algorithm to segment each page of the contract file to obtain a contract page file; Convert the contract page file into a preset target file type to obtain a converted page file; The conversion page file is parsed using OCR recognition technology to obtain the text content.
5. The key contract field extraction method according to any one of claims 1 to 4, characterized in that: The screening of key pages in the contract document based on the page category includes: Calculate the intersection of a preset key page category set and all the page categories to obtain a target page category set; The page corresponding to each page category in the target page category set is determined as the key page.
6. A key contract field extraction device, characterized in that: include: Page parsing module, used to obtain contract documents and corresponding contract document formats; Filtering a file parsing algorithm in a preset file parsing algorithm library according to the contract file format to obtain a target file parsing algorithm; performing text parsing on each page of the contract file using the target file parsing algorithm to obtain the text content of each page of the contract file; a page classification module, for analyzing the text content of each page of the contract document using multiple classification models, obtaining the initial page category of each page of the contract document corresponding to each classification model, and determining whether the type of the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page of the contract document is one; when the type of the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page of the contract document is one, determining the initial page category with the highest frequency of occurrence among all the initial page categories corresponding to each page of the contract document as the page category of the page; When the type of the initial page category that appears most frequently among all the initial page categories corresponding to each page in the contract document is not the same, the initial page category that appears most frequently among all the initial page categories corresponding to each page in the contract document is determined as the candidate page category for the page; Sorting all the candidate page categories corresponding to each page in the contract document using a preset text sorting rule, and selecting the candidate page category ranked first as the page category of the page; A field extraction module, used for screening key pages in the contract document based on the page category, and determining the text content of the key page as the target text content; Field extraction is performed on the target text content to obtain key contract field information.
7. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively coupled to the at least one processor; The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the key contract field extraction method as described in any one of claims 1 to 5.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the key contract field extraction method as described in any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method, device and computer equipment for identifying short text category information
CN102541958A
Text structuring method aiming at power grid fault cases
CN107992597A
Universal text information extraction method and device, computer device and storage medium
CN109766540A
Automatic contract classification method and system based on artificial intelligence
CN111078871A
Key information extraction method, device and equipment and readable storage medium
CN112182141A
