Multi-language contract intelligent comparison method, system and device and storage medium
By pre-processing and typo correction of multilingual contracts, combining the calculation of overall semantic similarity and multi-level semantic similarity, the problem of problem typos and translation errors in multilingual contract comparisons is solved, and the automated comparison and consistency of contracts is achieved.
Patent Information
- Application Number
- CN202510524741.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2045-04-24
AI Technical Summary
In multinational business cooperation, there are typos and translation errors in automatic comparison of multilingual contracts, resulting in semantic deviations in contracts in different language versions, and traditional manual comparisons are time-consuming and labor-intensive.
By pre-processing multilingual contracts, typo correction, calculating overall semantic similarity and multi-level semantic similarity, identifying problem clauses and generating correction suggestions, ensuring the consistency and accuracy of the contract.
It improves the accuracy and efficiency of multilingual contract comparison, reduces the impact of typos, and ensures the semantic consistency of the contract and reduces the legal risks.
Smart Images

Figure CN120449885A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of automated office technology, and specifically relates to a multi-language contract intelligent comparison method, system, device and storage medium. Background Art
[0002] In cross-border business cooperation, companies usually need to sign multilingual contracts. Therefore, companies usually need to compare contracts in different languages to ensure consistency in content.
[0003] However, when drafting contracts, manual input can introduce typos, reducing the accuracy of contract comparisons. Translation errors can also lead to semantic discrepancies between contracts in different languages. Furthermore, traditional contract comparison methods typically rely on manual work, which is time-consuming and laborious. Summary of the Invention
[0004] The purpose of the present invention is to provide a multilingual contract intelligent comparison method, system, device and storage medium, which can automatically compare multilingual contracts and ensure the consistency and accuracy of multilingual contracts.
[0005] A first aspect of the present invention provides a method for intelligently comparing multilingual contracts, wherein the multilingual contract includes at least: a first language version contract and a second language version contract, wherein the second language version contract is a contract translated from the first language version into a second language, and includes:
[0006] Preprocessing the first language version of the contract to obtain a first text content, and preprocessing the second language version of the contract to obtain a second text content;
[0007] Correcting typos in the first text to obtain a first corrected text, and correcting typos in the second text to obtain a second corrected text;
[0008] calculating an overall semantic similarity and a multi-level semantic similarity between a first clause in the first corrected text and a second clause in a second corrected text, where the second clause is a clause translated into a second language from the first clause, and calculating a global match between the first corrected text and the second corrected text;
[0009] Calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, the multi-level semantic similarity, and the global matching degree, and determine whether the second clause is a problematic clause based on the similarity score;
[0010] Identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
[0011] In some embodiments, calculating the multi-level semantic similarity between the first clause and the clause of the second corrected text includes:
[0012] Calculating word similarity, phrase similarity, and sentence similarity between the first clause and the second clause;
[0013] The mean of the word similarity, phrase similarity and sentence similarity is calculated to obtain multi-level semantic similarity.
[0014] In some embodiments, calculating the word similarity between the first clause and the second clause includes:
[0015] Convert each word of the first clause into a first word vector to obtain a first word vector set;
[0016] Convert each word of the second clause into a second word vector to obtain a second word vector set;
[0017] Calculating the cosine similarity between each word in the first word vector set and all words in the second word vector set, taking the maximum cosine similarity as the word vector similarity of each word, calculating the mean of the word vector similarities, and obtaining the word similarity between the first clause and the second clause;
[0018] Calculating the phrase similarity between the first clause and the second clause includes:
[0019] Convert each phrase of the first clause into a first phrase vector with a weight, to obtain a first phrase vector set;
[0020] Convert each phrase of the second clause into a second phrase vector with a weight, to obtain a second phrase vector set;
[0021] Calculate the cosine similarity between each phrase in the first phrase vector set and all phrases in the second phrase vector set, use the maximum cosine similarity as the phrase vector similarity of each phrase, calculate the mean of the phrase vector similarities, and obtain the phrase similarity of the first clause and the second clause.
[0022] In some embodiments, calculating the global matching degree between the first corrected text and the second corrected text includes:
[0023] Convert each sentence in the first corrected text into a first sentence vector, perform maximum pooling on all first sentence vectors to obtain the maximum value of each dimension, and the maximum values of all dimensions constitute the first key semantic feature;
[0024] Convert each sentence in the second corrected text into a second sentence vector, perform maximum pooling on all the second sentence vectors to obtain the maximum value of each dimension, and the maximum values of all dimensions constitute the second key semantic feature;
[0025] The cosine similarity between the first key semantic feature and the second key semantic feature is calculated to obtain a global matching degree.
[0026] In some embodiments, the contract is pre-processed to obtain text content. When the contract is a first language version contract, the text content is the first text content; when the contract is a second language version contract, the text content is the second text content, including:
[0027] Perform image preprocessing on the scanned copy of the contract to obtain the corresponding image;
[0028] Performing layout analysis and region segmentation on the image to obtain text areas, table areas, and picture areas, wherein the picture areas include: pictures, headers / footers, invalid characters, official seals, signatures, etc.;
[0029] Converting the text region to obtain text, using regular expressions to identify clause levels in the text, using an NLP model to identify title keywords in the text with the identified clause levels, obtaining semantic titles for each clause level in the text, generating a tree structure of the text based on the parent-child relationship of the clause levels, and generating hierarchical text based on the tree structure and the semantic titles for each clause level;
[0030] Identifying the rows, columns, and cell structures of the table in the table area and reconstructing the table structure;
[0031] The hierarchical text and the corresponding table structure are merged to obtain text content.
[0032] In some embodiments, correcting typos in text content to obtain a corrected text, when the text content is first text content, the corrected text is a first corrected text, and when the text content is second text content, the corrected text is a second corrected text, includes:
[0033] The word similarity between the words in the text content and the words in the industry vocabulary is calculated using a first similarity calculation formula, wherein the first similarity calculation formula is:
[0034] SC(w,t)=λ1*EditSim(w,t)+λ2*EmbSim(w,t)+λ3*XLSA(w,t)
[0035] EditSim(w,t)=1-Lev(w,t) / max(|w|,|t|)
[0036] Wherein, the w represents a word in the text content, t represents a word in the industry vocabulary, the Lev(w,t) represents the edit distance between word w and word t, the max(|w|,|t|) represents the maximum value of the string length of word w and word t, the EmbSim(w,t) represents the cosine similarity between the word vector of word w and the word vector of word t, the XLSA(w,t) represents the cosine similarity between the embedding vector of word w and the embedding vector of word t, the λ1 represents the first weight, the λ2 represents the second weight, the λ3 represents the third weight, and the SC(w,t) represents the similarity between word w and word t;
[0037] When the word similarity is greater than the correction threshold, the words in the text content are replaced with words in the industry vocabulary to obtain a corrected text.
[0038] In some embodiments, identifying the question category of the question clause includes:
[0039] Determine whether the word similarity between the first clause and the second clause in the problem clause is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, determine that the problem category is translation deviation;
[0040] Extract keywords from the first and second clauses of the problematic clauses, and compare the keywords of the second clause with the keywords of the first clause. If the second clause lacks the keywords of the first clause, the problem category is determined to be missing content in the second clause.
[0041] Use the industry legal dictionary to check whether different legal terms are used between the first and second clauses. If so, the problem category is determined to be a terminology change;
[0042] Perform dependency syntax analysis on the first clause and the second clause to determine whether there is a difference in the grammatical relationship structure between the first clause and the second clause. If so, determine that the problem category is grammatical adjustment.
[0043] A second aspect of the present invention provides a multilingual contract intelligent comparison system, wherein the multilingual contract includes at least: a first language version contract and a second language version contract, wherein the second language version contract is a contract translated from the first language version into the second language, and includes:
[0044] a preprocessing module, configured to preprocess the first language version of the contract to obtain a first text content, and preprocess the second language version of the contract to obtain a second text content;
[0045] a correction module, configured to correct typos in the first text content to obtain a first corrected text, and to correct typos in the second text content to obtain a second corrected text;
[0046] a calculation module, configured to calculate an overall semantic similarity and a multi-level semantic similarity between a first clause in the first corrected text and a second clause in a second corrected text, wherein the second clause is a clause translated from the first clause into a second language, and calculate a global match between the first corrected text and the second corrected text;
[0047] a calculation and judgment module, configured to calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, the multi-level semantic similarity, and the global matching degree, and determine whether the clause is a problematic clause based on the similarity score;
[0048] The suggestion generation module is used to identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
[0049] A third aspect of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0050] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of the above method when executed by a processor.
[0051] The technical solution provided by the present invention has the following advantages and effects: by correcting typos in contracts in different language versions, the correctness of the spelling and terminology of the text is ensured to reduce the impact of typos on subsequent comparisons; by calculating the overall semantic similarity and multi-level semantic similarity of contract terms, as well as calculating the global matching degree of the contract, the similarity of contracts in different languages is evaluated; based on the similarity, it is determined whether there are problematic clauses; if there are problematic clauses, the problem category is identified, correction suggestions are generated, semantic differences in the contract are marked, and modification suggestions are provided to ensure the consistency and accuracy of multilingual contracts. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 Schematic diagram of the process of the multi-language contract intelligent comparison method provided by the present invention;
[0053] Figure 2 This is a structural block diagram of the multilingual contract intelligent comparison system provided by the present invention;
[0054] Figure 3 It is a diagram of the internal structure of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] To facilitate understanding of the present invention, specific embodiments of the present invention will be described in more detail below with reference to the accompanying drawings.
[0056] Unless otherwise specified or defined, the "first, second..." used in this article is only used to distinguish names and does not represent a specific quantity or order.
[0057] Unless stated otherwise or defined otherwise, the term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0058] It should be noted that, in this document, “fixed to” or “connected to” may mean directly fixing or connecting to an element, or indirectly fixing or connecting to an element.
[0059] like Figure 1 As shown, this embodiment provides a multi-language contract intelligent comparison method, including the following steps S10 to S50:
[0060] Step S10: Preprocess the first language version of the contract to obtain first text content, and preprocess the second language version of the contract to obtain second text content.
[0061] In practical applications, the multilingual contract includes at least a first-language version and a second-language version. Multilingual contracts are typically paper contracts, and scanned copies of the multilingual contracts are obtained by scanning the paper contracts. Multilingual contracts are not limited to first-language and second-language versions and may include third-language and fourth-language versions. The second-language, third-language, and fourth-language versions of the contracts are all translated from the first-language version. When comparing contracts, the second-language, third-language, and fourth-language versions are compared with the first-language version in that order.
[0062] Specifically, the pre-processing step includes:
[0063] Performing image preprocessing, such as denoising and binarization, on the scanned copies of the first language version of the contract and the second language version of the contract to obtain corresponding first and second images;
[0064] Performing layout analysis and region segmentation on the first image and the second image respectively to obtain a text area, a table area, and a picture area of the first image, and a text area, a table area, and a picture area of the second image, wherein the picture area includes: pictures, headers / footers, invalid characters, official seals, signatures, etc.;
[0065] The text areas of the first and second images are converted to obtain the first and second texts. Regular expressions are then used to identify the clause hierarchy of the first and second texts. Then, an NLP model is used to identify title keywords in the first and second texts with the identified clause hierarchy, obtaining semantic titles for each clause hierarchy of the first and second texts. A tree structure of the first and second texts is generated based on the parent-child relationship of the clause hierarchy, thereby outputting the first hierarchical text of the first text and the second hierarchical text of the second text, thereby preserving the hierarchical structure of the multilingual contract.
[0066] The CascadeTabNet model is used to identify the rows, columns, and cell structures of the table areas in the first and second images, and the complete structure of the table is reconstructed to obtain the table of the first and second language versions of the contract, thus preserving the table structure.
[0067] The first hierarchical text and the corresponding table structure are merged to obtain first text content, and the second hierarchical text and the corresponding table structure are merged to obtain second text content.
[0068] Step S20: Correct the first text content for typos to obtain a first corrected text, and correct the second text content for typos to obtain a second corrected text.
[0069] In practical applications, by correcting typos in the first and second text contents, typos generated when drafting contracts can be reduced, as well as typos caused by recognition errors in the preprocessing process, thereby improving the accuracy of subsequent comparisons between first-language contracts and second-language contracts.
[0070] Specifically, step S20 includes the following steps:
[0071] Correcting typos in the text content to obtain a corrected text, where when the text content is the first text content, the corrected text is the first corrected text; and when the text content is the second text content, the corrected text is the second corrected text, including:
[0072] A first similarity calculation formula is used to calculate the word similarity between the words in the text content and the words in the industry vocabulary, wherein the first similarity calculation formula is:
[0073] SC(w,t)=λ1*EditSim(w,t)+λ2*EmbSim(w,t)+λ3*XLSA(w,t)
[0074] EditSim(w,t)=1-Lev(w,t) / max(|w|,|t|)
[0075] Wherein, the w represents a word in the text content, t represents a word in the industry vocabulary, the Lev(w,t) represents the edit distance between word w and word t, the max(|w|,|t|) represents the maximum value of the string length of word w and word t, the EmbSim(w,t) represents the cosine similarity between the word vector of word w and the word vector of word t, the XLSA(w,t) represents the cosine similarity between the embedding vector of word w and the embedding vector of word t, the λ1 represents the first weight, the λ2 represents the second weight, the λ3 represents the third weight, and the SC(w,t) represents the similarity between word w and word t;
[0076] When the text content is the first text content, the industry vocabulary is the first industry vocabulary, and the word similarity is the first similarity; when the text content is the second text content, the industry vocabulary is the second industry vocabulary, and the word similarity is the second similarity; when the first similarity is greater than the correction threshold, the words of the first text content are replaced with words in the first industry vocabulary to obtain a first corrected text; when the second similarity is greater than the correction threshold, the words of the second text content are replaced with words in the second industry vocabulary to obtain a second corrected text.
[0077] In practice, an industry lexicon is a pre-organized and stored collection of industry terms. These terms can be extracted from historical contract data, professional documents, and regulatory texts. Different industry lexicons can be pre-established based on different languages. For example, the first industry lexicon contains industry terms in the first language, while the second industry lexicon uses the second language.
[0078] After constructing the corresponding industry vocabulary, select the corresponding industry vocabulary according to the languages of the first text content and the second text content. The industry vocabulary corresponding to the first text content is the first industry vocabulary, and the industry vocabulary corresponding to the second text content is the second industry vocabulary. Traverse all the words in the first text content, take the words in the first text content as w and the words in the first industry vocabulary as t, and substitute them into the first similarity calculation formula to calculate the first similarity between each word in the first text content and all the words in the first industry vocabulary in turn. When there is a first similarity greater than the correction threshold, replace the word w corresponding to the first similarity with the word t to achieve the correction of misspelled words in the first text content. The method for correcting misspelled words in the second text content is the same as that in the first text content. Traverse all the words in the second text content, take the words in the second text content as w and the words in the second industry vocabulary as t, and substitute them into the first similarity calculation formula to calculate the second similarity between each word in the second text content and all the words in the second industry vocabulary in turn. When there is a second similarity greater than the correction threshold, replace the word w corresponding to the second similarity with the word t to achieve the correction of misspelled words in the second text content.
[0079] Through the normalization of the edit distance between the word w and the word t, a ratio between 0 and 1 can be obtained regardless of the string length. By subtracting the normalized edit distance from 1, when the strings of the word w and the word t are exactly the same, Lev(w, t) = 0 and the result is 1; while when the strings of the word w and the word t are very different, Lev(w, t) is close to max(|w|, |t|) and the result is close to 0. Based on this, the edit distance similarity is calculated. For example, assume w = "代款期限" and t = "贷款期限", Lev(w, t) = 1 (only one character is different), max(|w|, |t|) = 4, EditSim(w, t) = 1 - 1 / 4 = 0.75. This shows that from the editing perspective, the similarity between the two words is 0.75, indicating that "代款期限" and "贷款期限" are relatively similar but still have a certain gap. This quantification method helps to judge whether the candidate replacement word is close enough in misspelled word correction, so as to decide whether to replace it.
[0080] Generate the word vectors of the word w and the word t through the word2vec model, and then calculate the cosine similarity between the word vector of the word w and the word vector of the word t to obtain the word vector similarity between the word w and the word t. The word vector similarity represents the inherent similarity between the word w and the word t, with a range of [0, 1]. The closer to 1, the closer the semantics. For example: 贷款期限 vs 借款期限, EmbSim = 0.92 (similar in meaning); 融资 vs 贷款, EmbSim = 0.85 (relatively similar in meaning), 投资 vs 诈骗, EmbSim = 0.15 (different in meaning, not a misspelled word).
[0081] The embedding vectors of word w and word t are calculated through a preset cross-language model. The cross-language model can adopt the XLM-R model in the existing technology. Then, the similarity between the embedding vectors of word w and word t is calculated to obtain the embedding vector similarity between word w and word t. The embedding vector similarity represents the similarity obtained by connecting the context of word w and word t, which makes up for the defect that word vector similarity lacks context connection.
[0082] The similarity between word w and word t is calculated by combining edit distance similarity, word vector similarity and embedding vector similarity. Edit distance similarity can efficiently solve spelling problems and can quickly determine the spelling difference between word w and word t. If there is no difference, it means that word w and word t are exactly the same and no replacement is required. If they are completely different, there is a high probability that there is no spelling error and usually no replacement is required. If they are relatively similar but there is still a certain gap, further judgment is required. Therefore, the first weight is greater than the second weight and the third weight. Edit distance similarity is the main judgment criterion, which can more directly reflect whether a spelling error occurs. Word vector similarity and embedding vector similarity are secondary judgment criteria. When edit distance similarity is difficult to determine whether a spelling error occurs, it plays an auxiliary role and improves the accuracy of typo recognition. For example, if w = "cat" and t = "car", the edit distance similarity is high, but there is still a gap. Further judgment is made through word vector similarity and embedding vector similarity. That is, the similarity of the fixed semantics of "cat" and "car" and the semantic similarity of "cat" and "car" in the context are combined to determine whether w has a typo.
[0083] Step S30: Calculate the overall semantic similarity and multi-level semantic similarity between the first clause in the first corrected text and the second clause in the second corrected text, where the second clause is a clause translated from the first clause into a second language, and calculate the global matching degree between the first corrected text and the second corrected text.
[0084] In practical applications, the overall semantic similarity and multi-level semantic similarity between the first clause and the second clause are calculated, as well as the global matching degree between the first corrected text and the second corrected text. This facilitates the subsequent calculation of the similarity score between the first clause and the second clause based on the overall semantic similarity, multi-level semantic similarity and global matching degree. The similarity score between the first clause and the second clause is comprehensively evaluated through multiple dimensions to improve the accuracy of the similarity score.
[0085] Specifically, calculating the overall semantic similarity between the first clause and the second clause includes:
[0086] Using a preset cross-language model to generate a first embedding vector corresponding to the first clause and a second embedding vector corresponding to the second clause;
[0087] Calculate the cosine similarity between the first embedding vector and the second embedding vector to obtain the overall semantic similarity.
[0088] In practical applications, by obtaining the first embedding vector of the first clause and the second embedding vector of the second clause, the first embedding vector and the second embedding vector will be dynamically adjusted according to the context, so as to obtain the overall semantics of the first clause and the overall semantics of the second clause in combination with the context. By calculating the cosine similarity of the first embedding vector and the second embedding vector, the overall semantic similarity of the first clause and the second clause is obtained.
[0089] Specifically, the calculating of the multi-level semantic similarity between the first clause and the clause of the second corrected text includes:
[0090] Calculating word similarity, phrase similarity, and sentence similarity between the first clause and the second clause;
[0091] The mean of the word similarity, phrase similarity and sentence similarity is calculated to obtain multi-level semantic similarity.
[0092] In practical applications, multi-level semantic similarity is derived by combining word similarity, phrase similarity, and sentence similarity. This allows for the semantic similarity between the first and second clauses to be evaluated at the word, phrase, and sentence levels, resulting in a multi-level semantic similarity. This multi-level semantic fusion (at the word, phrase, and sentence levels) captures deeper semantic information. By integrating semantic information at the word, phrase, and sentence levels, a richer, more globally understandable semantic representation is generated, ultimately improving the accuracy of multilingual contract clause matching.
[0093] Specifically, calculating the word similarity between the first clause and the second clause includes:
[0094] Convert each word of the first clause into a first word vector to obtain a first word vector set;
[0095] Convert each word of the second clause into a second word vector to obtain a second word vector set;
[0096] Calculate the cosine similarity between each word in the first word vector set and all words in the second word vector set, take the maximum cosine similarity as the word vector similarity of each word, calculate the mean of the word vector similarities, and obtain the word similarity between the first clause and the second clause.
[0097] In practical applications, the FastText model is used to convert the words in the first clause and the second clause into the first word vector and the second word vector respectively. FastText splits the whole word into character n-grams (sub-word segments). For example, "force majeure" can be split into ["not", "not possible", "possible to resist", "resist force", "force"], which reflects the co-occurrence information of words in context and calculates the local semantic information of a single word appearing in the context. Calculate the cosine similarity between each word in the first word vector set and each word in the second word vector set to form a word similarity matrix. The rows of this word similarity matrix represent the words in the first word vector set, the columns represent the words in the second word vector set, and each element in the matrix represents the cosine similarity of the corresponding word pair. For each word in the first word vector set, check the maximum value in the corresponding row of the word similarity matrix. This maximum value is the similarity value of the most similar word pair found by this word in the second word vector set, that is, the word vector similarity of this word. Then calculate the mean of the word vector similarities of all words in the first word vector set to obtain the word similarity between the first clause and the second clause. The word similarity reflects the semantic proximity between the first clause and the second clause at the word level and can identify synonyms, abbreviations, and technical terms. If the word similarity is high, it means that the words used in the two clauses are very close. Through this method, each word in the first word vector set can find its most similar word pair in another contract clause, thus ensuring the comprehensiveness and accuracy of the comparison.
[0098] Specifically, the calculation of the phrase similarity between the first clause and the second clause includes:
[0099] Convert each phrase in the first clause into a weighted first phrase vector to obtain a first phrase vector set;
[0100] Convert each phrase in the second clause into a weighted second phrase vector to obtain a second phrase vector set; [[ID=,10]]
[0101] Calculate the cosine similarity between each phrase in the first phrase vector set and all phrases in the second phrase vector set, take the maximum cosine similarity as the phrase vector similarity of each phrase, and calculate the mean of the phrase vector similarities to obtain the phrase similarity between the first clause and the second clause.
[0102] In practical applications, the TF-IDF model is used to convert the phrases in the first clause and the phrases in the second clause into weighted first and second phrase vectors, respectively. The cosine similarity between each word in the first phrase vector set and each phrase in the second phrase vector set is calculated to form a phrase similarity matrix. The rows of this phrase similarity matrix represent phrases in the first phrase vector set, and the columns represent phrases in the second phrase vector set. Each element in the matrix represents the cosine similarity of the corresponding phrase pair. For each phrase in the first phrase vector set, the maximum value in the corresponding row of the phrase similarity matrix is checked. This maximum value is the similarity value of the most similar phrase pair found in the second phrase vector set for that phrase, that is, the phrase vector similarity of that phrase. The average phrase vector similarity of all phrases in the first phrase vector set is then calculated to obtain the word similarity between the first and second clauses. Through TF-IDF vectorization and cosine similarity calculation, the formal and partial semantic similarities between phrases can be efficiently quantified. The maximum matching method is used to select the most similar phrase pairs, and the maximum value is used as the final result to highlight the core phrases. This allows the system to identify the phrases in the first and second clauses of the contract, even if they are expressed differently, as long as they are semantically similar, to prevent the omission of key clauses.
[0103] Specifically, calculating the global matching degree between the first corrected text and the second corrected text includes:
[0104] Convert each sentence in the first corrected text into a first sentence vector, perform maximum pooling on all first sentence vectors to obtain the maximum value of each dimension, and the maximum value of all dimensions constitutes a first key semantic feature;
[0105] Convert each sentence in the second corrected text into a second sentence vector, perform maximum pooling on all the second sentence vectors to obtain the maximum value of each dimension, and the maximum values of all dimensions constitute the second key semantic feature;
[0106] The cosine similarity between the first key semantic feature and the second key semantic feature is calculated to obtain a global matching degree.
[0107] In practical applications, the Sentence-BERT model is used to convert each sentence in the first corrected text and each sentence in the second corrected text into a first sentence vector and a second sentence vector respectively. The first sentence vector captures the semantic information of the sentence in the first corrected text, and the second sentence vector captures the semantic information of the sentence in the second corrected text. The "most significant" part is extracted from all the first sentence vectors and the second sentence vectors, that is, the first sentence vector and the second sentence vector are max-pooled. Specifically, if the contract S1 has N sentences, each sentence has a 768-dimensional vector, represented by {h1,h2,...,h N}(h i∈R 768 ), taking the maximum value of each dimension of each sentence to obtain a 768-dimensional vector. In the process of max pooling, the maximum value of each dimension is extracted from all sentence vectors of contract S1 through max pooling to form a contract-level semantic vector. The specific formula is:
[0108] Vs=[max(h 1,1 ,h 2,1 ,...,h N,1 ),…,max(h 1,768 ,h 2,768 ,...,h N,768 )]
[0109] Among them, h i,j Represents the jth dimension of the ii-th sentence vector. Take contract S1 with 3 sentences and a vector dimension of 3 as an example:
[0110] Sentence 1 vector: [0.8, 0.2, 0.5]
[0111] Sentence 2 vector: [0.3, 0.9, 0.1]
[0112] Sentence 3 vector: [0.6, 0.4, 0.7]
[0113] Contract vector after max pooling: [0.8, 0.9, 0.7]
[0114] The max-pooled contract vector retains the strongest semantic signal in the contract and represents the key semantic features of the contract. The first key semantic feature is the max-pooled contract vector of the first corrected text, and the second key semantic feature is the max-pooled contract vector of the second corrected text. Max-pooling ignores low-frequency or minor information, such as common phrases in general clauses, improving noise immunity. Regardless of the number of sentences in the contract, the output vector dimension is fixed (e.g., 768 dimensions), facilitating subsequent calculations.
[0115] Step S40: Calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, multi-level semantic similarity, and global matching degree, and determine whether the second clause is a problematic clause based on the similarity score.
[0116] In practical applications, the overall semantic similarity, multi-level semantic similarity, and global matching degree are substituted into the second similarity calculation formula to calculate the similarity score. The second similarity calculation formula is:
[0117] Sim(T1,T2)=α*XLSA(T1,T2)+β*HSF(T1,T2)+γ*CAA(S1,S2)
[0118] Here, S1 represents the first clause, S2 represents the second clause, XLSA(T1, T2) represents the overall semantic similarity between the first and second clauses, HSF(T1, T2) represents the multi-level semantic similarity between the first and second clauses, CAA(S1, S2) represents the global match between the first and second corrected texts, α represents the overall weight, β represents the multi-level weight, and γ represents the global weight. The values of α, β, and γ can be adjusted based on different contract types.
[0119] After the similarity score is calculated according to the second similarity calculation formula, the similarity score is compared with the similarity threshold. When the similarity score is lower than the similarity threshold, the second clause is determined to be a problematic clause.
[0120] Step S50: Identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
[0121] Specifically, the problem category of the identification of the problem clause includes:
[0122] Determine whether the word similarity between the first clause and the second clause in the problem clause is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, determine that the problem category is translation deviation;
[0123] Extract keywords from the first and second clauses of the problematic clauses, and compare the keywords of the second clause with the keywords of the first clause. If the second clause lacks the keywords of the first clause, the problem category is determined to be missing content in the second clause.
[0124] Use the industry legal dictionary to check whether different legal terms are used between the first and second clauses. If so, the problem category is determined to be a terminology change;
[0125] Perform dependency syntax analysis on the first clause and the second clause to determine whether there is a difference in the grammatical relationship structure between the first clause and the second clause. If so, determine that the problem category is grammatical adjustment.
[0126] In actual applications, by comprehensively analyzing various problem categories, the system can accurately locate clause defects, provide targeted correction suggestions, and generate a problem category report for low-similarity clauses, as shown in the following table:
[0127]
[0128]
[0129] The generated problem category report is used for subsequent manual or AI optimization and correction to ensure the consistency and accuracy of contract terms, improve contract review efficiency, reduce legal risks, and protect the rights and interests of both parties.
[0130] The multilingual contract intelligent comparison method of the present invention corrects typos in contracts in different language versions to ensure the correctness of text spelling and terminology, thereby reducing the impact of typos on subsequent comparisons. It evaluates the similarity of contracts in different languages by calculating the overall semantic similarity and multi-level semantic similarity of contract terms, as well as the global matching degree of contracts. It determines whether there are problematic clauses based on the similarity. If there are problematic clauses, it identifies the problem category, generates correction suggestions, marks semantic differences in the contract, and provides modification suggestions, thereby ensuring the consistency and accuracy of cross-language contracts.
[0131] like Figure 2 As shown, an embodiment of the present invention further provides a multilingual contract intelligent comparison system, wherein the multilingual contract includes at least: a first language version contract and a second language version contract, wherein the second language version contract is a contract translated from the first language version into a second language, and includes:
[0132] Preprocessing module 1, configured to preprocess the first language version of the contract to obtain first text content, and preprocess the second language version of the contract to obtain second text content;
[0133] Correction module 2, configured to correct typos in the first text to obtain a first corrected text, and correct typos in the second text to obtain a second corrected text;
[0134] Calculation module 3, configured to calculate the overall semantic similarity and multi-level semantic similarity between a first clause in the first corrected text and a second clause in a second corrected text, where the second clause is a clause translated into a second language from the first clause, and calculate the global matching degree between the first corrected text and the second corrected text;
[0135] A calculation and judgment module 4 is configured to calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, the multi-level semantic similarity, and the global matching degree, and determine whether the second clause is a problematic clause based on the similarity score;
[0136] The suggestion generating module 5 is used to identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
[0137] Each module of the aforementioned intelligent multilingual contract comparison system may be implemented in whole or in part through software, hardware, or a combination thereof. Each of these modules and units may be embedded in or independent of a processor within a computer device in the form of hardware, or may be stored in a computer device's memory in the form of software, so that the processor can call and execute the corresponding operations of each module.
[0138] like Figure 3 As shown, an embodiment of the present invention discloses a computer device, including a memory and a processor, wherein the memory stores a computer program;
[0139] The computer device may be a server, and its internal structure diagram may be as follows: Figure 3 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. When executed by the processor, the computer program implements the multilingual contract intelligent comparison method described in the above embodiments.
[0140] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0141] An embodiment of the present invention also discloses a computer-readable storage medium storing a computer program, wherein the computer program enables a computer to execute the multilingual contract intelligent comparison method described in the above embodiments.
[0142] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0143] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
Claims
1. A multilingual contract intelligent comparison method, wherein the multilingual contract includes at least: A first language version contract and a second language version contract, wherein the second language version contract is a contract translated into a second language, and is characterized by including: Preprocessing the first language version of the contract to obtain a first text content, and preprocessing the second language version of the contract to obtain a second text content; Correcting typos in the first text to obtain a first corrected text, and correcting typos in the second text to obtain a second corrected text; calculating an overall semantic similarity and a multi-level semantic similarity between a first clause in the first corrected text and a second clause in a second corrected text, where the second clause is a clause translated into a second language from the first clause, and calculating a global match between the first corrected text and the second corrected text; Calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, the multi-level semantic similarity, and the global matching degree, and determine whether the second clause is a problematic clause based on the similarity score; Identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
2. The multilingual contract intelligent comparison method according to claim 1, characterized in that: The calculating of the multi-level semantic similarity between the first clause and the clause of the second corrected text includes: Calculating word similarity, phrase similarity, and sentence similarity between the first clause and the second clause; The mean of the word similarity, phrase similarity and sentence similarity is calculated to obtain multi-level semantic similarity.
3. The multilingual contract intelligent comparison method according to claim 2, characterized in that: Calculating the word similarity between the first clause and the second clause includes: Convert each word of the first clause into a first word vector to obtain a first word vector set; Convert each word of the second clause into a second word vector to obtain a second word vector set; Calculating the cosine similarity between each word in the first word vector set and all words in the second word vector set, taking the maximum cosine similarity as the word vector similarity of each word, calculating the mean of the word vector similarities, and obtaining the word similarity between the first clause and the second clause; Calculating the phrase similarity between the first clause and the second clause includes: Convert each phrase of the first clause into a first phrase vector with a weight, to obtain a first phrase vector set; Convert each phrase of the second clause into a second phrase vector with a weight, to obtain a second phrase vector set; Calculate the cosine similarity between each phrase in the first phrase vector set and all phrases in the second phrase vector set, use the maximum cosine similarity as the phrase vector similarity of each phrase, calculate the mean of the phrase vector similarities, and obtain the phrase similarity of the first clause and the second clause.
4. The multilingual contract intelligent comparison method according to claim 1, characterized in that: Calculating the global matching degree between the first corrected text and the second corrected text includes: Convert each sentence in the first corrected text into a first sentence vector, perform maximum pooling on all first sentence vectors to obtain the maximum value of each dimension, and the maximum value of all dimensions constitutes a first key semantic feature; Convert each sentence in the second corrected text into a second sentence vector, perform maximum pooling on all the second sentence vectors to obtain the maximum value of each dimension, and the maximum values of all dimensions constitute the second key semantic feature; The cosine similarity between the first key semantic feature and the second key semantic feature is calculated to obtain a global matching degree.
5. The multilingual contract intelligent comparison method according to claim 1, characterized in that: The contract is pre-processed to obtain text content. When the contract is a first language version contract, the text content is the first text content; when the contract is a second language version contract, the text content is the second text content, including: Perform image preprocessing on the scanned copy of the contract to obtain the corresponding image; Performing layout analysis and region segmentation on the image to obtain text areas, table areas, and picture areas, wherein the picture areas include: pictures, headers / footers, invalid characters, official seals, signatures, etc.; Converting the text region to obtain text, using regular expressions to identify clause levels in the text, using an NLP model to identify title keywords in the text with the identified clause levels, obtaining semantic titles for each clause level in the text, generating a tree structure of the text based on the parent-child relationship of the clause levels, and generating hierarchical text based on the tree structure and the semantic titles for each clause level; Identifying the rows, columns, and cell structures of the table in the table area and reconstructing the table structure; The hierarchical text and the corresponding table structure are merged to obtain text content.
6. The multilingual contract intelligent comparison method according to claim 1, characterized in that: Correcting typos in the text content to obtain a corrected text, where when the text content is the first text content, the corrected text is the first corrected text; and when the text content is the second text content, the corrected text is the second corrected text, including: The word similarity between the words in the text content and the words in the industry vocabulary is calculated using a first similarity calculation formula, wherein the first similarity calculation formula is: SC(w,t)=λ1*EditSim(w,t)+λ2*EmbSim(w,t)+λ3*XLSA(w,t) EditSim(w,t)=1-Lev(w,t) / max(|w|,|t|) Wherein, the w represents a word in the text content, t represents a word in the industry vocabulary, the Lev(w,t) represents the edit distance between word w and word t, the max(|w|,|t|) represents the maximum value of the string length of word w and word t, the EmbSim(w,t) represents the cosine similarity between the word vector of word w and the word vector of word t, the XLSA(w,t) represents the cosine similarity between the embedding vector of word w and the embedding vector of word t, the λ1 represents the first weight, the λ2 represents the second weight, the λ3 represents the third weight, and the SC(w,t) represents the similarity between word w and word t; When the word similarity is greater than the correction threshold, the words in the text content are replaced with words in the industry vocabulary to obtain a corrected text.
7. The multilingual contract intelligent comparison method according to claim 1, characterized in that: The problem category of the identification of the problem clause includes: Determine whether the word similarity between the first clause and the second clause in the problem clause is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, determine that the problem category is translation deviation; Extract keywords from the first and second clauses of the problematic clauses, and compare the keywords of the second clause with the keywords of the first clause. If the second clause lacks the keywords of the first clause, the problem category is determined to be missing content in the second clause. Use the industry legal dictionary to check whether different legal terms are used between the first and second clauses. If so, the problem category is determined to be a terminology change; Perform dependency syntax analysis on the first clause and the second clause to determine whether there is a difference in the grammatical relationship structure between the first clause and the second clause. If so, determine that the problem category is grammatical adjustment.
8. A multilingual contract intelligent comparison system, wherein the multilingual contract includes at least: A first language version contract and a second language version contract, wherein the second language version contract is a contract translated into a second language, and is characterized by including: a preprocessing module, configured to preprocess the first language version of the contract to obtain a first text content, and preprocess the second language version of the contract to obtain a second text content; a correction module, configured to correct typos in the first text content to obtain a first corrected text, and to correct typos in the second text content to obtain a second corrected text; a calculation module, configured to calculate an overall semantic similarity and a multi-level semantic similarity between a first clause in the first corrected text and a second clause in a second corrected text, wherein the second clause is a clause translated from the first clause into a second language, and calculate a global match between the first corrected text and the second corrected text; a calculation and judgment module, configured to calculate a similarity score between the first clause and the second clause based on the overall semantic similarity, the multi-level semantic similarity, and the global matching degree, and determine whether the second clause is a problematic clause based on the similarity score; The suggestion generation module is used to identify the problem category of the problem clause and generate corresponding correction suggestions according to the problem category.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Text similarity calculation method and computer-readable storage medium
CN107958061A
Contract audit method and device, computer apparatus and storage medium
CN109447105A
Text similarity calculation method and device, electronic equipment and readable storage medium
CN111027320A
Document analysis method and device, storage medium and processor
CN114564938A
Contract term risk check method, system and device and storage medium
CN116843175A