Multilingual contract intelligent comparison method, system, device and storage medium
By employing an intelligent comparison method for multilingual contracts, utilizing preprocessing and typo correction techniques, and combining semantic similarity and global matching degree calculations, problematic clauses in multilingual contracts are identified and corrected. This solves the problems of typos and translation errors caused by manual comparison, and achieves consistency and accuracy in contract content.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU INST OF TECH
- Filing Date
- 2025-04-24
- Publication Date
- 2026-05-08
AI Technical Summary
In cross-border business cooperation, the comparison process of multilingual contracts is subject to typos and translation errors caused by manual input, resulting in semantic discrepancies between different language versions of the contract. Furthermore, traditional comparison methods are time-consuming and labor-intensive.
A multilingual contract intelligent comparison method is adopted. Through preprocessing, typo correction, calculation of semantic similarity and global matching degree, problematic clauses are identified and correction suggestions are generated to ensure the consistency and accuracy of the contract.
It improves the accuracy and efficiency of multilingual contract comparison, reduces the impact of typos, ensures the consistency of contract content and semantic accuracy, and reduces legal risks.
Smart Images

Figure CN120449885B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of automated office technology, specifically relating to a method, system, device, and storage medium for intelligent comparison of multilingual contracts. Background Technology
[0002] In cross-border business cooperation, companies often need to sign multilingual contracts. Therefore, companies usually need to compare different language versions of the contract to ensure that the content is consistent.
[0003] However, manual input during contract drafting can introduce typos, reducing the accuracy of contract comparison and potentially leading to translation errors that result in semantic discrepancies between different language versions of the contract. Furthermore, traditional contract comparison methods typically involve manual comparison, which is time-consuming and labor-intensive. Summary of the Invention
[0004] The purpose of this invention is to provide a method, system, device, and storage medium for intelligent comparison of multilingual contracts, which can automatically compare multilingual contracts and ensure their consistency and accuracy.
[0005] The first aspect of this invention provides a method for intelligent comparison of multilingual contracts, wherein the multilingual contracts include 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 contract into the second language, comprising:
[0006] The first language version of the contract is preprocessed to obtain the first text content, and the second language version of the contract is preprocessed to obtain the second text content.
[0007] The first text content is corrected for typos to obtain the first corrected text, and the second text content is corrected for typos to obtain the second corrected text;
[0008] 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, wherein the second clause is a clause that translates the first clause into a second language, and calculate the global matching degree between the first corrected text and the second corrected text;
[0009] Based on the overall semantic similarity, multi-level semantic similarity, and global matching degree, a similarity score is calculated between the first clause and the second clause. Based on the similarity score, it is determined whether the second clause is a problematic clause.
[0010] Identify the problem category of the problematic clause and generate corresponding correction suggestions based on the problem category.
[0011] In some embodiments, calculating the multi-level semantic similarity between the first clause and the clauses of the second corrected text includes:
[0012] Calculate word similarity, phrase similarity, and sentence similarity between the first clause and the second clause;
[0013] The mean values of word similarity, phrase similarity, and sentence similarity are 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 in the first clause into a first word vector to obtain the first word vector set;
[0016] Convert each word in the second clause into a second word vector to obtain a second word vector set;
[0017] 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.
[0018] The calculation of phrase similarity between the first clause and the second clause includes:
[0019] Each phrase in the first clause is converted into a weighted first phrase vector to obtain a set of first phrase vectors;
[0020] Each phrase in the second clause is converted into a weighted second phrase vector to obtain a set of second phrase vectors;
[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 to obtain the phrase similarity between the first and second terms.
[0022] In some embodiments, calculating the global matching degree between the first corrected text and the second corrected text includes:
[0023] Each sentence in the first corrected text is converted into a first sentence vector. Max pooling is performed on all first sentence vectors to obtain the maximum value of each dimension. The maximum value of all dimensions constitutes the first key semantic feature.
[0024] Each sentence in the second corrected text is converted into a second sentence vector. Max pooling is then performed on all second sentence vectors to obtain the maximum value of each dimension. The maximum values of all dimensions constitute the second key semantic feature.
[0025] Calculate the cosine similarity between the first key semantic feature and the second key semantic feature to obtain the global matching degree.
[0026] In some embodiments, the contract is preprocessed to obtain text content. When the contract is a first language version, the text content is first text content; when the contract is a second language version, the text content is second text content, including:
[0027] The scanned copy of the contract is preprocessed to obtain the corresponding image;
[0028] The image is analyzed and segmented to obtain text areas, table areas, and image areas. The image areas include: images, headers / footers, invalid characters, official seals, signatures, etc.
[0029] The text region is converted to obtain text. Regular expressions are used to identify the clause levels in the text. An NLP model is used to identify title keywords in the text with identified clause levels to obtain semantic titles for each clause level. A tree structure of the text is generated based on the parent-child relationship of the clause levels. Hierarchical text is generated based on the tree structure and the semantic titles of each clause level.
[0030] The table area is identified to determine the row, column, and cell structure, and the table structure is reconstructed.
[0031] The hierarchical text and the corresponding table structure are merged to obtain the text content.
[0032] In some embodiments, correcting typos in text content yields corrected text. When the text content is a first text content, the corrected text is the first corrected text; when the text content is a second text content, the corrected text is the second corrected text. This includes:
[0033] The word similarity between the text content and the words in the industry thesaurus 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, w represents the words in the text content, t represents the words in the industry thesaurus, Lev(w,t) represents the edit distance between word w and word t, max(|w|,|t|) represents taking the maximum value of the string length between word w and word t, EmbSim(w,t) represents the cosine similarity between the word vector of word w and the word vector of word t, XLSA(w,t) represents the cosine similarity between the embedding vector of word w and the embedding vector of word t, λ1 represents the first weight, λ2 represents the second weight, λ3 represents the third weight, and SC(w,t) represents the similarity between word w and word t;
[0037] If the word similarity is greater than the correction threshold, the words in the text content are replaced with words from the industry thesaurus to obtain the corrected text.
[0038] In some embodiments, identifying the problem category of the problem clause includes:
[0039] Determine whether the word similarity between the first and second clauses in the problematic clauses is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, the problem category is determined to be translation deviation.
[0040] Keyword extraction is performed on the first and second clauses of the problematic clauses. The keywords of the second clause are compared 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 of the second clause.
[0041] Using an industry legal dictionary, check whether different legal terms are used between Article 1 and Article 2. If so, the problem category is determined to be a change in terminology.
[0042] Dependency parsing is performed on the first and second clauses to determine whether there is a difference in the grammatical relation structure between the first and second clauses. If so, the problem category is determined to be grammatical adjustment.
[0043] A second aspect of this 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 contract into the second language, comprising:
[0044] The preprocessing module is used to preprocess the first language version contract to obtain the first text content, and to preprocess the second language version contract to obtain the second text content.
[0045] The correction module is used to correct typos in the first text content to obtain the first corrected text, and to correct typos in the second text content to obtain the second corrected text;
[0046] The calculation module is used to 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, wherein the second clause is a clause that translates the first clause into a second language, and to calculate the global matching degree between the first corrected text and the second corrected text.
[0047] The calculation and judgment module is used to calculate 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, and to 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 based on the problem category.
[0049] A third aspect of the present invention provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described above.
[0050] A fourth aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method described above.
[0051] The technical solution provided by this invention has the following advantages and effects: by correcting typos in different language versions of contracts, the correctness of spelling and terminology is ensured, thereby reducing the impact of typos on subsequent comparisons. By calculating the overall semantic similarity and multi-level semantic similarity of contract clauses, as well as the global matching degree of the contracts, 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 contracts are marked, and modification suggestions are provided, thereby ensuring the consistency and accuracy of multilingual contracts. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating the intelligent comparison method for multilingual contracts 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 This is an internal structural diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[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 terms "first," "second," etc., used in this document are for distinguishing names only and do not represent a specific number or order.
[0057] Unless otherwise stated or defined, 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 article, "fixed to" or "connected to" can mean directly fixed to or connected to a component, or indirectly fixed to or connected to a component.
[0059] like Figure 1 As shown, this embodiment provides a multilingual contract intelligent comparison method, including the following steps S10 to S50:
[0060] Step S10: Preprocess the first language version of the contract to obtain the first text content, and preprocess the second language version of the contract to obtain the second text content.
[0061] In practical applications, the multilingual contract version includes at least a first-language version and a second-language version. Multilingual contracts are typically paper contracts, and scanned copies are obtained by scanning the paper contracts. Multilingual contracts are not limited to first-language and second-language versions; they can include third-language and fourth-language versions, etc. The second, third, and fourth-language versions are all translations of the first-language version. When comparing contracts, the second, third, and fourth-language versions are sequentially compared with the first-language version.
[0062] Specifically, the preprocessing steps include:
[0063] Image preprocessing, such as denoising and binarization, is performed on the scanned copies of the first language version contract and the second language version contract to obtain the corresponding first image and second image.
[0064] The first image and the second image are analyzed and segmented into regions to obtain the text region, table region and image region of the first image, and the text region, table region and image region of the second image. The image region includes: image, header / footer, invalid characters, official seal, signature, etc.
[0065] The text regions of the first and second images are transformed to obtain the first and second texts. Then, regular expressions are used to identify the clause levels of the first and second texts. Next, an NLP model is used to identify the title keywords of the first and second texts with identified clause levels to obtain the semantic titles of each clause level in the first and second texts. A tree structure of the first and second texts is generated according to the parent-child relationship of the clause levels, thereby outputting the first-level text of the first text and the second-level text of the second text, thus preserving the hierarchical structure of the multilingual version of the contract.
[0066] The CascadeTabNet model is used to identify the row, column and cell structure of the table regions in the first and second images, and reconstruct the complete structure of the table to obtain the table of the first language version contract and the table of the second language version contract, thus preserving the table structure.
[0067] The first level of text and its corresponding table structure are merged to obtain the first text content, and the second level of text and its corresponding table structure are merged to obtain the second text content.
[0068] Step S20: Correct the first text content for typos to obtain the first corrected text, and correct the second text content for typos to obtain the second corrected text.
[0069] In practical applications, by correcting typos in the first and second text content, we can reduce typos generated during contract drafting and typos caused by identification errors during preprocessing, thereby improving the accuracy of subsequent comparison between the first and second language contracts.
[0070] Specifically, step S20 includes the following steps:
[0071] The corrected text is obtained by correcting typos in the text content. When the text content is the first text content, the corrected text is the first corrected text; when the text content is the second text content, the corrected text is the second corrected text, including:
[0072] The word similarity between the text content and the words in the industry thesaurus is calculated using a first similarity calculation formula, 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, w represents the words in the text content, t represents the words in the industry thesaurus, Lev(w,t) represents the edit distance between word w and word t, max(|w|,|t|) represents taking the maximum value of the string length between word w and word t, EmbSim(w,t) represents the cosine similarity between the word vector of word w and the word vector of word t, XLSA(w,t) represents the cosine similarity between the embedding vector of word w and the embedding vector of word t, λ1 represents the first weight, λ2 represents the second weight, λ3 represents the third weight, and SC(w,t) represents the similarity between word w and word t;
[0076] When the text content is the first text content, the industry thesaurus is the first industry thesaurus, and the word similarity is the first similarity. When the text content is the second text content, the industry thesaurus is the second industry thesaurus, and the word similarity is the second similarity. If the first similarity is greater than the correction threshold, the words in the first text content are replaced with words from the first industry thesaurus to obtain the first corrected text. If the second similarity is greater than the correction threshold, the words in the second text content are replaced with words from the second industry thesaurus to obtain the second corrected text.
[0077] In practical applications, an industry thesaurus 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 thesauruses can be pre-built according to different languages; for example, the terms in the first industry thesaurus are represented in the first language version, while the terms in the second industry thesaurus are represented in the second language version.
[0078] After constructing the corresponding industry word library, select the corresponding industry word library according to the languages of the first text content and the second text content. The industry word library corresponding to the first text content is the first industry word library, and the industry word library corresponding to the second text content is the second industry word library. Traverse all the words in the first text content. Take the word in the first text content as w and the words in the first industry word library 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 word library in turn. When there is a first similarity greater than the correction threshold, replace the word w corresponding to this first similarity with the word t to achieve the correction of typos in the first text content. The method for correcting typos 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 word in the second text content as w and the words in the second industry word library 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 word library in turn. When there is a second similarity greater than the correction threshold, replace the word w corresponding to this second similarity with the word t to achieve the correction of typos 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. The edit distance similarity is calculated in this way. 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 correcting typos, so as to decide whether to replace.
[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 it is to 1, the closer the semantics are. 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 typo).
[0081] The embedding vectors of words w and t are calculated using a pre-defined cross-language model, which can be the XLM-R model in existing technologies. Then, the similarity between the embedding vectors of words w and t is calculated to obtain the embedding vector similarity between words w and t. The embedding vector similarity represents the similarity obtained by relating words w and t to their context, which makes up for the lack of contextual relationship in word vector similarity.
[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 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 completely the same and no replacement is needed. If they are completely different, there is a high probability that there is no spelling error and usually no replacement is needed. If they are relatively similar but still have some difference, further judgment is required. Therefore, the first weight is greater than the second and third weights. Edit distance similarity is the main judgment criterion and can more directly reflect whether there is a spelling error. Word vector similarity and embedding vector similarity are secondary judgment criteria and play an auxiliary role when edit distance similarity is difficult to determine whether there is a spelling error, thus improving the accuracy of misspelling recognition. For example, w = "cat" and t = "car" have a high edit distance similarity, but there is still a gap. Further judgment is made by word vector similarity and embedding vector similarity. That is, the similarity of "cat" and "car" in fixed meaning and the semantic similarity of "cat" and "car" in 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, wherein the second clause is a clause that translates 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 and second clauses are calculated, as well as the global matching degree between the first and second corrected texts. This facilitates the subsequent calculation of the similarity score between the first and second clauses based on the overall semantic similarity, multi-level semantic similarity, and global matching degree. By comprehensively evaluating the similarity score between the first and second clauses from multiple dimensions, the accuracy of the similarity score can be improved.
[0085] Specifically, calculating the overall semantic similarity between the first clause and the second clause includes:
[0086] The first embedding vector corresponding to the first clause is generated using a pre-defined cross-language model, and the second embedding vector corresponding to the second clause is generated.
[0087] Calculate the cosine similarity between the first and second embedding vectors 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 and second embedding vectors are dynamically adjusted according to the context, thereby combining the context to obtain the overall semantics of the first and second clauses. By calculating the cosine similarity between the first and second embedding vectors, the overall semantic similarity between the first and second clauses is obtained.
[0089] Specifically, the calculation of the multi-level semantic similarity between the first clause and the clauses of the second corrected text includes:
[0090] Calculate the word similarity, phrase similarity, and sentence similarity between the first clause and the second clause;
[0091] The mean values of word similarity, phrase similarity, and sentence similarity are calculated to obtain multi-level semantic similarity.
[0092] In practical applications, multi-level semantic similarity is obtained by averaging word similarity, phrase similarity, and sentence similarity. This allows for the evaluation of the semantic similarity between the first and second clauses across three dimensions: word, phrase, and sentence. Multi-level semantic fusion (word, phrase, and sentence level) captures deeper semantic information. By integrating semantic information at these levels, a richer and more globally comprehensible semantic representation is generated, ultimately improving the accuracy of multilingual contract clause matching.
[0093] Specifically, the calculation of word similarity between the first clause and the second clause includes:
[0094] Convert each word in the first clause into a first word vector to obtain the first word vector set;
[0095] Convert each word in 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. Use the maximum cosine similarity as the word vector similarity of each word. Calculate the mean of the word vector similarities to 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", "resistance", "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 value 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;
[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 value 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 transform the phrases in the first and second clauses 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, forming a phrase similarity matrix. The rows of this 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 examined. This maximum value is the similarity value of the most similar phrase pair found in the second phrase vector set, which is the phrase vector similarity of that phrase. Finally, the mean of the phrase vector similarities of all phrases in the first phrase vector set is calculated to obtain the word similarity between the first and second clauses. By using TF-IDF vectorization and cosine similarity calculation, the formal and partial semantic similarity between phrases can be efficiently quantified. Furthermore, by using the maximum matching method, the most similar phrase pair is selected, and the maximum value is taken as the final result, highlighting the core phrases. This allows the system to recognize phrases in the first and second clauses of the contract even if their expressions are different, as long as their semantics are similar, thus preventing the omission of key clauses.
[0103] Specifically, calculating the global matching degree between the first corrected text and the second corrected text includes:
[0104] Each sentence in the first corrected text is converted into a first sentence vector. Max pooling is performed on all first sentence vectors to obtain the maximum value of each dimension. The maximum value of all dimensions constitutes the first key semantic feature.
[0105] Each sentence in the second corrected text is converted into a second sentence vector. Max pooling is then performed on all second sentence vectors to obtain the maximum value of each dimension. The maximum values of all dimensions constitute the second key semantic feature.
[0106] Calculate the cosine similarity between the first key semantic feature and the second key semantic feature to obtain the global matching degree.
[0107] In practical applications, the Sentence-BERT model is used to transform each sentence in the first and second proofreading texts into first sentence vectors and second sentence vectors, respectively. The first sentence vector captures the semantic information of sentences in the first proofreading text, and the second sentence vector captures the semantic information of sentences in the second proofreading text. The "most salient" parts are extracted from all the first and second sentence vectors, which is equivalent to performing max pooling on the first and second sentence vectors. Specifically, if contract S1 has N sentences, each sentence has a 768-dimensional vector, represented as {h1, h2, ..., h... N}(h i∈R 768 For each sentence, the maximum value of each dimension is taken, resulting in a 768-dimensional vector. During max pooling, the maximum value of each dimension is extracted from all sentence vectors in contract S1 to form a contract-level semantic vector. The specific formula is as follows:
[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 Let represent the j-th dimension of the vector of the ii-th sentence. For example, consider contract S1 with 3 sentences and a vector dimension of 3:
[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] The congruent vector after max pooling is: [0.8, 0.9, 0.7]
[0114] Max pooling preserves the strongest semantic signals in the contract, representing its key semantic features. 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 secondary information, such as common expressions in standard clauses, improving noise resistance. Regardless of the number of sentences in the contract, the output vector dimension remains fixed (e.g., 768 dimensions), facilitating subsequent computation.
[0115] Step S40: Calculate 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, 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 obtain the similarity score. The second similarity calculation formula is as follows:
[0117] Sim(T1,T2)=α*XLSA(T1,T2)+β*HSF(T1,T2)+γ*CAA(S1,S2)
[0118] Wherein, 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 matching degree 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 optimized according to different contract types.
[0119] According to the second similarity calculation formula, after calculating the similarity score, the similarity score is compared with the similarity threshold. If 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 based on the problem category.
[0121] Specifically, the problem categories for identifying the problematic clauses include:
[0122] Determine whether the word similarity between the first and second clauses in the problematic clauses is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, the problem category is determined to be translation deviation.
[0123] Keyword extraction is performed on the first and second clauses of the problematic clauses. The keywords of the second clause are compared 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 of the second clause.
[0124] Using an industry legal dictionary, check whether different legal terms are used between Article 1 and Article 2. If so, the problem category is determined to be a change in terminology.
[0125] Dependency parsing is performed on the first and second clauses to determine whether there is a difference in the grammatical relation structure between the first and second clauses. If so, the problem category is determined to be grammatical adjustment.
[0126] In practical applications, by comprehensively analyzing various problem categories, the system can accurately pinpoint clause defects, propose targeted correction suggestions, and generate a problem category report for clauses with low similarity. See the table below:
[0127]
[0128]
[0129] The generated issue category reports are used for subsequent manual or AI-based optimization and correction, ensuring the consistency and accuracy of contract terms, improving contract review efficiency, reducing legal risks, and protecting the rights and interests of both parties.
[0130] The multilingual contract intelligent comparison method of the present invention ensures the correctness of spelling and terminology by correcting typos in different language versions of the contract, 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 clauses, as well as the global matching degree of the contract. Based on the similarity, it determines whether there are problematic clauses. If there are problematic clauses, it identifies the problem category, generates correction suggestions, marks the semantic differences in the contract, and provides modification suggestions to ensure the consistency and accuracy of cross-language contracts.
[0131] like Figure 2 As shown, this embodiment of the invention also 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 contract into the second language, including:
[0132] Preprocessing module 1 is used to preprocess the first language version contract to obtain the first text content, and to preprocess the second language version contract to obtain the second text content.
[0133] Correction module 2 is used to correct typos in the first text content to obtain the first corrected text, and to correct typos in the second text content to obtain the second corrected text;
[0134] The calculation module 3 is used to 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, wherein the second clause is a clause that translates the first clause into a second language, and to calculate the global matching degree between the first corrected text and the second corrected text.
[0135] The calculation and judgment module 4 is used to calculate 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, and to determine whether the second clause is a problematic clause based on the similarity score.
[0136] The suggestion generation module 5 is used to identify the problem category of the problem clause and generate corresponding correction suggestions based on the problem category.
[0137] The modules of the aforementioned multilingual contract intelligent comparison system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules and units can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as 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 can be a server, and its internal structure diagram can 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 provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it 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 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0141] This invention also discloses a computer-readable storage medium storing a computer program that causes a computer to execute the multilingual contract intelligent comparison method described in the above embodiments.
[0142] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, 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), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0143] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 method for intelligent comparison of multilingual contracts, wherein the multilingual contracts include 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 contract into the second language, characterized by comprising: The first language version of the contract is preprocessed to obtain the first text content, and the second language version of the contract is preprocessed to obtain the second text content; The first text content is corrected for typos to obtain the first corrected text, and the second text content is corrected for typos to obtain the second corrected text; 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, wherein the second clause is a clause that translates the first clause into a second language, and calculate the global matching degree between the first corrected text and the second corrected text; Based on the overall semantic similarity, multi-level semantic similarity, and global matching degree, a similarity score is calculated between the first clause and the second clause. Based on the similarity score, it is determined whether the second clause is a problematic clause. Identify the problem category of the problematic clauses and generate corresponding correction suggestions based on the problem category; The calculation of the multi-level semantic similarity between the first clause and the clauses of the second corrected text includes: Calculate word similarity, phrase similarity, and sentence similarity between the first clause and the second clause; Calculate the mean values of word similarity, phrase similarity, and sentence similarity to obtain multi-level semantic similarity; The corrected text is obtained by correcting typos in the text content. When the text content is the first text content, the corrected text is the first corrected text; when the text content is the second text content, the corrected text is the second corrected text, including: The word similarity between the text content and the words in the industry thesaurus is calculated using a first similarity calculation formula, wherein the first similarity calculation formula is: ; ; Wherein, w represents the words in the text content, t represents the words in the industry thesaurus, and the... The edit distance between word w and word t is described as follows. This indicates taking the maximum string length between word w and word t. The cosine similarity between the word vector of word w and the word vector of word t is denoted as t. The cosine similarity between the embedding vectors of word w and word t is represented by the following expression: First weight, the aforementioned Indicates the second weight, the Indicates the third weight, the Indicates the similarity between word w and word t; If the word similarity is greater than the correction threshold, the words in the text content are replaced with words from the industry thesaurus to obtain the corrected text.
2. The multilingual contract intelligent comparison method as described in claim 1, characterized in that, The calculation of word similarity between the first clause and the second clause includes: Convert each word in the first clause into a first word vector to obtain the first word vector set; Convert each word in the second clause into a second word vector to obtain a second word vector set; 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. The calculation of phrase similarity between the first clause and the second clause includes: Each phrase in the first clause is converted into a weighted first phrase vector to obtain a set of first phrase vectors; Each phrase in the second clause is converted into a weighted second phrase vector to obtain a set of second phrase vectors; 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 to obtain the phrase similarity between the first and second terms.
3. The multilingual contract intelligent comparison method as described in claim 1, characterized in that, The calculation of the global matching degree between the first corrected text and the second corrected text includes: Each sentence in the first corrected text is converted into a first sentence vector. Max pooling is performed on all first sentence vectors to obtain the maximum value of each dimension. The maximum value of all dimensions constitutes the first key semantic feature. Each sentence in the second corrected text is converted into a second sentence vector. Max pooling is then performed on all second sentence vectors to obtain the maximum value of each dimension. The maximum values of all dimensions constitute the second key semantic feature. Calculate the cosine similarity between the first key semantic feature and the second key semantic feature to obtain the global matching degree.
4. The multilingual contract intelligent comparison method as described in claim 1, characterized in that, The contract is preprocessed to obtain text content. When the contract is in its first language version, the text content is the first text content; when the contract is in its second language version, the text content is the second text content, including: The scanned copy of the contract is preprocessed to obtain the corresponding image; The image is analyzed and segmented to obtain text areas, table areas, and image areas. The image areas include: images, headers / footers, invalid characters, official seals, signatures, etc. The text region is converted to obtain text. Regular expressions are used to identify the clause levels in the text. An NLP model is used to identify title keywords in the text with identified clause levels to obtain semantic titles for each clause level. A tree structure of the text is generated based on the parent-child relationship of the clause levels. Hierarchical text is generated based on the tree structure and the semantic titles of each clause level. The table area is identified to determine the row, column, and cell structure, and the table structure is reconstructed. The hierarchical text and the corresponding table structure are merged to obtain the text content.
5. The multilingual contract intelligent comparison method as described in claim 1, characterized in that, The categories of issues for identifying the problematic clauses include: Determine whether the word similarity between the first and second clauses in the problematic clauses is lower than the phrase similarity and sentence similarity, and whether the overall semantic similarity is lower than a preset threshold. If so, the problem category is determined to be translation deviation. Keyword extraction is performed on the first and second clauses of the problematic clauses. The keywords of the second clause are compared 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 of the second clause. Using an industry legal dictionary, check whether different legal terms are used between Article 1 and Article 2. If so, the problem category is determined to be a change in terminology. Dependency parsing is performed on the first and second clauses to determine whether there is a difference in the grammatical relation structure between the first and second clauses. If so, the problem category is determined to be grammatical adjustment.
6. A multilingual contract intelligent comparison system, wherein the multilingual contracts include 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 contract into the second language, characterized by comprising: The preprocessing module is used to preprocess the first language version contract to obtain the first text content, and to preprocess the second language version contract to obtain the second text content. The correction module is used to correct typos in the first text content to obtain the first corrected text, and to correct typos in the second text content to obtain the second corrected text; The calculation module is used to 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, wherein the second clause is a clause that translates the first clause into a second language, and to calculate the global matching degree between the first corrected text and the second corrected text. The calculation and judgment module is used to calculate 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, and to 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 based on the problem category; The calculation of the multi-level semantic similarity between the first clause and the clauses of the second corrected text includes: Calculate word similarity, phrase similarity, and sentence similarity between the first clause and the second clause; Calculate the mean values of word similarity, phrase similarity, and sentence similarity to obtain multi-level semantic similarity; The corrected text is obtained by correcting typos in the text content. When the text content is the first text content, the corrected text is the first corrected text; when the text content is the second text content, the corrected text is the second corrected text, including: The word similarity between the text content and the words in the industry thesaurus is calculated using a first similarity calculation formula, wherein the first similarity calculation formula is: ; ; Wherein, w represents the words in the text content, t represents the words in the industry thesaurus, and the... The edit distance between word w and word t is described as follows. This indicates taking the maximum string length between word w and word t. The cosine similarity between the word vector of word w and the word vector of word t is denoted as t. The cosine similarity between the embedding vectors of word w and word t is represented by the following expression: First weight, the aforementioned Indicates the second weight, the Indicates the third weight, the Indicates the similarity between word w and word t; If the word similarity is greater than the correction threshold, the words in the text content are replaced with words from the industry thesaurus to obtain the corrected text.
7. 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, it implements the steps of the method according to any one of claims 1-5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-5.
Citation Information
Patent Citations
Text similarity calculation method and computer-readable storage medium
CN107958061A
Document analysis method and device, storage medium and processor
CN114564938A
Translation quality evaluation device and method
WO2024136377A1