Contract clause review method, device, computer equipment and storage medium based on clustering algorithm

The clustering algorithm is used to classify and review contract terms, which solves the problems of high labor consumption and low accuracy in the existing technology, and achieves efficient review of contract terms.

CN110502632BActive Publication Date: 2024-10-22PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910654533.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-19
Publication Date
2024-10-22
Estimated Expiration
2039-07-19

AI Technical Summary

Technical Problem

Existing contract clause review methods require a large amount of business manpower in the process of constructing training samples, and due to the subjectivity and inconsistent granularity of sample annotation, the amount of calculation increases, similarity matching errors occur, and the accuracy is low.

Method used

A method based on clustering algorithm is used to obtain the training contract text from the preset database, split paragraphs according to the title-level format, perform feature engineering and convert them into sentence vectors, use the clustering algorithm to divide contract types to establish a clause library, and judge the contract text to be reviewed The type is calculated and the similarity is calculated. If the similarity is lower than the threshold, it is determined to be missing.

Benefits of technology

The clustering algorithm is used to ensure consistent granularity of contract terms, improve review accuracy, save human resources, and reduce similarity matching errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110502632B_ABST
    Figure CN110502632B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a contract clause review method, device, computer equipment and storage medium based on a clustering algorithm. The method comprises: splitting a training contract text into contract clauses according to a title-level format, clustering the contract clauses using a clustering algorithm to divide the contract clauses into multiple contract types and establishing a clause library according to the divided contract types; when receiving a contract text to be reviewed, first determine the contract type of the contract text to be reviewed, then obtain the contract clauses of the corresponding contract type from the clause library according to the contract type of the contract text to be reviewed and calculate the similarity with the contract clauses to be reviewed in the contract to be reviewed, and if the similarity is lower than a preset threshold, determine that the contract clauses of the contract text to be reviewed are missing. The method of the present invention is based on artificial intelligence technology, and by implementing the method of the embodiment of the present invention, the same granularity can be ensured, the review accuracy can be improved, and human resources can be saved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a contract clause review method, device, computer equipment and storage medium based on a clustering algorithm. Background Art

[0002] At present, in the field of contract clause review, the review of the missing essential clauses of the contract is the most basic part of traditional legal review. With the progress and development of the law, the clauses are of various types and large in number. The review of contract clauses will consume huge manpower. Therefore, it has become a general trend to use machines to handle such complicated and mechanical problems. The commonly used processing logic of the currently commonly used AI contract review model is: a large number of manual annotations are performed on the risk clauses in different types of contracts, and then the contract content is matched similarly based on the annotated clause samples, and then the missing is prompted. However, the existing contract clause review method has the following shortcomings: First, a large amount of business manpower is required in the construction of training samples. Different types of contracts require lawyers familiar with different fields to annotate. Moreover, as time goes by, new contract templates continue to appear. It is unrealistic for business personnel to continue to follow up. Second, since the sample annotation is performed by business personnel, the model cannot ensure that the logic of contract paragraph splitting can ensure that the split paragraphs have the same granularity as the annotated samples, resulting in a larger amount of calculation and similarity matching errors caused by different granularities. Third, sample annotation by business personnel is highly subjective, and the granularity of samples marked by different business personnel is not uniform, and the accuracy rate is low. Summary of the invention

[0003] The embodiments of the present invention provide a contract clause review method, apparatus, computer equipment and storage medium based on a clustering algorithm, aiming to solve the problems of increased model calculation amount, similarity matching errors and low accuracy caused by different sample annotation granularity.

[0004] In a first aspect, an embodiment of the present invention provides a contract clause review method based on a clustering algorithm, comprising: obtaining training contract texts from a preset database and performing paragraph splitting on all the training contract texts according to a title-level format to obtain contract clauses; performing feature engineering on the contract clauses to convert the contract clauses into sentence vectors; clustering the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types; if a contract text to be reviewed is received, determining the contract type of the contract text to be reviewed and performing paragraph splitting on the contract text to be reviewed according to a title-level format to obtain contract clauses to be reviewed; obtaining contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and calculating the similarity between the obtained contract clauses and the contract clauses to be reviewed; if the similarity between the obtained contract clauses and the contract clauses to be reviewed is lower than a preset threshold, determining that the contract clauses in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing.

[0005] In a second aspect, an embodiment of the present invention further provides a contract clause review device based on a clustering algorithm, which includes: an acquisition unit, used to acquire training contract texts from a preset database and perform paragraph splitting on all the training contract texts according to a title-level format to obtain contract clauses; a feature unit, used to perform feature engineering on the contract clauses to convert the contract clauses into sentence vectors; a clustering unit, used to cluster the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establish a clause library according to the divided contract types; a judgment unit, used to determine the contract type of the contract text to be reviewed if a contract text to be reviewed is received and perform paragraph splitting on the contract text to be reviewed according to a title-level format to obtain the contract clauses to be reviewed; a calculation unit, used to acquire the contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and perform similarity calculation on the acquired contract clauses and the contract clauses to be reviewed; a judgment unit, used to determine that the contract clauses in the contract text to be reviewed are missing and generate a missing prompt message to prompt the missing if the similarity between the acquired contract clauses and the contract clauses to be reviewed is lower than a preset threshold.

[0006] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0007] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions can implement the above method when executed by a processor.

[0008] The embodiment of the present invention provides a contract clause review method, device, computer equipment and storage medium based on a clustering algorithm. The method includes: obtaining training contract texts from a preset database and performing paragraph splitting on all the training contract texts according to the title level format to obtain contract clauses; performing feature engineering on the contract clauses to convert the contract clauses into sentence vectors; clustering the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types; if a contract text to be reviewed is received, determining the contract type of the contract text to be reviewed and performing paragraph splitting on the contract text to be reviewed according to the title level format to obtain the contract clauses to be reviewed; obtaining the contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and calculating the similarity between the obtained contract clauses and the contract clauses to be reviewed; if the similarity between the obtained contract clauses and the contract clauses to be reviewed is lower than a preset threshold, determining that the contract clauses in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing. The embodiment of the present invention splits the training contract text into contract clauses according to the title level format, clusters the contract clauses using a clustering algorithm to divide the contract clauses into multiple contract types and establishes a clause library according to the divided contract types; when the contract text to be reviewed is received, the contract type of the contract text to be reviewed is first determined, and then the contract clauses of the corresponding contract type are obtained from the clause library according to the contract type of the contract text to be reviewed, and the similarity is calculated with the contract clauses to be reviewed in the contract to be reviewed. If the similarity is lower than a preset threshold, the contract clauses of the contract text to be reviewed are determined to be missing, which can ensure the same granularity, improve the review accuracy, and save human resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0010] Figure 1 A schematic diagram of a flow chart of a contract clause review method based on a clustering algorithm provided in an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a sub-process of a contract clause review method based on a clustering algorithm provided in an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a sub-process of a contract clause review method based on a clustering algorithm provided in an embodiment of the present invention;

[0013] Figure 4 A schematic diagram of a sub-process of a contract clause review method based on a clustering algorithm provided in an embodiment of the present invention;

[0014] Figure 5 A schematic diagram of a flow chart of a contract clause review method based on a clustering algorithm provided in another embodiment of the present invention;

[0015] Figure 6 A schematic block diagram of a contract clause review device based on a clustering algorithm provided by an embodiment of the present invention;

[0016] Figure 7 A schematic block diagram of specific units of a contract clause review device based on a clustering algorithm provided in an embodiment of the present invention;

[0017] Figure 8 A schematic block diagram of a judgment unit of a contract clause review device based on a clustering algorithm provided in an embodiment of the present invention

[0018] Fig. 9 A schematic block diagram of a contract clause review device based on a clustering algorithm provided by another embodiment of the present invention; and

[0019] Fig.10 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0022] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0023] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0024] See also Figure 1 , Figure 1 A schematic flow chart of a method for reviewing contract terms based on a clustering algorithm provided in an embodiment of the present invention. The method for reviewing contract terms based on a clustering algorithm is applied in a terminal.

[0025] Figure 2 The flowchart of the method for reviewing contract terms based on clustering algorithm provided by the embodiment of the present invention is shown in the figure. As shown in the figure, the method includes the following steps S110-S150.

[0026] S110, obtaining training contract texts from a preset database and performing paragraph splitting on all the training contract texts according to the title level format to obtain contract terms.

[0027] In one embodiment, the preset database is a database for storing legal contract texts, and the title level format refers to multiple title styles of the text, for example, the first-level title level format "Chapter 1", "1., 2., 3.", the second-level title level format "(I)", "1.1, 2.1, 3.1", etc. Specifically, firstly, the legal contract text is obtained from a preset database, and the obtained legal contract text is used as the training contract text, for example, 100,000 training contract texts are obtained; then, after obtaining the training contract text, the training contract text is preprocessed, and the preprocessing is mainly carried out by calling an office software tool to convert a dox format file into a docx format file, and by calling a VB (Visual Basic) macro code to convert the title level format of the training contract text into text, so as to accurately identify the title level format of the training contract text; then, all possible title level formats of the training contract text are exhaustively enumerated to identify the title level formats of each level of the training contract text; finally, the training contract text is segmented into paragraphs according to the title level formats of each level, and the paragraphs of the first-level title level and the second-level title level are retained, that is, the training contract text is segmented into the first-level and second-level granularities, and the paragraphs under each level of title represent the contract terms, thereby obtaining the contract terms.

[0028] S120: Perform feature engineering on the contract terms to convert the contract terms into sentence vectors.

[0029] In one embodiment, feature engineering refers to the process of transforming raw data into training data for a model, that is, converting contract terms in text form into sentence vectors that can be input into the model. Specifically, first, a tokenization tool is used to tokenize the contract terms to obtain multiple phrases, then a word vector tool is used to convert the phrases into word vectors, and finally, all the word vectors are weighted and averaged to obtain the sentence vector corresponding to the contract term.

[0030] In one embodiment, as Figure 2 shown, step S120 may include steps S121 - S123.

[0031] S121. Tokenize the contract terms using a tokenization tool and assign weights to the tokenized phrases.

[0032] In one embodiment, tokenization refers to the process of recombining a continuous sequence of characters into a sequence of words according to certain specifications, that is, splitting a sequence of Chinese characters into individual words one by one. The tokenization tool uses jieba. Before tokenization, punctuation marks such as ",", "." are first removed from the contract terms, and stop words such as "zhe", "he" are removed, while legal terms such as "shall not", "except" are retained, and then jieba is used for tokenization to obtain multiple phrases. For example, for the sentence "In the process of performing the contract, if a party breaches the contract due to the reasons of a third party, it shall bear the liability for breach of contract to the other party", after tokenization, we get "perform / contract / process / in / one / party / party / due to / third party / reason / cause / breach of contract / , shall / to / the other party / bear / liability for breach of contract". After tokenization, weights also need to be assigned to the tokenized phrases. The assignment of weights is mainly based on the keywords in the contract terms. The more the keyword matches the legal term, the higher the weight. The keywords and weights of each contract term have been preset in advance, and the corresponding weights can be obtained by matching the keywords of the tokenized phrases. For example, keywords such as "confidentiality", "confidential", "obligation", and "performance" have higher weights, while keywords such as "process", "reason", and "termination" have lower weights.

[0033] S122. Convert the tokenized phrases into word vectors using a word vector tool.

[0034] In one embodiment, the word vector tool is a natural language processing tool, and its function is to convert words in natural language into word vectors that can be understood by computers. This solution uses the word vector tool Word2vec to obtain word vectors. Word2Vec mainly uses Skip-Gram and CBOW models to achieve word vector conversion. This solution uses the Skip-Gram model to achieve word vector conversion. The Skip-Gram model mainly predicts context words through central words. The Skip-Gram model has been pre-trained. The Skip-Gram model includes an input layer, a hidden layer, and an output layer. The mapping from the input layer to the hidden layer does not use an activation function, and the hidden layer to the output layer uses a Huffman tree for optimization. The phrases of the contract terms are input into the word vector tool and converted into word vectors through the word vector tool.

[0035] S123. Perform weighted averaging on the word vectors according to the assigned weights to obtain a sentence vector for the contract clause.

[0036] In one embodiment, the split contract terms are regarded as sentences. After the word vectors of the contract terms are obtained, the sentence vectors of the contract terms are obtained based on the word vectors of the contract terms. Specifically, the weight assigned to each word after word segmentation is used as the weight of its corresponding word vector, and the word vectors of the contract terms are weighted averaged to obtain the sentence vectors of the contract terms. For example, the word vectors of the contract terms are a, b, c, d, and the weights of the corresponding phrases are 0.8, 0.95, 0.1, and 0.2, then the sentence vector x of the contract terms is x=0.8a+0.95b+0.1c+0.2d.

[0037] S130. Clustering the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types.

[0038] In one embodiment, the k-means algorithm is a clustering algorithm. The so-called clustering is to divide data objects with high similarity into the same cluster and data objects with high dissimilarity into different clusters according to the principle of similarity. Specifically, the k-means algorithm first randomly selects K objects (sentence vectors) as the initial cluster centers (initialized centroids), then calculates the distance between each object and each seed cluster center, and assigns each object to the cluster center closest to it; the cluster centers and the objects assigned to them represent a cluster, and each time a sample is assigned, the cluster center of the cluster will be recalculated according to the existing objects in the cluster; this process will be repeated until a certain termination condition is met, such as the local minimum of the sum of squared errors, so that the objects are divided into different clusters. Since the position selection of the k initialized centroids has a great influence on the final clustering results and running time, if it is only a completely random selection, it may cause the algorithm to converge very slowly. Therefore, in order to select appropriate k centroids, this solution adopts the K-Means++ algorithm, which is an optimization of the K-Means random initialization centroid method. Specifically, randomly select one from all sentence vectors as the cluster center, calculate the distance from each sentence vector to the initial centroid, select the nearest sentence vector as the next cluster center, repeat the above process until K cluster centers are selected, and run the traditional k-means algorithm based on the selected K cluster centers. Among them, K is the contract type. The contract types of this scheme include nine categories: procurement, leasing, financing, guarantee, financial leasing, asset management, asset management (trust), agency sales, and equity. The object is the sentence vector of the contract terms, so the K value is 9. Finally, nine contract terms sets are obtained. The contract terms sets are identified according to the preset contract types. The contract type represents the set of corresponding contract terms. Each contract type represents a contract terms set, and each contract type contains multiple contract terms of the same type. A terms library is established according to the divided contract types, and the contract terms of the same contract type are stored in the same storage address.

[0039] In this embodiment, each contract type can also be divided into a general terms library and a specific risk terms library, and the general terms of the same contract type are stored in the general terms library of the contract type, and the specific risk terms of the same contract type are stored in the specific risk terms library of the contract type. For example, in a procurement contract, 18 general terms (procurement subject, fee payment, dispute resolution terms, confidentiality terms, breach of contract terms, etc.) are established, and specific risk terms in individual procurement sub-contracts, such as preventive measures in termite prevention contracts.

[0040] S140: If a contract text to be reviewed is received, determine the contract type of the contract text to be reviewed and divide the contract text to be reviewed into paragraphs according to the title level format to obtain the contract terms to be reviewed.

[0041] In this embodiment, the contract text to be reviewed is a legal contract that needs to be reviewed to see if the essential clauses are missing. After receiving the contract text to be reviewed, the contract type of the contract to be reviewed is first determined. Two methods can be used for determination. One is to obtain the contract type of the contract text to be reviewed by matching the title of the contract text to be reviewed with a regular expression, and the other is to obtain the contract type of the contract text to be reviewed by obtaining the keywords of the contract text to be reviewed using the TF-IDF algorithm. In addition, it is also necessary to split the contract to be reviewed into paragraphs, and split the contract text to be reviewed into paragraphs according to the same title-level format as the split training contract text to obtain the clauses to be reviewed of the contract text to be reviewed. The same title-level format is used for splitting, that is, the same granularity is used for splitting the contract text to be reviewed, which ensures that the granularity of the contract clauses in the clause library is consistent with that of the contract clauses to be reviewed, so as to overcome the problem of increased calculation amount and similarity matching error caused by different granularities.

[0042] In one embodiment, if Figure 3 As shown, the step S140 may include steps S141-S142.

[0043] S141. Obtain the title of the contract text to be reviewed through a regular expression.

[0044] S142. Match the title of the contract text to be reviewed with the contract type to obtain the contract type of the contract text to be reviewed.

[0045] In one embodiment, a regular expression is a logic formula for string operation, and a rule string is formed by pre-defined specific characters and combinations of these specific characters. This rule string is used to express a filtering logic for the string. The contract type is used as a pre-set rule string, for example, a purchase contract, a lease contract, and a financing contract, and then the title of the contract to be reviewed is located, and the pre-set rule string is matched with the title of the contract to be reviewed. If the match is successful, the rule string is used as the contract type of the contract text to be reviewed.

[0046] In another embodiment, if Figure 4 As shown, the step S140 may include steps S143-S145.

[0047] S143. Calculate the TF-IDF values ​​of all phrases in the contract to be reviewed using the TF-IDF algorithm.

[0048] S144. Sort all the phrases according to their TF-IDF values ​​from high to low.

[0049] S145. Select keywords according to the ranking and match them with the contract type to obtain the contract type of the contract text to be reviewed.

[0050] In one embodiment, TF-IDF (term frequency-inverse document frequency) is a statistical method for evaluating the importance of a word to a document set or a document in a corpus. TF is term frequency, which indicates the frequency of a phrase in a text, and IDF is inverse document frequency, which is a measure of the general importance of a word. Specifically, firstly, the contract text to be reviewed is segmented according to the word segmentation tool to obtain multiple phrases, and the TF value and IDF value are calculated for each phrase in the contract text to be reviewed, the TF value is equal to the number of times the phrase appears in the text divided by the total number of words in the text, and the IDF value is equal to the logarithm of the total number of texts divided by the number of texts containing the phrase; then the TF value is multiplied by the IDF value to obtain the TF-IDF value, and the phrases are sorted from high to low according to the TF-IDF value corresponding to each phrase; finally, according to the sorting result, the highest-ranked keyword is selected to match the divided contract type. If the keyword matches the contract type, the matched contract type is used as the contract type of the contract to be reviewed. If the keyword does not match the contract type, the second highest-ranked keyword is continued to be selected to match the divided contract type, so as to obtain the contract type of the contract to be reviewed.

[0051] S150: Acquire contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and calculate similarity between the acquired contract clauses and the contract clauses to be reviewed.

[0052] In one embodiment, after determining the contract type of the contract text to be reviewed, first obtain the contract terms of the corresponding contract type from the clause library (general clause library and specific risk clause library) according to the contract type of the contract text to be reviewed, and then perform similarity calculations one by one between the contract terms to be reviewed of the contract text to be reviewed and the contract terms obtained from the clause library. Specifically, firstly, feature engineering is performed on the contract clauses to be reviewed to convert them into sentence vectors. This process is the same as the feature engineering process and will not be repeated here. Then, the cosine distance between the sentence vector of the contract clause to be reviewed and the sentence vector of the contract clause in the clause library is calculated. The cosine distance uses the cosine value of the angle between two vectors in the vector space as a measure of the size of the difference between two individuals. The cosine distance represents the similarity between the contract clause to be reviewed and the contract clause in the clause library. The closer the cosine value is to 1, the higher the similarity is, and the smaller the cosine value is, the lower the similarity is. The similarity of each contract clause to be reviewed is calculated one by one with the contract clauses in the clause library, and the cosine value with the highest similarity is taken as the similarity between the contract clause to be reviewed and the contract clause taken out from the clause library.

[0053] S160: If the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold, the contract clause in the contract text to be reviewed is determined to be missing and a missing prompt message is generated to prompt the missing.

[0054] In one embodiment, the similarity of the contract clauses to be reviewed is compared with a preset threshold. If the similarity of the contract clauses to be reviewed is higher than the preset threshold, it means that the necessary contract clauses exist in the contract text to be reviewed; if the similarity of the contract clauses to be reviewed is lower than the preset threshold, it means that the necessary contract clauses do not exist in the contract text to be reviewed, and the contract clauses of the contract text to be reviewed are determined to be missing. The preset threshold is a pre-set similarity threshold, and each contract clause is set with a preset threshold. For example, if the similarity of the contract clauses to be reviewed is 0.8, and the corresponding preset threshold is 0.6, it means that there are necessary clauses in the contract to be reviewed, and the contract clauses to be reviewed have passed the review. At the same time, a missing prompt message is generated according to the contract number of the contract text to be reviewed, and is sent to a preset email address in the form of an email, which is the email address of the reviewer, so as to prompt the reviewer that the contract text to be reviewed lacks contract clauses.

[0055] In one embodiment, if Figure 5 As shown, after step S160, step S170 is also included.

[0056] S170. Extract the main information of the contract text to be reviewed according to a regular expression.

[0057] In one embodiment, the subject information refers to the name of the company or the company's unified credit code. The characters commonly used in contracts to extract the company's subject information are preset as regular character strings. For example, in a procurement contract, "Party A:", "Party B:", "Third Party:", in a lease contract, "Lessee:", "Lessor:", etc. Then, the contract text to be reviewed is traversed according to the regular character string to extract the text content that matches the regular character string, i.e., the subject information. After obtaining the subject information, the enterprise portrait API interface can be connected to query whether the parties to the contract have related transactions and black and gray lists to ensure the transaction interests of the parties to the contract.

[0058] The embodiment of the present invention demonstrates a contract clause review method based on a clustering algorithm, which obtains training contract texts from a preset database and performs paragraph splitting on all the training contract texts according to the title-level format to obtain contract clauses; performs feature engineering on the contract clauses to convert the contract clauses into sentence vectors; clusters the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishes a clause library based on the divided contract types; if a contract text to be reviewed is received, determines the contract type of the contract text to be reviewed and performs paragraph splitting on the contract text to be reviewed according to the title-level format to obtain a contract text to be reviewed. Contract terms; obtaining contract terms corresponding to the contract type of the contract text to be reviewed from the term library, and calculating the similarity between the obtained contract terms and the contract terms to be reviewed; if the similarity between the obtained contract terms and the contract terms to be reviewed is lower than a preset threshold, determining that the contract terms in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing, which can ensure that the granularity of the contract terms to be reviewed is the same as the granularity of the terms in the term library used to calculate the similarity, thereby avoiding information loss caused by different granularities; establishing a term library through a clustering algorithm to save human resources; avoiding repeated calculation of the same general terms in different sub-categories of contracts.

[0059] Figure 6 FIG. 2 is a schematic block diagram of a contract clause review device 200 based on a clustering algorithm provided by an embodiment of the present invention. Figure 6 As shown, corresponding to the above-mentioned contract clause review method based on clustering algorithm, the present invention also provides a contract clause review device 200 based on clustering algorithm. The contract clause review device 200 based on clustering algorithm includes a unit for executing the above-mentioned contract clause review method based on clustering algorithm, and the device can be configured in a desktop computer, tablet computer, laptop computer, etc. For details, please refer to Figure 6 The contract clause review device based on clustering algorithm includes: an acquisition unit 210, a feature unit 220, a clustering unit 230, a judgment unit 240, a calculation unit 250 and a determination unit 260.

[0060] The acquisition unit 210 is used to acquire the training contract text from a preset database and perform paragraph splitting on all the training contract texts according to the title level format to obtain contract terms.

[0061] In one embodiment, the preset database is a database for storing legal contract texts, and the title level format refers to multiple title styles of the text, for example, the first-level title level format "Chapter 1", "1., 2., 3.", the second-level title level format "(I)", "1.1, 2.1, 3.1", etc. Specifically, firstly, the legal contract text is obtained from a preset database, and the obtained legal contract text is used as the training contract text, for example, 100,000 training contract texts are obtained; then, after obtaining the training contract text, the training contract text is preprocessed, and the preprocessing is mainly carried out by calling an office software tool to convert a dox format file into a docx format file, and by calling a VB (Visual Basic) macro code to convert the title level format of the training contract text into text, so as to accurately identify the title level format of the training contract text; then, all possible title level formats of the training contract text are exhaustively enumerated to identify the title level formats of each level of the training contract text; finally, the training contract text is segmented into paragraphs according to the title level formats of each level, and the paragraphs of the first-level title level and the second-level title level are retained, that is, the training contract text is segmented into the first-level and second-level granularities, and the paragraphs under each level of title represent the contract terms, thereby obtaining the contract terms.

[0062] The feature unit 220 is used to perform feature engineering on the contract terms to convert the contract terms into sentence vectors.

[0063] In one embodiment, feature engineering refers to the process of converting raw data into training data for the model, that is, converting the textual contract terms into sentence vectors that can be input into the model. Specifically, the contract terms are first segmented by a word segmentation tool to obtain multiple phrases, and then the phrases are converted into word vectors by a word vector tool, and finally all the word vectors are weighted averaged to obtain the sentence vector corresponding to the contract terms.

[0064] In one embodiment, if Figure 7 As shown, the feature unit 220 includes: a word segmentation unit 221, a conversion unit 222 and a weighted average unit 223.

[0065] The word segmentation unit 221 is used to segment the contract terms by using a word segmentation tool and assign weights to the segmented phrases.

[0066] In one embodiment, word segmentation refers to the process of recombining a continuous sequence of Chinese characters into a sequence of words according to certain norms, that is, splitting a sequence of Chinese characters into individual words one by one. The word segmentation tool uses Jieba. Before word segmentation, punctuation marks such as ",", "。" are first removed from the contract terms, and stop words such as "着", "和" are removed, while legal-specific words such as "不得", "除" are retained. Then, word segmentation is performed through Jieba to obtain multiple word groups. For example, for the sentence "在履行合同过程中,一方当事人因第三人的原因造成违约的,应当向对方当事人承担违约责任", after word segmentation, we get "履行 / 合同 / 过程 / 中 / 一方 / 当事人 / 因 / 第三人 / 原因 / 造成 / 违约 / ,应当 / 向 / 对方当事人 / 承担 / 违约责任". After word segmentation, weights also need to be assigned to the segmented word groups. The assignment of weights is mainly based on the keywords in the contract terms. The more the keywords match legal terms, the higher the weight. The keywords and weights of each contract term have been preset in advance. By matching the keywords of the segmented word groups, the corresponding weights can be obtained. For example, words such as "保密", "机密", "义务", and "履行" have relatively high weights, while words such as "过程", "原因", and "终止" have relatively low weights.

[0067] The conversion unit 222 is configured to convert the segmented word groups into word vectors through a word vector tool.

[0068] In one embodiment, the word vector tool is a natural language processing tool whose function is to convert words in natural language into word vectors that can be understood by a computer. In this solution, the Word2vec word vector tool is used to obtain word vectors. Word2Vec mainly uses two models, Skip-Gram and CBOW, to implement the conversion of word vectors. In this solution, the Skip-Gram model is used to implement the conversion of word vectors. The Skip-Gram model mainly predicts the context words through the central word. The Skip-Gram model has been pre-trained. The Skip-Gram model includes an input layer, a hidden layer, and an output layer. No activation function is used for the mapping from the input layer to the hidden layer, while the hidden layer to the output layer is optimized using a Huffman tree. The word groups of the contract terms are input into the word vector tool and converted into word vectors through the word vector tool.

[0069] The weighted average unit 223 is configured to perform a weighted average on the word vectors according to the assigned weights to obtain the sentence vector of the contract term.

[0070] In one embodiment, the split contract terms are regarded as sentences. After the word vectors of the contract terms are obtained, the sentence vectors of the contract terms are obtained based on the word vectors of the contract terms. Specifically, the weight assigned to each word after word segmentation is used as the weight of its corresponding word vector, and the word vectors of the contract terms are weighted averaged to obtain the sentence vectors of the contract terms. For example, the word vectors of the contract terms are a, b, c, d, and the weights of the corresponding phrases are 0.8, 0.95, 0.1, and 0.2, then the sentence vector x of the contract terms is x=0.8a+0.95b+0.1c+0.2d.

[0071] The clustering unit 230 is used to cluster the sentence vectors using a clustering algorithm to divide the contract terms corresponding to the sentence vectors into multiple contract types, and establish a term library according to the divided contract types.

[0072] In one embodiment, the k-means algorithm is a clustering algorithm. The so-called clustering is to divide data objects with high similarity into the same cluster and data objects with high dissimilarity into different clusters according to the principle of similarity. Specifically, the k-means algorithm first randomly selects K objects (sentence vectors) as the initial cluster centers (initialized centroids), then calculates the distance between each object and each seed cluster center, and assigns each object to the cluster center closest to it; the cluster center and the objects assigned to them represent a cluster, and each time a sample is assigned, the cluster center of the cluster will be recalculated according to the existing objects in the cluster; this process will be repeated until a certain termination condition is met, such as the local minimum of the sum of squared errors, so that the objects are divided into different clusters. Since the position selection of the k initialized centroids has a great influence on the final clustering results and running time, if it is only a completely random selection, it may cause the algorithm to converge very slowly. Therefore, in order to select appropriate k centroids, this solution adopts the K-Means++ algorithm, which is an optimization of the K-Means random initialization centroid method. Specifically, randomly select one from all sentence vectors as the cluster center, calculate the distance from each sentence vector to the initial centroid, select the nearest sentence vector as the next cluster center, repeat the above process until K cluster centers are selected, and run the traditional k-means algorithm based on the selected K cluster centers. Among them, K is the contract type. The contract types of this scheme include nine categories: procurement, leasing, financing, guarantee, financial leasing, asset management, asset management (trust), agency sales, and equity. The object is the sentence vector of the contract terms, so the K value is 9. Finally, nine contract terms sets are obtained. The contract terms sets are identified according to the preset contract types. The contract type represents the set of corresponding contract terms. Each contract type represents a contract terms set, and each contract type contains multiple contract terms of the same type. A terms library is established according to the divided contract types, and the contract terms of the same contract type are stored in the same storage address.

[0073] In this embodiment, each contract type can also be divided into a general terms library and a specific risk terms library, and the general terms of the same contract type are stored in the general terms library of the contract type, and the specific risk terms of the same contract type are stored in the specific risk terms library of the contract type. For example, in a procurement contract, 18 general terms (procurement subject, fee payment, dispute resolution terms, confidentiality terms, breach of contract terms, etc.) are established, and specific risk terms in individual procurement sub-contracts, such as preventive measures in termite prevention contracts.

[0074] The judgment unit 240 is used to, if receiving a contract text to be reviewed, judge the contract type of the contract text to be reviewed and divide the contract text to be reviewed into paragraphs according to the title level format to obtain the contract terms to be reviewed.

[0075] In this embodiment, the contract text to be reviewed is a legal contract that needs to be reviewed to see if the essential clauses are missing. After receiving the contract text to be reviewed, the contract type of the contract to be reviewed is first determined. Two methods can be used for determination. One is to obtain the contract type of the contract text to be reviewed by matching the title of the contract text to be reviewed with a regular expression, and the other is to obtain the contract type of the contract text to be reviewed by obtaining the keywords of the contract text to be reviewed using the TF-IDF algorithm. In addition, it is also necessary to split the contract to be reviewed into paragraphs, and split the contract text to be reviewed into paragraphs according to the same title-level format as the split training contract text to obtain the clauses to be reviewed of the contract text to be reviewed. The same title-level format is used for splitting, that is, the same granularity is used for splitting the contract text to be reviewed, which ensures that the granularity of the contract clauses in the clause library is consistent with that of the contract clauses to be reviewed, so as to overcome the problem of increased calculation amount and similarity matching error caused by different granularities.

[0076] In one embodiment, if Figure 7 As shown, the judging unit 240 includes: a regularization unit 241 and a matching unit 242 .

[0077] The regularization unit 241 is used to obtain the title of the contract text to be reviewed through a regular expression.

[0078] The matching unit 242 is used to match the title of the contract text to be reviewed with the contract type to obtain the contract type of the contract text to be reviewed.

[0079] In one embodiment, a regular expression is a logic formula for string operation, and a rule string is formed by pre-defined specific characters and combinations of these specific characters. This rule string is used to express a filtering logic for the string. The contract type is used as a pre-set rule string, for example, a purchase contract, a lease contract, and a financing contract, and then the title of the contract to be reviewed is located, and the pre-set rule string is matched with the title of the contract to be reviewed. If the match is successful, the rule string is used as the contract type of the contract text to be reviewed.

[0080] In another embodiment, if Figure 8 As shown, the judging unit 240 includes: a calculating subunit 243 , a sorting unit 244 and an acquiring subunit 245 .

[0081] The calculation subunit 243 is used to calculate the TF-IDF values ​​of all phrases in the contract to be reviewed by using the TF-IDF algorithm.

[0082] The sorting unit 244 is used to sort all the phrases according to their TF-IDF values ​​from high to low.

[0083] The acquisition subunit 245 is used to select keywords according to the ranking and match them with the contract type to obtain the contract type of the contract text to be reviewed.

[0084] In one embodiment, TF-IDF (term frequency-inverse document frequency) is a statistical method for evaluating the importance of a word to a document set or a document in a corpus. TF is term frequency, which indicates the frequency of a phrase in a text, and IDF is inverse document frequency, which is a measure of the general importance of a word. Specifically, firstly, the contract text to be reviewed is segmented according to the word segmentation tool to obtain multiple phrases, and the TF value and IDF value are calculated for each phrase in the contract text to be reviewed, the TF value is equal to the number of times the phrase appears in the text divided by the total number of words in the text, and the IDF value is equal to the logarithm of the total number of texts divided by the number of texts containing the phrase; then the TF value is multiplied by the IDF value to obtain the TF-IDF value, and the phrases are sorted from high to low according to the TF-IDF value corresponding to each phrase; finally, according to the sorting result, the highest-ranked keyword is selected to match the divided contract type. If the keyword matches the contract type, the matched contract type is used as the contract type of the contract to be reviewed. If the keyword does not match the contract type, the second highest-ranked keyword is continued to be selected to match the divided contract type, so as to obtain the contract type of the contract to be reviewed.

[0085] The calculation unit 250 is used to obtain the contract clause corresponding to the contract type of the contract text to be reviewed from the clause library, and calculate the similarity between the obtained contract clause and the contract clause to be reviewed.

[0086] In one embodiment, after determining the contract type of the contract text to be reviewed, first obtain the contract terms of the corresponding contract type from the clause library (general clause library and specific risk clause library) according to the contract type of the contract text to be reviewed, and then perform similarity calculations one by one between the contract terms to be reviewed of the contract text to be reviewed and the contract terms obtained from the clause library. Specifically, firstly, feature engineering is performed on the contract clauses to be reviewed to convert them into sentence vectors. This process is the same as the feature engineering process and will not be repeated here. Then, the cosine distance between the sentence vector of the contract clause to be reviewed and the sentence vector of the contract clause in the clause library is calculated. The cosine distance uses the cosine value of the angle between two vectors in the vector space as a measure of the size of the difference between two individuals. The cosine distance represents the similarity between the contract clause to be reviewed and the contract clause in the clause library. The closer the cosine value is to 1, the higher the similarity is, and the smaller the cosine value is, the lower the similarity is. The similarity of each contract clause to be reviewed is calculated one by one with the contract clauses in the clause library, and the cosine value with the highest similarity is taken as the similarity between the contract clause to be reviewed and the contract clause taken out from the clause library.

[0087] The determination unit 260 is configured to determine that the contract clause in the contract text to be reviewed is missing and generate a missing prompt message to indicate the missing if the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold.

[0088] In one embodiment, the similarity of the contract clauses to be reviewed is compared with a preset threshold. If the similarity of the contract clauses to be reviewed is higher than the preset threshold, it means that the necessary contract clauses exist in the contract text to be reviewed; if the similarity of the contract clauses to be reviewed is lower than the preset threshold, it means that the necessary contract clauses do not exist in the contract text to be reviewed, and the contract clauses of the contract text to be reviewed are determined to be missing. The preset threshold is a pre-set similarity threshold, and each contract clause is set with a preset threshold. For example, if the similarity of the contract clauses to be reviewed is 0.8, and the corresponding preset threshold is 0.6, it means that there are necessary clauses in the contract to be reviewed, and the contract clauses to be reviewed have passed the review. At the same time, a missing prompt message is generated according to the contract number of the contract text to be reviewed, and is sent to a preset email address in the form of an email, which is the email address of the reviewer, so as to prompt the reviewer that the contract text to be reviewed lacks contract clauses.

[0089] In one embodiment, if Fig. 9 As shown, the contract clause review device 200 based on clustering algorithm further includes: an extraction unit 270.

[0090] The extraction unit 270 is used to extract the main information of the contract text to be reviewed according to a regular expression.

[0091] In one embodiment, the subject information refers to the name of the company or the company's unified credit code. The characters commonly used in contracts to extract the company's subject information are preset as regular character strings. For example, in a procurement contract, "Party A:", "Party B:", "Third Party:", in a lease contract, "Lessee:", "Lessor:", etc. Then, the contract text to be reviewed is traversed according to the regular character string to extract the text content that matches the regular character string, i.e., the subject information. After obtaining the subject information, the enterprise portrait API interface can be connected to query whether the parties to the contract have related transactions and black and gray lists to ensure the transaction interests of the parties to the contract.

[0092] The embodiment of the present invention shows a contract clause review device based on a clustering algorithm, which obtains training contract texts from a preset database and splits all the training contract texts into paragraphs according to the title level format to obtain contract clauses; performs feature engineering on the contract clauses to convert the contract clauses into sentence vectors; clusters the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishes a clause library based on the divided contract types; if a contract text to be reviewed is received, determines the contract type of the contract text to be reviewed and splits the contract text to be reviewed into paragraphs according to the title level format to obtain a contract text to be reviewed. Contract terms; obtaining contract terms corresponding to the contract type of the contract text to be reviewed from the term library, and calculating the similarity between the obtained contract terms and the contract terms to be reviewed; if the similarity between the obtained contract terms and the contract terms to be reviewed is lower than a preset threshold, determining that the contract terms in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing, which can ensure that the granularity of the contract terms to be reviewed is the same as the granularity of the terms in the term library used to calculate the similarity, thereby avoiding information loss caused by different granularities; establishing a term library through a clustering algorithm to save human resources; avoiding repeated calculation of the same general terms in different sub-categories of contracts.

[0093] The above-mentioned contract clause review device based on clustering algorithm can be implemented in the form of a computer program. The computer program can be used in Fig.10 Runs on the computer device shown.

[0094] See also Fig.10 , Fig.10 500 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a terminal, wherein the terminal may be an electronic device with communication function such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device.

[0095] See also Fig.10The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0096] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a contract clause review method based on a clustering algorithm.

[0097] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .

[0098] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a contract clause review method based on a clustering algorithm.

[0099] The network interface 505 is used to communicate with other devices over the network. Fig.10 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0100] The processor 502 is used to run a computer program 5032 stored in a memory to implement the following steps: obtaining training contract texts from a preset database and performing paragraph splitting on all the training contract texts according to a title-level format to obtain contract terms; performing feature engineering on the contract terms to convert the contract terms into sentence vectors; clustering the sentence vectors using a clustering algorithm to divide the contract terms corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types; if a contract text to be reviewed is received, determining the contract type of the contract text to be reviewed and performing paragraph splitting on the contract text to be reviewed according to a title-level format to obtain contract terms to be reviewed; obtaining contract terms corresponding to the contract type of the contract text to be reviewed from the clause library, and calculating the similarity between the obtained contract terms and the contract terms to be reviewed; if the similarity between the obtained contract terms and the contract terms to be reviewed is lower than a preset threshold, determining that the contract terms in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing.

[0101] In one embodiment, when the processor 502 implements the step of performing feature engineering on the contract terms to convert the contract terms into sentence vectors, it specifically implements the following steps: performing word segmentation on the contract terms through a word segmentation tool and assigning weights to the segmented phrases; converting the segmented phrases into word vectors through a word vector tool; and performing weighted averaging on the word vectors according to the assigned weights to obtain the sentence vectors of the contract terms.

[0102] In one embodiment, when implementing the step of determining the contract type of the contract text to be reviewed, the processor 502 specifically implements the following steps: obtaining the title of the contract text to be reviewed through a regular expression; matching the title of the contract text to be reviewed with the contract type to obtain the contract type of the contract text to be reviewed.

[0103] In one embodiment, when the processor 502 implements the step of determining the contract type of the contract text to be reviewed, it specifically implements the following steps: using the TF-IDF algorithm to calculate the TF-IDF values ​​of all phrases in the contract to be reviewed; sorting all phrases from high to low according to their TF-IDF values; and selecting keywords based on the sorting to match the contract type to obtain the contract type of the contract text to be reviewed.

[0104] In one embodiment, after implementing the step of determining that the contract terms in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing if the similarity between the acquired contract terms and the contract terms to be reviewed is lower than a preset threshold, the processor 502 further implements the following step: extracting the main information of the contract text to be reviewed according to a regular expression.

[0105] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0106] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0107] Therefore, the present invention also provides a storage medium. The storage medium can be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the following steps: obtaining a training contract text from a preset database and performing paragraph splitting on all the training contract texts according to a title-level format to obtain contract terms; performing feature engineering on the contract terms to convert the contract terms into sentence vectors; clustering the sentence vectors using a clustering algorithm to divide the contract terms corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types; if a contract text to be reviewed is received, determining the contract type of the contract text to be reviewed and performing paragraph splitting on the contract text to be reviewed according to a title-level format to obtain the contract terms to be reviewed; obtaining the contract terms corresponding to the contract type of the contract text to be reviewed from the clause library, and calculating the similarity between the obtained contract terms and the contract terms to be reviewed; if the similarity between the obtained contract terms and the contract terms to be reviewed is lower than a preset threshold, determining that the contract terms in the contract text to be reviewed are missing and generating a missing prompt message to prompt the missing.

[0108] In one embodiment, when the processor executes the program instructions to implement the step of performing feature engineering on the contract terms to convert the contract terms into sentence vectors, the processor specifically implements the following steps: performing word segmentation on the contract terms through a word segmentation tool and assigning weights to the segmented phrases; converting the segmented phrases into word vectors through a word vector tool; and performing weighted averaging of the word vectors according to the assigned weights to obtain the sentence vectors of the contract terms.

[0109] In one embodiment, when the processor executes the program instructions to implement the step of determining the contract type of the contract text to be reviewed, it specifically implements the following steps: obtaining the title of the contract text to be reviewed through a regular expression; matching the title of the contract text to be reviewed with the contract type to obtain the contract type of the contract text to be reviewed.

[0110] In one embodiment, when the processor executes the program instructions to implement the step of determining the contract type of the contract text to be reviewed, the processor specifically implements the following steps: using the TF-IDF algorithm to calculate the TF-IDF values ​​of all phrases in the contract to be reviewed; sorting all phrases from high to low according to their TF-IDF values; and selecting keywords based on the sorting to match the contract type to obtain the contract type of the contract text to be reviewed.

[0111] In one embodiment, after the processor executes the program instructions to implement the step of determining that the contract clause in the contract text to be reviewed is missing and generating a missing prompt message to prompt the missing if the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold, it also implements the following step: extracting the main information of the contract text to be reviewed according to a regular expression.

[0112] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0113] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0114] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0115] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0116] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0117] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A contract clause review method based on clustering algorithm, characterized in that: include: The training contract text is obtained from a preset database, and the title-level format of the training contract text is converted into text by calling a VB macro code, and then all title-level formats of the training contract text are exhaustively enumerated, and the training contract text is divided into paragraphs according to the title-level formats of each level, and the paragraphs of the first-level title level and the second-level title level are retained. The paragraphs under each level of title represent the contract terms; The contract terms are segmented by a word segmentation tool and weights are assigned to the segmented phrases, wherein the weights are assigned based on the keywords of the contract terms. The more the keywords match the legal terms, the higher the weights. The keywords and weights of each contract term have been pre-set. The corresponding weights can be obtained by matching the keywords of the segmented phrases; the segmented phrases are converted into word vectors by a word vector tool; the word vectors are weighted averaged according to the assigned weights to obtain the sentence vectors of the contract terms; Clustering the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into multiple contract types, and establishing a clause library according to the divided contract types; If a contract text to be reviewed is received, the contract type of the contract text to be reviewed is determined and the contract text to be reviewed is segmented into paragraphs according to the same heading-level format as the training contract text to obtain the contract clauses to be reviewed; Acquire contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and perform similarity calculation between the acquired contract clauses and the contract clauses to be reviewed; If the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold, the contract clause in the contract text to be reviewed is determined to be missing and a missing prompt message is generated to prompt the missing.

2. The method for reviewing contract terms based on clustering algorithm according to claim 1, characterized in that: The determining of the contract type of the contract text to be reviewed includes: Obtain the title of the contract text to be reviewed through a regular expression; The title of the contract text to be reviewed is matched with the contract type to obtain the contract type of the contract text to be reviewed.

3. The method for reviewing contract terms based on clustering algorithm according to claim 1, characterized in that: The determining of the contract type of the contract text to be reviewed includes: Calculate the TF-IDF values ​​of all phrases in the contract to be reviewed by using the TF-IDF algorithm; Sort all phrases by their TF-IDF values ​​from high to low; According to the ranking, a keyword is selected to match the contract type to obtain the contract type of the contract text to be reviewed.

4. The method for reviewing contract terms based on clustering algorithm according to claim 1, characterized in that: If the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold, after determining that the contract clause in the contract text to be reviewed is missing and generating a missing prompt message to prompt the missing, the method further includes: The main information of the contract text to be reviewed is extracted according to the regular expression.

5. A contract clause review device based on clustering algorithm, characterized in that: include: An acquisition unit is used to acquire a training contract text from a preset database, convert the title-level format of the training contract text into text by calling a VB macro code, and then exhaustively enumerate all title-level formats of the training contract text, divide the training contract text into paragraphs according to the title-level formats of each level, retain the paragraphs of the first-level title level and the second-level title level, and the paragraphs under each level of title represent the contract terms; A feature unit is used to segment the contract terms through a segmentation tool and assign weights to the segmented phrases, wherein the weights are assigned according to the keywords of the contract terms, and the more the keywords match the legal terms, the higher the weights are. The keywords and weights of each contract term have been pre-set, and the corresponding weights can be obtained by matching the keywords of the segmented phrases; the segmented phrases are converted into word vectors through a word vector tool; and the word vectors are weighted averaged according to the assigned weights to obtain the sentence vectors of the contract terms; A clustering unit, configured to cluster the sentence vectors using a clustering algorithm to divide the contract clauses corresponding to the sentence vectors into a plurality of contract types, and establish a clause library according to the divided contract types; A judgment unit, configured to, if a contract text to be reviewed is received, judge the contract type of the contract text to be reviewed and perform paragraph splitting on the contract text to be reviewed according to the same heading-level format as the split training contract text to obtain contract clauses to be reviewed; A calculation unit, used to obtain contract clauses corresponding to the contract type of the contract text to be reviewed from the clause library, and perform similarity calculation between the obtained contract clauses and the contract clauses to be reviewed; The determination unit is configured to determine that the contract clause in the contract text to be reviewed is missing and generate a missing prompt message to indicate the missing if the similarity between the acquired contract clause and the contract clause to be reviewed is lower than a preset threshold.

6. The device for evaluating contract terms based on clustering algorithm according to claim 5, characterized in that: The judging unit comprises: A regular expression unit, used for obtaining the title of the contract text to be reviewed through a regular expression; A matching unit is used to match the title of the contract text to be reviewed with the contract type to obtain the contract type of the contract text to be reviewed.

7. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 4 when executing the computer program.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 4 can be implemented.