A method, device, equipment and medium for identifying contract terms

By combining standard questions and contract texts using reading comprehension models, the contract clause identification results are generated, and the limitations of keyword database maintenance and entity category identification in the prior art are solved, achieving higher data identification accuracy and flexibility.

CN114625860BActive Publication Date: 2025-03-18DATAGRAND TECH INC
View PDF 1 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The prior art relies on keyword matching in the recognition of contract terms, resulting in the need to manually maintain the keyword database and the unseen entity categories cannot be identified. In addition, the entity extraction method of multi-layer attention mechanism also has similar limitations.

Method used

By obtaining contract text and standard questions, the reading comprehension model is used to combine standard questions and contract text, generate input data, and obtain answer marking positions through the completed training reading comprehension model to form standard answers, and finally generate contract terms identification results.

Benefits of technology

It reduces the demand for labeling samples, improves the accuracy of data identification in a variable contract data identification environment, avoids the limitations of keyword database maintenance and entity category identification, and can more accurately identify zero-sample data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114625860B_ABST
    Figure CN114625860B_ABST
Patent Text Reader

Abstract

The embodiments of the present invention disclose a method, device, equipment and medium for identifying contract terms. The method for identifying contract terms includes: obtaining a contract text and at least one standard question matching the contract terms to be identified; combining each standard question with the contract text to obtain multiple input data; inputting each input data into a trained reading comprehension model to obtain the answer annotation position of each standard question in the contract text; forming a standard answer corresponding to each standard question according to the annotation position of each answer, and combining each standard question with the matching standard answer to form a contract terms identification result matching the contract text. The technical solution of the embodiments of the present invention can greatly reduce the demand for annotated samples and improve the data recognition accuracy in a variable contract data recognition environment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular, to a method, device, equipment and medium for identifying contract terms. Background Art

[0002] The identification of contract terms is a technical point that is widely used in the field of data processing technology. The efficiency of identifying contract terms directly affects the data processing time.

[0003] At present, the keyword matching method is generally used to identify contract terms. However, the keyword matching method requires manual maintenance of a large keyword library and cannot identify keywords that have never appeared. When using the entity extraction method with a multi-layer attention mechanism to identify contract terms, although it no longer relies on keyword matching, it still cannot identify entities into categories that have never been seen. For example, if the training data only involves "Party A's name" and "Party B's name", the model cannot complete the correct classification when encountering "Party C's name". Summary of the invention

[0004] The embodiments of the present invention provide a method, device, equipment and medium for identifying contract terms, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment.

[0005] In a first aspect, an embodiment of the present invention provides a method for identifying contract terms, comprising:

[0006] Obtaining a contract text and at least one standard question matching the contract clause to be identified;

[0007] Combine each standard question with the contract text to obtain multiple input data;

[0008] Input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text;

[0009] According to the marked position of each answer, a standard answer corresponding to each standard question is formed, and each standard question is combined with the matching standard answer to form a contract clause recognition result that matches the contract text.

[0010] In a second aspect, an embodiment of the present invention further provides a device for identifying contract terms, including:

[0011] A first data acquisition module, used to acquire the contract text and at least one standard question matching the contract clause to be identified;

[0012] The data combination module is used to combine each standard question with the contract text to obtain multiple input data;

[0013] The second data acquisition module is used to input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text;

[0014] The data recognition module is used to form standard answers corresponding to each standard question according to the marked position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result that matches the contract text.

[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:

[0016] one or more processors;

[0017] A storage device for storing one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the method for identifying contract terms provided by any embodiment of the present invention.

[0019] In a fourth aspect, an embodiment of the present invention further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, the method for identifying contract terms provided by any embodiment of the present invention is implemented.

[0020] The technical solution of this embodiment obtains the contract text and at least one standard question matching the contract clause to be identified, thereby combining each standard question with the contract text to obtain multiple input data, and then inputting each input data into the trained reading comprehension model to obtain the answer annotation position of each standard question in the contract text, and further form standard answers corresponding to each standard question according to the annotation position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result matching the contract text. Based on the reading comprehension model, the answer annotation position of each standard question matching the contract text in the contract text can be obtained, so that each standard question can be combined with the matching standard answer to form a contract clause recognition result matching the contract text, without the need to maintain a keyword library, and can also break the limitations of entity category recognition, and more accurately recognize zero-sample data, solving the problems of keyword library maintenance and inability to recognize unseen entity categories in the prior art, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a flow chart of a method for identifying contract terms provided in the first embodiment of the present invention;

[0022] Figure 2 This is a flow chart of a method for identifying contract terms provided in Embodiment 2 of the present invention;

[0023] Figure 3 This is a flow chart of a model training of a method for identifying contract terms provided in the second embodiment of the present invention;

[0024] Figure 4 This is a data flow diagram of a reading comprehension model training process provided by Embodiment 2 of the present invention;

[0025] Figure 5 It is a schematic diagram of a device for identifying contract clauses provided in Embodiment 3 of the present invention;

[0026] Figure 6 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention.

[0028] It should also be noted that, for ease of description, only the part relevant to the present invention but not all content is shown in the accompanying drawings. It should be mentioned before discussing exemplary embodiments in more detail that some exemplary embodiments are described as processing or methods depicted as flow charts. Although the flow chart describes each operation (or step) as sequential processing, many operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. When its operation is completed, the processing can be terminated, but it can also have additional steps not included in the accompanying drawings. The processing can correspond to methods, functions, procedures, subroutines, subprograms, etc.

[0029] Embodiment 1

[0030] Figure 1 This is a flowchart of a method for identifying contract terms provided in the first embodiment of the present invention. This embodiment is applicable to the situation where the required content is accurately identified in a variable contract data identification environment. The method can be executed by a contract terms identification device, which can be implemented by software and / or hardware and can generally be integrated in an electronic device. The electronic device can be a terminal device or a server device, etc. The embodiment of the present invention does not limit the type of electronic device that executes the contract terms identification method. Accordingly, Figure 1 As shown, the method includes the following operations:

[0031] S110: Acquire the contract text and at least one standard question that matches the contract clause to be identified.

[0032] The contract text may be an agreement in text format between one or both parties to establish, change or terminate a civil relationship. Standard questions may be questions set on the content of the contract terms, used to obtain the required content in the contract terms. Exemplarily, standard questions may include but are not limited to "What is the name of Party A's company?", "What is the name of Party B's company?", "What is the delivery method?", etc. The "?" at the end of the standard question may be replaced by "XX". The embodiments of the present invention do not limit the content of the standard questions.

[0033] In the embodiment of the present invention, the contract text may be first obtained, and then the contract text may be parsed to obtain each contract clause to be identified, and then at least one standard question matching each contract clause to be identified may be determined. Optionally, a contract in a non-text format (such as a contract in a picture format) may be converted into a data format to obtain the contract text.

[0034] S120, combining each standard question with the contract text to obtain a plurality of input data.

[0035] The input data may be the result of combining each standard question with the contract text.

[0036] In an embodiment of the present invention, a standard question may be randomly selected from at least one standard question matching each contract clause to be identified and combined with the corresponding contract clause to be identified, so that each contract clause to be identified is combined with the matching standard question to obtain multiple input data.

[0037] S130, input each input data into the trained reading comprehension model respectively, and obtain the answer mark position of each standard question in the contract text.

[0038] The reading comprehension model may be a model for classifying and identifying the contents of the contract clauses according to the standard questions. The answer marking position may be the position of the answer corresponding to the standard question in the contract clauses.

[0039] In an embodiment of the present invention, after obtaining a plurality of input data, a trained reading comprehension model can be further obtained, and then each input data can be respectively input into the trained reading comprehension model, so as to determine the answer marking position of the standard question constituting each input data in the contract clause of the contract text according to the output result of the reading comprehension model. Specifically, the reading comprehension model can mark the answer to the standard question in the contract clause matching the standard question according to the standard question in the input data to obtain the answer marking position. The reading comprehension model has greater openness to the entity categories that can be recognized, and can recognize entity categories other than those used to train the reading comprehension model, that is, it does not rely on the entity categories recognized during training, thereby greatly reducing the demand for labeled samples.

[0040] S140. According to the marked positions of the answers, standard answers corresponding to the standard questions are formed, and each standard question is combined with the matching standard answer to form a contract clause recognition result that matches the contract text.

[0041] The standard answer may be information in the contract clause corresponding to the position of the answer mark. The contract clause recognition result may be a combination result of the standard question and the matching standard answer.

[0042] In an embodiment of the present invention, the contract terms that match the marked position of each answer can be determined respectively, and then the standard answers corresponding to each standard question can be obtained from the matching contract terms based on the marked position of each answer, and each standard question can be further combined with the matching standard answers to generate a contract terms recognition result that matches the contract text.

[0043] The technical solution of this embodiment obtains the contract text and at least one standard question matching the contract clause to be identified, thereby combining each standard question with the contract text to obtain multiple input data, and then inputting each input data into the trained reading comprehension model to obtain the answer annotation position of each standard question in the contract text, and further form standard answers corresponding to each standard question according to the annotation position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result matching the contract text. Based on the reading comprehension model, the answer annotation position of each standard question matching the contract text in the contract text can be obtained, so that each standard question can be combined with the matching standard answer to form a contract clause recognition result matching the contract text, without the need to maintain a keyword library, and can also break the limitations of entity category recognition, and more accurately recognize zero-sample data, solving the problems of keyword library maintenance and inability to recognize unseen entity categories in the prior art, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment.

[0044] Embodiment 2

[0045] Figure 2This is a flow chart of a method for identifying contract terms provided in Example 2 of the present invention. This embodiment is embodied on the basis of the above-mentioned embodiment. In this embodiment, a specific optional implementation method for determining a reading comprehension model before inputting each input data into the trained reading comprehension model is given. Before inputting each input data into the trained reading comprehension model, the specific process of determining the reading comprehension model is as follows: obtaining a pre-trained model, and concatenating the pre-trained model with a prompt learning model to form a model to be trained; wherein the pre-trained model is trained using a set amount of Chinese reading comprehension data; using a training sample set to train the model to be trained, and adjusting the model parameters in the prompt learning model during the training process to form a reading comprehension model. Accordingly, Figure 2 As shown, the method includes the following operations:

[0046] S210: Obtain a contract text and at least one standard question that matches the contract clause to be identified.

[0047] S220. Combine each standard question with the contract text to obtain multiple input data.

[0048] S230, obtaining a pre-trained model, and concatenating the pre-trained model with the prompt learning model to form a model to be trained.

[0049] Among them, the pre-trained model can be trained using a set amount of Chinese reading comprehension data. Exemplarily, the pre-trained model may include the roberta_wwm_ext_large model. The set amount may be a pre-set amount of Chinese reading comprehension data used to train the pre-trained model. The prompt learning model may be a model that adds prompt information to the input without changing the structure and parameters of the pre-trained model. The model to be trained may be a model to be trained obtained by splicing the pre-trained model with the prompt learning model. The training sample set may be a sample set used to train the model to be trained.

[0050] In an embodiment of the present invention, a pre-trained model trained by a set amount of Chinese reading comprehension data can be first obtained, and a prompt learning model can be created according to the model structure of the pre-trained model, and then the pre-trained model and the prompt learning model can be spliced ​​to generate a model to be trained.

[0051] S240, using the training sample set to perform model training on the to-be-trained model, and adjusting the model parameters in the prompt learning model during the training process to form a reading comprehension model.

[0052] In an embodiment of the present invention, after obtaining the model to be trained, a training sample set can be further obtained, and the training sample set can be used to perform model training on the model to be trained. During the model training process, the model parameters in the pre-trained model are frozen, and only the parameters in the prompt learning model are adjusted. When the parameters are adjusted to meet the model prediction requirements (such as the preset prediction accuracy), a reading comprehension model is generated. During the training process, only a small number of parameters need to be optimized (only the parameters in the prompt learning model need to be optimized), which makes model training more efficient and greatly reduces the demand for annotation predictions. The fusion of the pre-trained model and the prompt learning model enables the model to have both the reasoning ability of a large model and the efficient training ability of a small model. Converting the extracted questions into reading comprehension means that the model to be trained no longer relies on a fixed label system, has zero-sample reasoning ability, and is better adapted to the characteristics of rapid iteration and update of current business.

[0053] In an optional embodiment of the present invention, model training of a model to be trained using a training sample set may include: obtaining at least one training sample in sequence; performing word segmentation processing and integer format conversion on the question and text respectively to obtain integer input data corresponding to the question and text respectively; inputting each integer input data into the prompt learning model and the pre-training model in sequence to obtain output word vectors corresponding to each integer input data respectively; inputting each output word vector into the fully connected layer to obtain an answer starting position description vector and an answer ending position description vector; inputting the answer starting position description vector and the answer ending position description vector into the classification network respectively to obtain an answer starting position probability set and an answer ending position probability set; calculating a loss function corresponding to the model to be trained based on the answer starting position probability set, the answer ending position probability set and the annotation results of the question answer in the text; adjusting the model parameters in the prompt learning model based on the loss function calculation result, and returning to execute the operation of obtaining a training sample in sequence until the training end condition is met.

[0054] Among them, the training sample can be a sample in the training sample set, and the training sample can include: questions, texts, and the annotation results of the answers to the questions in the text. The annotation result can be the result of annotating the starting position and the ending position of the answer to the question in the text. Exemplarily, the starting position and the ending position of the answer to the question can be annotated in the text in the form of one-hot encoding to obtain vectors corresponding to the starting position and the ending position of the answer to the question respectively. Integer format conversion can be an operation of converting word segmentation into integers, and the integer corresponding to the word segmentation can be determined by consulting a dictionary table. Integer input data can be the result of word segmentation processing of questions and texts and integer format conversion. The output word vector can be an output vector determined based on the integer input data.

[0055] The answer starting position description vector may be a vector used to characterize the answer starting position corresponding to each output word vector. The answer ending position description vector may be a vector used to characterize the answer ending position corresponding to each output word vector. The classification network may be a network capable of outputting classification probabilities. Exemplarily, the classification network may include but is not limited to a Softmax classifier. The answer starting position probability set may be a set of probability values ​​that match the answer starting position description vector, and the elements in the answer starting position description vector have a one-to-one correspondence with the probability values ​​in the answer starting position probability set. The answer ending position probability set may be a set of probability values ​​that match the answer ending position description vector, and the elements in the answer ending position description vector have a one-to-one correspondence with the probability values ​​in the answer ending position probability set. The end training condition may be a condition for stopping the use of training samples to train the model to be trained. Exemplarily, the end training condition may include but is not limited to using all training samples in the training sample set to train the model to be trained, or the prediction accuracy of the model to be trained reaches a preset prediction accuracy, etc.

[0056] In an embodiment of the present invention, at least one training sample including a question, a text, and a result of marking the answer to the question in the text can be obtained in sequence from a training sample set, and then the question and the text are segmented according to a preset text segmentation rule, and the segmentation result is converted into an integer format to determine an integer corresponding to each segmentation in the segmentation result, that is, to obtain integer input data corresponding to the question and the text respectively. After obtaining the integer input data, each integer input data is sequentially input into the prompt learning model and the pre-training model according to the order of word segmentation in the training sample, and each output word vector corresponding to each integer input data is obtained, and then each output word vector is input into the fully connected layer (the connection layer spliced ​​after the prompt learning model), and then the answer starting position description vector and the answer ending position description vector are determined according to the output of the fully connected layer, and the answer starting position description vector and the answer ending position description vector are further input into the classification network respectively, and the answer starting position probability set matching the answer starting position description vector is calculated through the classification network, and the answer ending position probability set matching the answer ending position description vector is calculated, so as to calculate the loss function corresponding to the model to be trained according to the answer starting position probability set, the answer ending position probability set and the annotation results of the question answer in the text, and obtain the loss function calculation result, and then use the optimizer (such as Adam optimizer, etc.) to reversely deduce the loss function calculation result for the model to be trained, optimize the model parameters in the prompt learning model, and return to execute the operation of obtaining a training sample until the training end condition is met.

[0057] For example, to ensure the effectiveness of the validation set, that is, to ensure that the model that performs well in the training sample set can also perform well in the actual test, only the first 10% of the data in each type of problem can be extracted for training, and the rest of the data can be used for validation. Such a design can ensure the uniformity of the validation samples, and the distribution of the validation samples is closer to the actual situation.

[0058] Exemplarily, the probability values ​​in the probability set of the answer's starting position, the probability values ​​in the probability set of the answer's ending position, and the annotation results of the question answer in the text can be substituted into the standard formula of the existing negative log-likelihood function to obtain the loss function corresponding to the model to be trained, and the calculation result of the loss function with specific numerical values ​​​​substituted is used as the calculation result of the loss function.

[0059] In an optional embodiment of the present invention, before inputting each output word vector into the fully connected layer, it may also include: creating a fully connected layer according to the dimension of each output word vector and the labeling result of the question answer in the text.

[0060] In an embodiment of the present invention, the dimensions of each output vector can be used as the rows of the target matrix, and the number of annotations of the annotation results of the question answers in the text can be used as the columns of the target matrix to create a target matrix, and then the target matrix can be used as a fully connected layer, and the elements in the target matrix can be randomly generated.

[0061] For example, assume that an output word vector is a 1x1024 vector. In this case, the dimension of the output vector is 1024. When the beginning and end of the answer to the question are marked in the text, the number of annotations of the answer to the question in the text is 2. In this case, a 1024x2 matrix can be constructed as a fully connected layer.

[0062] In an optional embodiment of the present invention, the model parameters in the prompt learning model are adjusted according to the loss function calculation results, which may include: calculating the initial gradient and the output perturbation vector according to the loss function calculation results; calculating the adversarial gradient according to the output perturbation vector and the initial gradient; and performing adversarial training on the model to be trained according to the adversarial gradient.

[0063] The initial gradient may be the gradient obtained by back-propagating the loss function calculation result. The output perturbation vector may be a vector determined based on the initial gradient and the output word vector. The adversarial gradient may be the gradient calculated based on the loss function of the output perturbation vector and the initial gradient.

[0064] In an embodiment of the present invention, the calculation result of the loss function can be back-propagated to obtain the initial gradient, and then the matrix norm of the initial gradient can be calculated, so as to calculate the input disturbance according to the matrix norm of the initial gradient, and the input disturbance is accumulated on the output word vector to obtain the output disturbance vector, and the loss function of the output disturbance vector is calculated, and the calculation result of the loss function of the output disturbance vector is back-propagated to obtain the adversarial gradient, so as to perform adversarial training on the model to be trained according to the adversarial gradient to achieve the adjustment of the model parameters in the prompt learning model. Performing adversarial training on the model to be trained will increase the loss of the model to be trained, ensuring that the contract clause recognition result can still be accurately output while increasing the possibility of the model making an incorrect judgment, thereby improving the anti-interference and generalization of the reading comprehension model, so as to be more adaptable to situations with more interference in actual business.

[0065] S250, input each input data into the trained reading comprehension model respectively, and obtain the answer mark position of each standard question in the contract text.

[0066] In an optional embodiment of the present invention, each input data is input into a trained reading comprehension model to obtain the answer marking position of each standard question in the contract text, which may include: obtaining the target input data currently input, and inputting the target input data into the reading comprehension model; calculating the answer starting position probability set and the answer ending position probability set that match the target input data through the reading comprehension model; filtering out the probability values ​​that do not reach a preset threshold value in the answer starting position probability set and the answer ending position probability set through the reading comprehension model, respectively, to obtain the target answer starting position probability set and the target answer ending position probability set; obtaining the answer marking position of the target standard question corresponding to the target input data according to the preset answer length limit value, the target answer starting position probability set, and the target answer ending position probability set through the reading comprehension model.

[0067] Wherein, the target input data may be a piece of input data. The preset threshold value may be a pre-set probability threshold. The target answer starting position probability set may be a set of probability values ​​in the answer starting position probability set that are greater than or equal to the preset threshold value. The target answer ending position probability set may be a set of probability values ​​in the answer ending position probability set that are greater than or equal to the preset threshold value. The answer length limit value may be an integer representing the length of the answer. Exemplarily, the answer length limit value may be the number of participles of all participles included in the answer.

[0068] In an embodiment of the present invention, the target input data that needs to be input into the reading comprehension model can be determined first, and then the target input data can be input into the trained reading comprehension model, and the answer starting position probability set and the answer ending position probability set that match the target input data can be determined according to the output result of the reading comprehension model, and then the probability values ​​of the answer starting position probability set and the answer ending position probability set are respectively compared with the preset threshold threshold through the reading comprehension model, and the probability values ​​that do not reach the preset threshold threshold are filtered out, thereby obtaining the target answer starting position probability set and the target answer ending position probability set. After obtaining the target answer starting position probability set and the target answer ending position probability set, the reading comprehension model can further filter the probability values ​​in the target answer starting position probability set and the target answer ending position probability set according to the preset answer length limit value, and determine the answer marking position of the target standard question corresponding to the target input data. By filtering out the probability values ​​that do not reach the preset threshold threshold by the preset threshold threshold, the number of times the target standard question corresponding to the target input data is determined can be reduced, thereby improving data processing efficiency.

[0069] In an optional embodiment of the present invention, obtaining the answer marking position of the target standard question corresponding to the target input data through a reading comprehension model according to a preset answer length limit value, a target answer starting position probability set, and a target answer ending position probability set may include: determining at least one to-be-processed probability combination in the target answer starting position probability set and the target answer ending position probability set that meets the preset answer length limit value; determining the answer marking position of the target standard question corresponding to the target input data according to the target answer starting position probability and the target answer ending position probability that match the to-be-processed probability combination.

[0070] The probability combination to be processed may be a combination of a probability value randomly selected from the target answer starting position probability set and the target answer ending position probability set according to a preset answer length limit value. The target answer starting position probability may be a probability value in the target answer starting position probability set that constitutes the probability combination to be processed. The target answer ending position probability may be a probability value in the target answer ending position probability set that constitutes the probability combination to be processed.

[0071] In an embodiment of the present invention, the answer starting position corresponding to the probability value in the target answer starting position probability set can be selected from the target answer ending position probability set, and the answer ending position corresponding to the probability value in the target answer ending position probability set can be selected from the target answer ending position probability set, and the number of word segments corresponding to the answer starting position and the answer ending position of the two probability values ​​can be determined. When the determined number of word segments is greater than or equal to the answer length limit value, the probability value in the selected target answer starting position probability set and the probability value in the target answer ending position probability set can be combined to obtain at least one probability combination to be processed, and then the product of the target answer starting position probability and the target answer ending position probability constituting each probability combination to be processed is calculated respectively, and the position of the word segment in the target input data that matches the target answer starting position probability and the target answer ending position probability corresponding to the maximum value of the product is used as the answer marking position of the target standard question corresponding to the target input data. Determining the probability combination to be processed by the answer length limit value can effectively exclude the combination of probability values ​​that do not meet the answer length limit value, thereby improving the efficiency of determining the target standard question corresponding to the target input data while obtaining the entity that actually needs to be identified.

[0072] S260. According to the marked positions of each answer, a standard answer corresponding to each standard question is formed, and each standard question is combined with the matching standard answer to form a contract clause recognition result that matches the contract text.

[0073] Figure 3 is a flow chart of a model training of a method for identifying contract terms provided in the second embodiment of the present invention, such as Figure 3 As shown, we can first obtain the pre-trained model, further create a prompt learning model, and then obtain the labeled contract data (training samples) as the reading comprehension contract data, and then fuse the pre-trained model and the prompt learning model to obtain the model to be trained, and further use the reading comprehension contract data to conduct adversarial training on the model to be trained, and verify and screen the output results of the model to be trained that has completed the adversarial training, so as to optimize the parameters of the prompt learning model and obtain the reading comprehension model. The data flow in the training process of the reading comprehension model can be seen in Figure 4 .

[0074] The technical solution of this embodiment obtains a contract text and at least one standard question matching the contract terms to be identified, and then combines each standard question with the contract text to obtain multiple input data, thereby obtaining a pre-trained model, and splicing the pre-trained model with the prompt learning model to form a model to be trained, and further uses a training sample set to train the model to be trained, and adjusts the model parameters in the prompt learning model during the training process to form a reading comprehension model, thereby inputting each input data into the trained reading comprehension model to obtain the answer marking position of each standard question in the contract text, and then forming a standard answer corresponding to each standard question according to the answer marking position, and combining each standard question with the matching standard answer to form a contract terms recognition result matching the contract text. Based on the reading comprehension model, the answer annotation positions of each standard question matching the contract text can be obtained, so that each standard question can be combined with the matching standard answer to form a contract clause recognition result that matches the contract text. There is no need to maintain a keyword library, and it can also break the limitations of entity category recognition and more accurately identify zero-sample data. It solves the problems of keyword library maintenance and inability to identify unseen entity categories in the prior art, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment.

[0075] It should be noted that any arrangement and combination of the technical features in the above embodiments also falls within the protection scope of the present invention.

[0076] Embodiment 3

[0077] Figure 5 is a schematic diagram of a device for identifying contract clauses provided in the third embodiment of the present invention. Figure 5 As shown, the device includes: a first data acquisition module 310, a data combination module 320, a second data acquisition module 330 and a data identification module 340, wherein:

[0078] A first data acquisition module 310, configured to acquire a contract text and at least one standard question matching the contract clause to be identified;

[0079] The data combination module 320 is used to combine each standard question with the contract text to obtain a plurality of input data;

[0080] The second data acquisition module 330 is used to input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text;

[0081] The data identification module 340 is used to form standard answers corresponding to each standard question according to the marked position of each answer, and combine each standard question with the matching standard answer to form a contract clause identification result that matches the contract text.

[0082] The technical solution of this embodiment obtains the contract text and at least one standard question matching the contract clause to be identified, thereby combining each standard question with the contract text to obtain multiple input data, and then inputting each input data into the trained reading comprehension model to obtain the answer annotation position of each standard question in the contract text, and further form standard answers corresponding to each standard question according to the annotation position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result matching the contract text. Based on the reading comprehension model, the answer annotation position of each standard question matching the contract text in the contract text can be obtained, so that each standard question can be combined with the matching standard answer to form a contract clause recognition result matching the contract text, without the need to maintain a keyword library, and can also break the limitations of entity category recognition, and more accurately recognize zero-sample data, solving the problems of keyword library maintenance and inability to recognize unseen entity categories in the prior art, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment.

[0083] Optionally, the device for identifying contract terms also includes a reading comprehension model generation model, which is used to obtain a pre-trained model and splice the pre-trained model with a prompt learning model to form a model to be trained; wherein the pre-trained model is trained using a set amount of Chinese reading comprehension data; the model to be trained is trained using a training sample set, and during the training process, the model parameters in the prompt learning model are adjusted to form the reading comprehension model.

[0084] Optionally, a reading comprehension model generation model is specifically used to: obtain a training sample in sequence, wherein the training sample includes: a question, a text, and the annotation results of the answer to the question in the text; perform word segmentation processing and integer format conversion on the question and the text respectively to obtain integer input data corresponding to the question and the text respectively; input each of the integer input data into the prompt learning model and the pre-training model in sequence to obtain an output word vector corresponding to each of the integer input data; input each of the output word vectors into the fully connected layer to obtain an answer starting position description vector and an answer ending position description vector; input the answer starting position description vector and the answer ending position description vector into the classification network respectively to obtain an answer starting position probability set and an answer ending position probability set; calculate the loss function corresponding to the model to be trained based on the answer starting position probability set, the answer ending position probability set and the annotation results of the question answer in the text; adjust the model parameters in the prompt learning model based on the loss function calculation result, and return to execute the operation of obtaining a training sample in sequence until the training end condition is met.

[0085] Optionally, a reading comprehension model generation model is specifically used to: calculate an initial gradient and an output perturbation vector based on a calculation result of the loss function; calculate an adversarial gradient based on the output perturbation vector and the initial gradient; and perform adversarial training on a model to be trained based on the adversarial gradient.

[0086] Optionally, the second data acquisition module 330 is specifically used to acquire the target input data currently input, and input the target input data into the reading comprehension model; through the reading comprehension model, calculate the answer starting position probability set and the answer ending position probability set that match the target input data; through the reading comprehension model, filter out the probability values ​​that do not reach a preset threshold value in the answer starting position probability set and the answer ending position probability set, respectively, to obtain the target answer starting position probability set and the target answer ending position probability set; through the reading comprehension model, according to the preset answer length limit value, the target answer starting position probability set, and the target answer ending position probability set, obtain the answer marking position of the target standard question corresponding to the target input data.

[0087] Optionally, the second data acquisition module 330 is specifically used to determine the target answer starting position probability set, and at least one to-be-processed probability combination in the target answer ending position probability set that satisfies a preset answer length limit value; determine the answer marking position of the target standard question corresponding to the target input data based on the target answer starting position probability and the target answer ending position probability that match the to-be-processed probability combination.

[0088] Optionally, the device for identifying contract terms also includes a fully connected layer creation module, which is used to create a fully connected layer according to the dimensions of each of the output word vectors and the annotation results of the question answers in the text.

[0089] The above-mentioned contract clause recognition device can execute the contract clause recognition method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the contract clause recognition method provided by any embodiment of the present invention.

[0090] Since the contract clause identification device introduced above is a device that can execute the contract clause identification method in the embodiment of the present invention, based on the contract clause identification method introduced in the embodiment of the present invention, the technical personnel in the field can understand the specific implementation method and various variations of the contract clause identification device in this embodiment, so how the contract clause identification device implements the contract clause identification method in the embodiment of the present invention is not introduced in detail here. As long as the device used by the technical personnel in the field to implement the contract clause identification method in the embodiment of the present invention is within the scope of protection of this application.

[0091] Embodiment 4

[0092] Figure 6 A schematic diagram of the structure of an electronic device provided in Embodiment 4 of the present invention. Figure 6 A block diagram of an electronic device 412 suitable for implementing embodiments of the present invention is shown. Figure 6 The electronic device 412 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0093] like Figure 6 As shown, the electronic device 412 is in the form of a general purpose computing device. The components of the electronic device 412 may include, but are not limited to: one or more processors 416, a storage device 428, and a bus 418 connecting different system components (including the storage device 428 and the processor 416).

[0094] Bus 418 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, or a local bus using any of a variety of bus architectures. For example, these architectures include but are not limited to Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MCA) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.

[0095] The electronic device 412 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 412, including volatile and non-volatile media, removable and non-removable media.

[0096] The storage device 428 may include computer system readable media in the form of volatile memory, such as RAM (Random Access Memory) 430 and / or cache memory 432. The electronic device 412 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 434 may be used to read and write non-removable, non-volatile magnetic media ( Figure 6 not shown, usually called a "hard drive"). Although Figure 6 Not shown in the figure, a disk drive for reading and writing a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable non-volatile optical disk (e.g., a read-only optical disk (Compact Disc-Read Only Memory, CD-ROM), a digital video disk (Digital Video Disc-Read Only Memory, DVD-ROM) or other optical media) may be provided. In these cases, each drive may be connected to the bus 418 via one or more data medium interfaces. The storage device 428 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0097] A program 436 having a set (at least one) of program modules 426 may be stored, for example, in a storage device 428, such program modules 426 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination thereof may include an implementation of a network environment. Program modules 426 generally perform the functions and / or methods of the embodiments described herein.

[0098] The electronic device 412 may also communicate with one or more external devices 414 (e.g., keyboard, pointing device, camera, display 424, etc.), and may also communicate with one or more devices that enable a user to interact with the electronic device 412, and / or communicate with any device that enables the electronic device 412 to communicate with one or more other computing devices (e.g., network card, modem, etc.). Such communication may be performed through the I / O interface 422. In addition, the electronic device 412 may also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN) and / or public network, such as the Internet) through the network adapter 420. As shown, the network adapter 420 communicates with other modules of the electronic device 412 through the bus 418. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 412, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk arrays (Redundant Arrays of Independent Disks, RAID) systems, tape drives, and data backup storage systems.

[0099] The processor 416 executes various functional applications and data processing by running the program stored in the storage device 428, such as implementing the contract clause recognition method provided in the above-mentioned embodiment of the present invention, including: obtaining a contract text and at least one standard question matching the contract clause to be recognized; combining each standard question with the contract text to obtain multiple input data; inputting each input data into the trained reading comprehension model to obtain the answer marking position of each standard question in the contract text; forming a standard answer corresponding to each standard question according to the answer marking position, and combining each standard question with the matching standard answer to form a contract clause recognition result matching the contract text.

[0100] The technical solution of this embodiment obtains the contract text and at least one standard question matching the contract clause to be identified, thereby combining each standard question with the contract text to obtain multiple input data, and then inputting each input data into the trained reading comprehension model to obtain the answer annotation position of each standard question in the contract text, and further form standard answers corresponding to each standard question according to the annotation position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result matching the contract text. Based on the reading comprehension model, the answer annotation position of each standard question matching the contract text in the contract text can be obtained, so that each standard question can be combined with the matching standard answer to form a contract clause recognition result matching the contract text, without the need to maintain a keyword library, and can also break the limitations of entity category recognition, and more accurately recognize zero-sample data, solving the problems of keyword library maintenance and inability to recognize unseen entity categories in the prior art, which can greatly reduce the demand for labeled samples and improve the data recognition accuracy in a variable contract data recognition environment.

[0101] Embodiment 5

[0102] Embodiment 5 of the present invention further provides a computer storage medium storing a computer program, wherein the computer program, when executed by a computer processor, is used to execute the method for identifying contract terms described in any of the above embodiments of the present invention, including: obtaining a contract text and at least one standard question matching the contract term to be identified; combining each standard question with the contract text to obtain multiple input data; inputting each input data into a trained reading comprehension model to obtain the answer marking position of each standard question in the contract text; forming a standard answer corresponding to each standard question according to the answer marking position, and combining each standard question with the matching standard answer to form a contract term identification result that matches the contract text.

[0103] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, a device or a device or used in combination with it.

[0104] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0105] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the foregoing.

[0106] Computer program code for performing the operations of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0107] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A method for identifying contract terms, characterized in that: include: Acquire the contract text, parse the contract text to obtain each contract clause to be identified, and determine at least one standard question that matches the contract clause to be identified; Combine each standard question with the contract text to obtain multiple input data; Input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text; According to the marked position of each answer, a standard answer corresponding to each standard question is formed, and each standard question is combined with the matching standard answer to form a contract clause recognition result that matches the contract text.

2. The method according to claim 1, characterized in that Before inputting each input data into the trained reading comprehension model, it also includes: Obtain a pre-trained model, and combine the pre-trained model with a prompt learning model to form a model to be trained; wherein the pre-trained model is trained using a set amount of Chinese reading comprehension data; The model to be trained is trained using a training sample set, and during the training process, the model parameters in the prompt learning model are adjusted to form the reading comprehension model.

3. The method according to claim 2, characterized in that Using the training sample set to perform model training on the model to be trained includes: At least one training sample is obtained in sequence, wherein the training sample includes: a question, a text, and a labeling result of the answer to the question in the text; The question and the text are respectively subjected to word segmentation processing and integer format conversion to obtain integer input data corresponding to the question and the text respectively; Input each of the integer input data sequentially into the prompt learning model and the pre-training model to obtain output word vectors corresponding to each of the integer input data; Input each of the output word vectors into a fully connected layer to obtain a description vector of the starting position of the answer and a description vector of the ending position of the answer; Input the answer starting position description vector and the answer ending position description vector into the classification network respectively to obtain the answer starting position probability set and the answer ending position probability set; Calculate the loss function corresponding to the model to be trained according to the answer starting position probability set, the answer ending position probability set and the annotation results of the question answer in the text; After adjusting the model parameters in the prompt learning model according to the loss function calculation result, the operation of obtaining a training sample in sequence is returned to be executed until the training end condition is met.

4. The method according to claim 3, characterized in that The adjusting of the model parameters in the prompt learning model according to the loss function calculation result includes: Calculate the initial gradient according to the loss function calculation result, and output the disturbance vector; Calculating an adversarial gradient according to the output disturbance vector and the initial gradient; The model to be trained is subjected to adversarial training according to the adversarial gradient.

5. The method according to claim 1, characterized in that Input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text, including: Acquire currently input target input data, and input the target input data into the reading comprehension model; By using the reading comprehension model, a probability set of the starting position of an answer and a probability set of the ending position of an answer matching the target input data are calculated; By using the reading comprehension model, in the answer starting position probability set and the answer ending position probability set, probability values ​​that do not reach a preset threshold are filtered out respectively to obtain a target answer starting position probability set and a target answer ending position probability set; Through the reading comprehension model, the answer marking position of the target standard question corresponding to the target input data is obtained according to the preset answer length limit value, the target answer starting position probability set, and the target answer ending position probability set.

6. The method according to claim 5, characterized in that The answer mark position of the target standard question corresponding to the target input data is obtained by the reading comprehension model according to the preset answer length limit value, the target answer starting position probability set, and the target answer ending position probability set, including: Determine at least one to-be-processed probability combination in the target answer starting position probability set and the target answer ending position probability set that satisfies a preset answer length limit value; The answer marking position of the target standard question corresponding to the target input data is determined according to the target answer starting position probability and the target answer ending position probability that match the probability combination to be processed.

7. The method according to claim 3, characterized in that Before inputting each of the output word vectors into the fully connected layer, the method further includes: A fully connected layer is created according to the dimensions of each of the output word vectors and the labeling results of the question answer in the text.

8. A device for identifying contract clauses, characterized in that: include: A first data acquisition module is used to acquire a contract text, parse the contract text to obtain each contract clause to be identified, and respectively determine at least one standard question that matches the contract clause to be identified; The data combination module is used to combine each standard question with the contract text to obtain multiple input data; The second data acquisition module is used to input each input data into the trained reading comprehension model to obtain the answer mark position of each standard question in the contract text; The data recognition module is used to form standard answers corresponding to each standard question according to the marked position of each answer, and combine each standard question with the matching standard answer to form a contract clause recognition result that matches the contract text.

9. An electronic device, characterized in that: The electronic device comprises: one or more processors; A storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method for identifying contract terms as described in any one of claims 1-7.

10. A computer storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method for identifying contract terms as described in any one of claims 1-7 is implemented.

Citation Information

Patent Citations

  • Question and answer pair generation method and device

    CN111897934A