A multi-task based intelligent element extraction method and system

Through the intelligent element extraction method based on multi-tasking, the deep learning model is used to disassemble and annotate the paragraphs of the contract information, which solves the problem that the existing technology cannot identify the total contract amount, improves the accuracy and review efficiency of contract information extraction, and reduces human error.

CN113743114BActive Publication Date: 2024-09-20SHANGHAI OUYE FINANCIAL INFORMATION SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111023265.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-03
Publication Date
2024-09-20
Estimated Expiration
2041-09-03

AI Technical Summary

Technical Problem

Existing natural language processing technology cannot effectively identify the total amount in the contract, resulting in low efficiency and poor accuracy of manual review. Errors are prone to occur, especially when a multi-subsidiary group company needs to regularly review a large number of consulting contracts.

Method used

Using a multi-task-based intelligent element extraction method, we obtain electronic contract documents, disassemble and annotate paragraphs, and use a deep learning model to extract element information, including key information such as company name, amount, etc., and improve it through cross-validation and domain vocabulary mining. Extraction accuracy.

Benefits of technology

It improves the accuracy of extracting contract element information, assists manual verification of filled-in information, greatly reduces the probability of errors, and improves review efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113743114B
    Figure CN113743114B
Patent Text Reader

Abstract

The present invention provides a multi-task-based intelligent element extraction method and system. The present invention proposes a multi-task-based intelligent element extraction scheme. In order to extract element information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical scheme recorded in the present invention, the corresponding element extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of element extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of error.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of natural language technology, and in particular to a multi-task based intelligent element extraction method and system. Background Art

[0002] At present, some group companies and their holding subsidiaries may need to regularly report industry information contracts to their superiors every year. Before reporting the contract, the group needs to manually review whether the relevant business information in the contract is filled out correctly, and report it after confirming that there are no errors. Since some group companies hold a large number of subsidiaries, they report thousands of consulting contracts that need to be reviewed every year. If all of them are reviewed manually, the corresponding business personnel need to browse each contract to check the information, which not only greatly reduces the efficiency of the business personnel, but also inevitably avoids review errors.

[0003] However, the natural language processing technology currently used cannot be directly applied to this business scenario. For example, there are multiple amounts in the contract, and the business personnel only need to check the total amount. However, the current existing technology cannot directly distinguish which is the total amount, resulting in a decrease in recognition accuracy. Summary of the invention

[0004] In view of the above-mentioned shortcomings of the prior art, an object of the present invention is to provide a multi-task based intelligent factor extraction method and system for solving the technical problems existing in the prior art.

[0005] To achieve the above-mentioned object and other related objects, the present invention provides a multi-task based intelligent element extraction method, the method comprising the following steps:

[0006] Obtain consulting electronic contract documents to be reported;

[0007] Decompose the electronic consulting contract file into paragraphs according to the file type to be reported, and save the decomposed text content into the target file in paragraph units;

[0008] The text content stored in the target file is annotated with element extraction labels and classification labels according to paragraphs. When annotating, the first target object first annotates each paragraph with data element labels and classification labels, and then the second target object performs annotation verification and correction. After the annotation verification and correction are completed, the annotated data of the first target object is exchanged with the annotated data of the second target object, and cross-validation is performed;

[0009] The annotated data after cross-validation is input into the feature extraction model, and the feature extraction model is used to extract feature information of the consulting electronic contract documents to be reported, so as to obtain the corresponding feature information and classification labels; wherein the feature extraction model is generated based on deep learning training.

[0010] Optionally, the element extraction tag or the element information includes: enterprise name, organization name, contract name, contract amount, start time, end time, contact person, and contact number;

[0011] The classification labels are: element extraction labels, cooperation matter labels and other matter labels.

[0012] Optionally, if the file type of the consulting electronic contract file is word, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the target file in units of paragraphs includes:

[0013] Call the zipfile library to decompress the consulting electronic contract file of word type into XML format;

[0014] Get all font information in consulting electronic contract files in XML format; font information includes: font name, id, outline level and parent-child font;

[0015] Get the outline content and outline level of the consulting electronic contract document from the document.xml file;

[0016] Save the outline information to the outline_list variable in the order of document content, and save the outline information to the outline_dict variable in the format of outline content as key and outline level as value;

[0017] Traverse the document data block parsed by the python-docx library according to the outline information, and use the docx parsing library to parse the document block content to determine whether the document block content is text; if it is text, return the paragraph text of string type;

[0018] Save the text content to the content.csv file.

[0019] Optionally, if the file type of the consulting electronic contract file is pdf, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the content.csv file in units of paragraphs includes:

[0020] Use the TET toolkit to convert the consulting electronic contract file to be reported in pdf format into an xml file. The xml file contains different types of symbols and at least includes <para>identifier; where< / para> Identifier and <para>The identifier represents the paragraph text content;

[0021] According to the word.xml file <page>The identifier treats the reported consulting electronic contract files as pages; and for each page of XML information, if the beginning is matched <para> , ending with< / para> , then the middle paragraph text is completely extracted and saved in content.csv.

[0022] Optionally, the training process of the factor extraction model includes:

[0023] Obtain training data and perform word segmentation on the training data using the Jieba toolkit;

[0024] Sort the word-segmented data in order, obtain the corresponding subscript index, and save the subscript index to the word_to_index array;

[0025] The word-segmented data is converted into a corresponding index vector through word_to_index, and the index vector is truncated according to a preset fixed length;

[0026] Load word2vec word vectors and construct a word vector matrix based on the index vectors saved in word_to_index;

[0027] Acquire expert engine knowledge, and use the acquired expert engine knowledge as training data for the same transformation to construct a corresponding expert knowledge word vector matrix;

[0028] Input the training data word vector and the expert engine knowledge word vector into the pre-established factor extraction model, and encode them using the corresponding training data word vector matrix and the expert engine knowledge word vector matrix;

[0029] The encoded vector is input into the long short-term memory network, and the hidden node state of the long short-term memory network at the previous time point is used as the input of the current neural network unit. At the same time, the gating mechanism is used to select part of the hidden node state information at the previous time point to fuse the information of the current time node to obtain the hidden layer information;

[0030] The hidden layer information is input into the CRF layer, and the Viterbi encoding algorithm of the CRF is used for calculation to obtain the corresponding element label result;

[0031] The hidden layer information is input into the softmax function to obtain a matrix of the probability of the classification label, and finally the final classification label of each paragraph is obtained through the argmax function; the training of the feature extraction model is completed.

[0032] Optionally, when training the feature extraction model, the closeness of two words is determined by calculating the mutual information of two adjacent words, as follows:

[0033] Where P ab Indicates the frequency of co-occurrence of the two words ab in the text;

[0034] P a Indicates the frequency of word a in the text;

[0035] P b Indicates the frequency of word b appearing in the text.

[0036] Optionally, if the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved.

[0037] like If the value is less than a preset threshold, the two words will not be merged.

[0038] Optionally, all domain words are obtained, and all domain words are screened, new words with a length of 2 to 5 are retained, and new words with a length of 2 to 5 are added to the vocabulary of the jieba toolkit.

[0039] The present invention also provides a multi-task based intelligent element extraction system, the system comprising:

[0040] The collection module is used to obtain electronic consulting contract documents to be reported;

[0041] The paragraph decomposition module is used to decompose the paragraphs according to the file type of the consulting electronic contract file to be reported, and save the decomposed text content into the target file in units of paragraphs;

[0042] The labeling module is used to label the text content stored in the target file with element extraction labels and classification labels according to paragraphs. When labeling, the first target object first labels each paragraph with data element labels and classification labels, and then the second target object performs labeling verification and correction. After the labeling verification and correction are completed, the labeling data after the first target object is labeled is exchanged with the labeling data after the second target object is labeled, and cross-validation is performed;

[0043] The feature extraction module is used to input the annotated data after cross-validation into the feature extraction model, and use the feature extraction model to extract feature information of the consulting electronic contract documents to be reported to obtain corresponding feature information and classification labels; wherein, the feature extraction model is generated based on deep learning training.

[0044] Optionally, the element extraction tag or the element information includes: enterprise name, organization name, contract name, contract amount, start time, end time, contact person, and contact number;

[0045] The classification labels are: element extraction labels, cooperation matter labels and other matter labels.

[0046] As described above, the present invention provides a multi-task based intelligent factor extraction method and system, which has the following beneficial effects:

[0047] The present invention first obtains the consulting electronic contract file to be reported; decomposes the paragraphs according to the file type of the consulting electronic contract file to be reported, and saves the decomposed text content in the content.csv file in units of paragraphs; annotates the text content saved in the content.csv file with element extraction labels and classification labels according to the paragraphs, and when annotating, the first target object first annotates each paragraph with data element labels and classification labels, and then the second target object performs annotation verification and correction, and after the annotation verification and correction are completed, the annotated data annotated by the first target object is exchanged with the annotated data annotated by the second target object, and cross-validated; the annotated data after cross-validation is input into the element extraction model, and the element extraction model is used to extract element information of the consulting electronic contract file to be reported, and the corresponding element information and classification labels are obtained. This scheme proposes an intelligent element extraction method based on multi-tasks. In order to extract element information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical solution recorded in the present invention, the corresponding factor extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of factor extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 A flowchart of a multi-task-based intelligent factor extraction method provided by an embodiment;

[0049] Figure 2 A schematic diagram of the hardware structure of a multi-task based intelligent factor extraction system provided in one embodiment. DETAILED DESCRIPTION

[0050] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0051] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0052] See also Figure 1 As shown, the present invention provides a multi-task based intelligent element extraction method, comprising the following steps:

[0053] S100, obtaining the electronic contract documents of consulting to be reported;

[0054] S200, decomposing the consulting electronic contract file into paragraphs according to the file type of the electronic contract file to be reported, and saving the decomposed text content into a content.csv file in units of paragraphs;

[0055] S300, extracting elements and labeling classification labels for the text content stored in the content.csv file according to the paragraphs, and when labeling, firstly labeling each paragraph with data element labels and classification labels by the first target object, and then checking and correcting the labeling by the second target object, and after completing the labeling checking and correction, exchanging the labeled data after the first target object is labeled with the labeled data after the second target object is labeled, and performing cross-validation;

[0056] S400, inputting the annotated data after cross-validation into a factor extraction model, using the factor extraction model to extract factor information from the consulting electronic contract documents to be reported, and obtaining corresponding factor information and classification labels; wherein the factor extraction model is generated based on deep learning training.

[0057] It can be seen that this embodiment proposes a multi-task-based intelligent factor extraction method. In order to extract factor information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical solution recorded in this embodiment, the corresponding factor extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of factor extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of error.

[0058] In this method, the element extraction labels or element information include: company name, organization name, contract name, contract amount, start time, end time, contact person, and contact number; the classification labels are: element extraction labels, cooperation matters labels, and other matters labels.

[0059] In an exemplary embodiment, if the file type of the consulting electronic contract file is word, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the content.csv file in units of paragraphs includes:

[0060] Call the zipfile library to decompress the consulting electronic contract file of word type into XML format;

[0061] Get all font information in consulting electronic contract files in XML format; font information includes: font name, id, outline level and parent-child font;

[0062] Get the outline content and outline level of the consulting electronic contract document from the document.xml file;

[0063] Save the outline information to the outline_list variable in the order of document content, and save the outline information to the outline_dict variable in the format of outline content as key and outline level as value;

[0064] Traverse the document data block parsed by the python-docx library according to the outline information, and use the docx parsing library to parse the document block content to determine whether the document block content is text; if it is text, return the paragraph text of string type;

[0065] Save the text content to the content.csv file.

[0066] In another exemplary embodiment, if the file type of the consulting electronic contract file is pdf, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the content.csv file in units of paragraphs includes:

[0067] Use the TET toolkit to convert the consulting electronic contract file to be reported in pdf format into an xml file. The xml file contains different types of symbols and at least includes< / page> < / para> The identifier represents the table, <para> identifier; where< / para> Identifier and <para>The identifier represents the paragraph text content;

[0068] According to the word.xml file <page>The identifier treats the reported consulting electronic contract files as pages; and for each page of XML information, if the beginning is matched <para> , ending with< / para> , then the middle paragraph text is completely extracted and saved in content.csv.

[0069] In an exemplary embodiment, the training process of the factor extraction model includes:

[0070] Obtain training data and perform word segmentation on the training data using the Jieba toolkit;

[0071] Sort the word-segmented data in order, obtain the corresponding subscript index, and save the subscript index to the word_to_index array;

[0072] The word-segmented data is converted into a corresponding index vector through word_to_index, and the index vector is truncated according to a preset fixed length;

[0073] Load word2vec word vectors and construct a word vector matrix based on the index vectors saved in word_to_index;

[0074] Acquire expert engine knowledge, and use the acquired expert engine knowledge as training data for the same transformation to construct a corresponding expert knowledge word vector matrix;

[0075] Input the training data word vector and the expert engine knowledge word vector into the pre-established factor extraction model, and encode them using the corresponding training data word vector matrix and the expert engine knowledge word vector matrix;

[0076] The encoded vector is input into the long short-term memory network, and the hidden node state of the long short-term memory network at the previous time point is used as the input of the current neural network unit. At the same time, the gating mechanism is used to select part of the hidden node state information at the previous time point to fuse the information of the current time node to obtain the hidden layer information;

[0077] The hidden layer information is input into the CRF layer, and the Viterbi encoding algorithm of the CRF is used for calculation to obtain the corresponding element label result;

[0078] The hidden layer information is input into the softmax function to obtain a matrix of the probability of the classification label, and finally the final classification label of each paragraph is obtained through the argmax function; the training of the feature extraction model is completed.

[0079] When training the feature extraction model, it also includes judging the closeness of two words by calculating the mutual information of two adjacent words, which is:

[0080] Where P ab Indicates the frequency of co-occurrence of the two words ab in the text;

[0081] P a Indicates the frequency of word a in the text;

[0082] P b Indicates the frequency of word b appearing in the text.

[0083] If the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved.

[0084] like If the value is less than a preset threshold, the two words will not be merged.

[0085] Get all the domain words, filter all the domain words, retain new words with a length of 2 to 5, and add new words with a length of 2 to 5 to the word list of the jieba toolkit.

[0086] According to the above records, in a specific embodiment, a multi-task based intelligent element extraction method is provided, including:

[0087] Step 1: According to the current natural language processing technology, it is impossible to extract contract elements with high accuracy. Therefore, based on the current technology and expert business experience, using the idea of ​​multi-task learning, we proposed element extraction labels and classification labels for information contracts. The element extraction labels are: company name, organization name, contract name, contract amount, start time, end time, contact person, contact number, and the classification labels are: 1. Element extraction label, 2. Cooperation matters label, 3. Other matters label, if the extracted element label.

[0088] Step 2: The process of breaking down consulting contract documents into paragraphs: The paragraph-level granularity is the most intuitive display of text content, so the document is saved with paragraphs as the basic unit.

[0089] For the consulting electronic contract documents to be reported in the form of word files, there are:

[0090] (1-1) Call the zipfile library to decompress word into XML format.

[0091] (1-2) Read all font information in the document (font name, id, outline level, parent and child) from the parsed xml.

[0092] (1-3) Read the document outline information (outline content, outline level) from the document.xml file.

[0093] (1-4) Save the outline information in the previously declared outline_list variable in the order of document content, and save the outline information in outline_dict with outline content as key and outline level as value.

[0094] (1-5) Traverse the document data block parsed by the python-docx library according to the outline information, use the docx parsing library to parse the document block content, and determine whether it is text. If it is text, return the paragraph text of string type.

[0095] (1-6) Save the text content to the content.csv file.

[0096] For the consulting electronic contract files to be reported in PDF format, there are:

[0097] (2-1) Use the TET toolkit to convert the pdf file into an xml file. The xml file contains different types of symbols, such as:< / page> < / para> The identifier represents the table, <para>Represents the text content of a paragraph.

[0098] (2-2) Next, according to the word.xml file <page>Flag, split by page.

[0099] (2-3) For each page of XML information, if the matching starts with <para> , ending with< / para> , then the text in the middle paragraph is the content to be extracted;

[0100] (2-4) Save the completely extracted text content to content.csv.

[0101] Step 3: Split the consulting contracts of previous years according to the method of step 2 above, and then group and annotate them. Each group consists of a business expert and several business personnel, with a total of 4 groups. First, in the first round of groups, the business personnel will first label each paragraph, and the experts will be responsible for checking and correcting. In the second round, the two groups will exchange the annotated data for cross-validation. After the above annotation process, the accuracy of data element labels and classification labels reached more than 99%.

[0102] Step 4: After obtaining the data through step 3, a deep learning-based feature extraction model is used, with accuracy as the evaluation indicator, to allow the model to learn to extract features from contracts it has never seen before.

[0103] (4-1) In order to better represent paragraph information and improve accuracy, PMI is used to represent closeness, and mutual information is used to determine the closeness of two words.

[0104] Where P ab Indicates the frequency of co-occurrence of the two words ab in the text;

[0105] P a Indicates the frequency of word a in the text;

[0106] P b Indicates the frequency of word b appearing in the text.

[0107] If the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value of the word is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved. If the value is less than a preset threshold, the two words will not be merged.

[0108] (4-2) Obtain all domain words, filter all domain words, retain new words with a length of 2 to 5, and add new words with a length of 2 to 5 to the vocabulary of the jieba toolkit to prepare for the next step of training.

[0109] (4-3-1) First, use the jieba toolkit to segment the training data.

[0110] (4-3-2) Sort the segmented data in order to obtain the corresponding subscript index and save it in the word_to_index array.

[0111] (4-3-3) Convert the word segmentation data into corresponding index vectors through word_to_index and truncate them according to a fixed length.

[0112] (4-3-4) Load the downloaded word2vec word vector and build the word vector matrix according to the saved index in word_to_index.

[0113] (4-3-5) Introduce the knowledge of the expert engine and perform the same transformation on the expert knowledge through steps 1 to 3 above.

[0114] (4-3-6) Input the word vector and the knowledge of the expert engine into the model, and use the word vector matrix obtained in step 4 for encoding.

[0115] (4-3-7) The encoded vector is input into the long short-term memory network. This module will use the hidden node state at the previous time point as the input of the current neural network unit. At the same time, it will use the gating mechanism, that is, it will control the selection of part of the information of the hidden node state at the previous time point, perform information fusion of the current time node, and finally obtain the hidden layer information.

[0116] (4-3-8) Then input the hidden layer information into the CRF layer and use the CRF Viterbi coding algorithm to calculate and get the feature label result.

[0117] (4-3-9) Input the hidden layer information into the softmax function to obtain the probability matrix of the classification label. Finally, through the argmax function, the final classification label of each paragraph is obtained.

[0118] Step 5: Disassemble the information contracts to be reviewed according to step 2, extract the element information in the contract according to the model obtained in step 4 and obtain the classification label. If the classification label is "other matters", the extracted element content will not be considered to reduce the interference of unnecessary element information.

[0119] In summary, the present invention provides a multi-task based intelligent element extraction method, firstly, obtain the consulting electronic contract file to be reported; decompose the paragraphs according to the file type of the consulting electronic contract file to be reported, and save the decomposed text content in the content.csv file in units of paragraphs; annotate the text content saved in the content.csv file with element extraction labels and classification labels according to the paragraphs, and when annotating, firstly, the first target object annotates each paragraph with data element labels and classification labels, and then the second target object performs annotation verification and correction, and after the annotation verification and correction is completed, the annotated data annotated by the first target object is exchanged with the annotated data annotated by the second target object, and cross-validation is performed; the annotated data after cross-validation is input into the element extraction model, and the element extraction model is used to extract element information of the consulting electronic contract file to be reported, and the corresponding element information and classification labels are obtained. This scheme proposes an intelligent element extraction method based on multi-tasks. In order to extract element information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical solution recorded in the present invention, the corresponding factor extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of factor extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of errors.

[0120] like Figure 2 As shown, the present invention also provides a multi-task based intelligent element extraction system, comprising:

[0121] The acquisition module M10 is used to obtain the consulting electronic contract documents to be reported;

[0122] The paragraph decomposition module M20 is used to decompose the paragraphs according to the file type of the consulting electronic contract file to be reported, and save the decomposed text content in the content.csv file in units of paragraphs;

[0123] The labeling module M30 is used to label the text content stored in the content.csv file with element extraction labels and classification labels according to paragraphs. When labeling, the first target object first labels each paragraph with data element labels and classification labels, and then the second target object performs labeling verification and correction. After the labeling verification and correction are completed, the labeled data after the first target object is labeled is exchanged with the labeled data after the second target object is labeled, and cross-validation is performed;

[0124] The feature extraction module M40 is used to input the annotated data after cross-validation into the feature extraction model, and use the feature extraction model to extract feature information of the consulting electronic contract documents to be reported, and obtain the corresponding feature information and classification labels; wherein, the feature extraction model is generated based on deep learning training.

[0125] It can be seen that this embodiment proposes a multi-task-based intelligent factor extraction system. In order to extract factor information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical solution recorded in this embodiment, the corresponding factor extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of factor extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of error.

[0126] In this system, element extraction labels or element information include: company name, organization name, contract name, contract amount, start time, end time, contact person, and contact number; classification labels are: element extraction labels, cooperation matters labels, and other matters labels.

[0127] In an exemplary embodiment, if the file type of the consulting electronic contract file is word, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the content.csv file in units of paragraphs includes:

[0128] Call the zipfile library to decompress the consulting electronic contract file of word type into XML format;

[0129] Get all font information in consulting electronic contract files in XML format; font information includes: font name, id, outline level and parent-child font;

[0130] Get the outline content and outline level of the consulting electronic contract document from the document.xml file;

[0131] Save the outline information to the outline_list variable in the order of document content, and save the outline information to the outline_dict variable in the format of outline content as key and outline level as value;

[0132] Traverse the document data block parsed by the python-docx library according to the outline information, and use the docx parsing library to parse the document block content to determine whether the document block content is text; if it is text, return the paragraph text of string type;

[0133] Save the text content to the content.csv file.

[0134] In another exemplary embodiment, if the file type of the consulting electronic contract file is pdf, the process of decomposing the consulting electronic contract file to be reported into paragraphs and saving the decomposed text content into the content.csv file in units of paragraphs includes:

[0135] Use the TET toolkit to convert the consulting electronic contract file to be reported in pdf format into an xml file. The xml file contains different types of symbols and at least includes< / page> < / para> The identifier represents the table. <para> identifier; where< / para> Identifier and <para>The identifier represents the paragraph text content;

[0136] According to the word.xml file <page>The identifier treats the reported consulting electronic contract files as pages; and for each page of XML information, if the beginning is matched <para> , ending with< / para> , then the middle paragraph text is completely extracted and saved in content.csv.

[0137] In an exemplary embodiment, the training process of the factor extraction model includes:

[0138] Obtain training data and perform word segmentation on the training data using the Jieba toolkit;

[0139] Sort the word-segmented data in order, obtain the corresponding subscript index, and save the subscript index to the word_to_index array;

[0140] The word-segmented data is converted into a corresponding index vector through word_to_index, and the index vector is truncated according to a preset fixed length;

[0141] Load word2vec word vectors and construct a word vector matrix based on the index vectors saved in word_to_index;

[0142] Acquire expert engine knowledge, and use the acquired expert engine knowledge as training data for the same transformation to construct a corresponding expert knowledge word vector matrix;

[0143] Input the training data word vector and the expert engine knowledge word vector into the pre-established factor extraction model, and encode them using the corresponding training data word vector matrix and the expert engine knowledge word vector matrix;

[0144] The encoded vector is input into the long short-term memory network, and the hidden node state of the long short-term memory network at the previous time point is used as the input of the current neural network unit. At the same time, the gating mechanism is used to select part of the hidden node state information at the previous time point to fuse the information of the current time node to obtain the hidden layer information;

[0145] The hidden layer information is input into the CRF layer, and the Viterbi encoding algorithm of the CRF is used for calculation to obtain the corresponding element label result;

[0146] The hidden layer information is input into the softmax function to obtain a matrix of the probability of the classification label, and finally the final classification label of each paragraph is obtained through the argmax function; the training of the feature extraction model is completed.

[0147] When training the feature extraction model, it also includes judging the closeness of two words by calculating the mutual information of two adjacent words, which is:

[0148] Where P ab Indicates the frequency of co-occurrence of the two words ab in the text;

[0149] P a Indicates the frequency of word a in the text;

[0150] P b Indicates the frequency of word b appearing in the text.

[0151] If the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved.

[0152] like If the value is less than a preset threshold, the two words will not be merged.

[0153] Get all the domain words, filter all the domain words, retain new words with a length of 2 to 5, and add new words with a length of 2 to 5 to the word list of the jieba toolkit.

[0154] According to the above records, in a specific embodiment, a multi-task based intelligent element extraction system is provided, comprising:

[0155] Step 1: According to the current natural language processing technology, it is impossible to extract contract elements with high accuracy. Therefore, based on the current technology and expert business experience, using the idea of ​​multi-task learning, we proposed element extraction labels and classification labels for information contracts. The element extraction labels are: company name, organization name, contract name, contract amount, start time, end time, contact person, contact number, and the classification labels are: 1. Element extraction label, 2. Cooperation matters label, 3. Other matters label, if the extracted element label.

[0156] Step 2: The process of breaking down consulting contract documents into paragraphs: The paragraph-level granularity is the most intuitive display of text content, so the document is saved with paragraphs as the basic unit.

[0157] For the consulting electronic contract documents to be reported in the form of word files, there are:

[0158] (1-1) Call the zipfile library to decompress word into XML format.

[0159] (1-2) Read all font information in the document (font name, id, outline level, parent and child) from the parsed xml.

[0160] (1-3) Read the document outline information (outline content, outline level) from the document.xml file.

[0161] (1-4) Save the outline information in the previously declared outline_list variable in the order of document content, and save the outline information in outline_dict with outline content as key and outline level as value.

[0162] (1-5) Traverse the document data block parsed by the python-docx library according to the outline information, use the docx parsing library to parse the document block content, and determine whether it is text. If it is text, return the paragraph text of string type.

[0163] (1-6) Save the text content to the content.csv file.

[0164] For the consulting electronic contract files to be reported in PDF format, there are:

[0165] (2-1) Use the TET toolkit to convert the pdf file into an xml file. The xml file contains different types of symbols, such as:< / page> < / para> The identifier represents the table, <para>Represents the text content of a paragraph.

[0166] (2-2) Next, according to the word.xml file <page>Flag, split by page.

[0167] (2-3) For each page of XML information, if the matching starts with <para> , ending with< / para> , then the text in the middle paragraph is the content to be extracted;

[0168] (2-4) Save the completely extracted text content to content.csv.

[0169] Step 3: Split the consulting contracts of previous years according to the method of step 2 above, and then group and annotate them. Each group consists of a business expert and several business personnel, with a total of 4 groups. First, in the first round of groups, the business personnel will first label each paragraph, and the experts will be responsible for checking and correcting. In the second round, the two groups will exchange the annotated data for cross-validation. After the above annotation process, the accuracy of data element labels and classification labels reached more than 99%.

[0170] Step 4: After obtaining the data through step 3, a deep learning-based feature extraction model is used, with accuracy as the evaluation indicator, to allow the model to learn to extract features from contracts it has never seen before.

[0171] (4-1) In order to better represent paragraph information and improve accuracy, PMI is used to represent closeness, and mutual information is used to determine the closeness of two words.

[0172] Where P ab Indicates the frequency of co-occurrence of the two words ab in the text;

[0173] P a Indicates the frequency of word a in the text;

[0174] P b Indicates the frequency of word b appearing in the text.

[0175] If the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value of the word is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved. If the value is less than a preset threshold, the two words will not be merged.

[0176] (4-2) Obtain all domain words, filter all domain words, retain new words with a length of 2 to 5, and add new words with a length of 2 to 5 to the vocabulary of the jieba toolkit to prepare for the next step of training.

[0177] (4-3-1) First, use the jieba toolkit to segment the training data.

[0178] (4-3-2) Sort the segmented data in order to obtain the corresponding subscript index and save it in the word_to_index array.

[0179] (4-3-3) Convert the word segmentation data into corresponding index vectors through word_to_index and truncate them according to a fixed length.

[0180] (4-3-4) Load the downloaded word2vec word vector and build the word vector matrix according to the saved index in word_to_index.

[0181] (4-3-5) Introduce the knowledge of the expert engine and perform the same transformation on the expert knowledge through steps 1 to 3 above.

[0182] (4-3-6) Input the word vector and the knowledge of the expert engine into the model, and use the word vector matrix obtained in step 4 for encoding.

[0183] (4-3-7) The encoded vector is input into the long short-term memory network. This module will use the hidden node state at the previous time point as the input of the current neural network unit. At the same time, it will use the gating mechanism, that is, it will control the selection of part of the information of the hidden node state at the previous time point, perform information fusion of the current time node, and finally obtain the hidden layer information.

[0184] (4-3-8) Then input the hidden layer information into the CRF layer and use the CRF Viterbi coding algorithm to calculate and get the feature label result.

[0185] (4-3-9) Input the hidden layer information into the softmax function to obtain the probability matrix of the classification label. Finally, through the argmax function, the final classification label of each paragraph is obtained.

[0186] Step 5: Disassemble the information contracts to be reviewed according to step 2, extract the element information in the contract according to the model obtained in step 4 and obtain the classification label. If the classification label is "other matters", the extracted element content will not be considered to reduce the interference of unnecessary element information.

[0187] In summary, the present invention provides a multi-task based intelligent element extraction system, firstly, obtain the consulting electronic contract file to be reported; decompose the paragraphs according to the file type of the consulting electronic contract file to be reported, and save the decomposed text content in the content.csv file in units of paragraphs; annotate the text content saved in the content.csv file with element extraction labels and classification labels according to the paragraphs, and when annotating, firstly, the first target object annotates each paragraph with data element labels and classification labels, and then the second target object performs annotation verification and correction, and after the annotation verification and correction is completed, the annotated data annotated by the first target object is exchanged with the annotated data annotated by the second target object, and cross-validation is performed; the annotated data after cross-validation is input into the element extraction model, and the element extraction model is used to extract element information of the consulting electronic contract file to be reported, and the corresponding element information and classification labels are obtained. This scheme proposes an intelligent element extraction system based on multi-tasks. In order to extract element information with high accuracy, it innovatively proposes to add domain vocabulary mining information so that the model can learn better representation information. Through the technical solution recorded in the present invention, the corresponding factor extraction model can learn and comprehensively grasp information from multiple different aspects, improve the accuracy of factor extraction, assist in manual verification of the accuracy of reported information, and greatly reduce the probability of errors.

[0188] The above embodiments are merely illustrative of the principles and effects of the present invention, and are not intended to limit the present invention. Anyone familiar with the art may modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by a person of ordinary skill in the art without departing from the spirit and technical concept disclosed by the present invention shall still be covered by the claims of the present invention.< / page> < / para> The identifier represents the table.

Claims

1. A multi-task based intelligent factor extraction method, characterized in that: The method comprises the following steps: Obtain consulting electronic contract documents to be reported; Decompose the electronic consulting contract file into paragraphs according to the file type to be reported, and save the decomposed text content into the target file in paragraph units; The text content stored in the target file is annotated with element extraction labels and classification labels according to paragraphs. When annotating, the first target object first annotates each paragraph with data element labels and classification labels, and then the second target object performs annotation verification and correction. After the annotation verification and correction are completed, the annotated data of the first target object is exchanged with the annotated data of the second target object, and cross-validation is performed; Input the annotated data after cross-validation into the factor extraction model, and use the factor extraction model to extract factor information from the consulting electronic contract documents to be reported, and obtain corresponding factor information and classification labels; wherein the factor extraction model is generated based on deep learning training; If the file type of the consulting electronic contract file is Word, the process of breaking down the consulting electronic contract file to be reported into paragraphs and saving the broken text content into the target file in units of paragraphs includes: Call the zipfile library to decompress the consulting electronic contract file of word type into XML format; Get all font information in consulting electronic contract files in XML format; font information includes: font name, id, outline level and parent-child font; Get the outline content and outline level of the consulting electronic contract document from the document.xml file; Save the outline information to the outline_list variable in the order of document content, and save the outline information to the outline_dict variable in the format of outline content as key and outline level as value; Traverse the document data block parsed by the python-docx library according to the outline information, and use the docx parsing library to parse the document block content to determine whether the document block content is text; if it is text, return the paragraph text of string type; Save the text content to the content.csv file.

2. The multi-task based intelligent factor extraction method according to claim 1, characterized in that: The element extraction tag or the element information includes: company name, organization name, contract name, contract amount, start time, end time, contact person, and contact number; The classification labels are: element extraction labels, cooperation matter labels and other matter labels.

3. The multi-task based intelligent factor extraction method according to claim 1, characterized in that: If the file type of the consulting electronic contract file is pdf, the process of breaking down the consulting electronic contract file to be reported into paragraphs and saving the broken text content into the target file in units of paragraphs includes: Use the TET toolkit to convert the consulting electronic contract file to be reported in pdf format into an xml file. The xml file contains different types of symbols and at least includes <para> identifier; where< / para> Identifier and <para>The identifier represents the paragraph text content; According to the word.xml file <page>The identifier treats the reported consulting electronic contract files as pages; and for each page of XML information, if the beginning is matched <para> , ending with< / para> , then the middle paragraph text is completely extracted and saved in content.csv.< / page> 4. The multi-task based intelligent factor extraction method according to claim 1, characterized in that: The training process of the feature extraction model includes: Obtain training data and perform word segmentation on the training data using the Jieba toolkit; Sort the word-segmented data in order, obtain the corresponding subscript index, and save the subscript index to the word_to_index array; The word-segmented data is converted into a corresponding index vector through word_to_index, and the index vector is truncated according to a preset fixed length; Load word2vec word vectors and construct a word vector matrix based on the index vectors saved in word_to_index; Acquire expert engine knowledge, and use the acquired expert engine knowledge as training data for the same transformation to construct a corresponding expert knowledge word vector matrix; Input the training data word vector and the expert engine knowledge word vector into the pre-established factor extraction model, and encode them using the corresponding training data word vector matrix and the expert engine knowledge word vector matrix; The encoded vector is input into the long short-term memory network, and the hidden node state of the long short-term memory network at the previous time point is used as the input of the current neural network unit. At the same time, the gating mechanism is used to select part of the hidden node state information at the previous time point to fuse the information of the current time node to obtain the hidden layer information; The hidden layer information is input into the CRF layer, and the Viterbi encoding algorithm of the CRF is used for calculation to obtain the corresponding element label result; The hidden layer information is input into the softmax function to obtain a matrix of the probability of the classification label, and finally the final classification label of each paragraph is obtained through the argmax function; the training of the feature extraction model is completed.

5. The multi-task based intelligent factor extraction method according to claim 4, characterized in that: When training the feature extraction model, it also includes judging the closeness of two words by calculating the mutual information of two adjacent words, which is: Where P ab Indicates the frequency of the two words ab appearing together in the text; P a Indicates the frequency of word a in the text; P b Indicates the frequency of word b appearing in the text.

6. The multi-task based intelligent factor extraction method according to claim 5, characterized in that: If the co-occurrence frequency P of two characters in adjacent words ab is greater than a preset threshold, and If the value is greater than or equal to a preset threshold, the two words are merged, and the merged word is recorded as a domain word, and the domain word is saved; like If the value is less than a preset threshold, the two words will not be merged.

7. The multi-task based intelligent factor extraction method according to claim 6, characterized in that: Get all the domain words, filter all the domain words, retain new words with a length of 2 to 5, and add new words with a length of 2 to 5 to the word list of the jieba toolkit.

8. A multi-task based intelligent factor extraction system, characterized in that: The system comprises: The collection module is used to obtain electronic consulting contract documents to be reported; The paragraph decomposition module is used to decompose the paragraphs according to the file type of the consulting electronic contract file to be reported, and save the decomposed text content into the target file in units of paragraphs; The labeling module is used to label the text content stored in the target file with element extraction labels and classification labels according to paragraphs. When labeling, the first target object first labels each paragraph with data element labels and classification labels, and then the second target object performs labeling verification and correction. After the labeling verification and correction are completed, the labeling data after the first target object is labeled is exchanged with the labeling data after the second target object is labeled, and cross-validation is performed; The element extraction module is used to input the annotated data after cross-validation into the element extraction model, and use the element extraction model to extract element information from the consulting electronic contract documents to be reported, and obtain corresponding element information and classification labels; wherein the element extraction model is generated based on deep learning training; If the file type of the consulting electronic contract file is word, the paragraph decomposition module decomposes the reported consulting electronic contract file into paragraphs, and saves the decomposed text content into the target file in units of paragraphs, including the following process: Call the zipfile library to decompress the consulting electronic contract file of word type into XML format; Get all font information in consulting electronic contract files in XML format; font information includes: font name, id, outline level and parent-child font; Get the outline content and outline level of the consulting electronic contract document from the document.xml file; Save the outline information to the outline_list variable in the order of document content, and save the outline information to the outline_dict variable in the format of outline content as key and outline level as value; Traverse the document data block parsed by the python-docx library according to the outline information, and use the docx parsing library to parse the document block content to determine whether the document block content is text; if it is text, return the paragraph text of string type; Save the text content to the content.csv file.

9. The multi-task based intelligent element extraction system according to claim 8, characterized in that: The element extraction tag or the element information includes: company name, organization name, contract name, contract amount, start time, end time, contact person, and contact number; The classification labels are: element extraction labels, cooperation matter labels and other matter labels. < / para> The identifier represents the table,