Legal decision semantic deviation recognition method based on artificial intelligence
Through artificial intelligence-based methods, semantic features are extracted from vocabulary, syntax and context levels, and a semantic deviation recognition model of Transformer architecture is constructed, which solves the problems of insufficient context perception of traditional legal text analytical methods and limited scope of application of semantic deviation recognition methods, and realizes high accuracy and consistency analysis of legal judgment documents.
Patent Information
- Application Number
- CN202510748230.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2045-06-06
AI Technical Summary
Traditional legal text analysis methods lack context perception ability, and it is difficult to accurately capture the semantic relationships between words and their meaning in specific scenarios, resulting in insufficient analytical capabilities; general semantic bias recognition methods lack the ability to recognize the reasoning logic implicitly in legal judgments, and their scope of application is limited, making it difficult to adapt to the automated analysis of different types of legal judgment documents.
Using an artificial intelligence-based method, semantic features are extracted from three levels of vocabulary, syntax and context, the overall semantic representation of judgment documents is enhanced through attention mechanism and dynamic context window mechanism, a semantic bias recognition model based on Transformer architecture is constructed, and the bias score of semantic units is calculated using an adaptive weight allocation mechanism.
It improves the detection accuracy and objectiveness and consistency of the scores of legal judgment documents, ensures that the semantic connections of each part are closely linked, captures long-term dependencies, avoids misjudgment, and adapts to the automated analysis of different types of legal judgment documents.
Smart Images

Figure CN120258002A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of legal informatization, and specifically refers to a method for identifying semantic deviations in legal judgments based on artificial intelligence. Background Art
[0002] As an important carrier of judicial decisions, the content of legal judgment documents usually involves complex legal provisions, factual descriptions, and logical reasoning processes. Traditional legal text parsing methods rely on rule matching. When dealing with complex legal texts, they lack sufficient context awareness and are difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing capabilities; general semantic deviation identification methods have insufficient recognition capabilities for the implicit reasoning logic in legal judgments, limited application ranges, poor scalability, and are difficult to adapt to the automated analysis of different types of legal judgment documents. Summary of the Invention
[0003] In view of the above situation, to overcome the defects of the prior art, the present invention provides a method for identifying semantic deviations in legal judgments based on artificial intelligence. Aiming at the problem that traditional legal text parsing methods rely on rule matching, lack sufficient context awareness when dealing with complex legal texts, are difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, and result in insufficient parsing capabilities, this solution extracts semantic features from three levels: vocabulary, syntax, and context, enhances the overall semantic representation of judgment documents through an attention mechanism and a dynamic context window mechanism, ensures that the semantic connections of each part are close, captures long-term dependence relationships, avoids misjudgments caused by a single semantic unit being out of context, and improves the accuracy of detection; aiming at the problem that general semantic deviation identification methods have insufficient recognition capabilities for the implicit reasoning logic in legal judgments, limited application ranges, poor scalability, and are difficult to adapt to the automated analysis of different types of legal judgment documents, this solution constructs a semantic deviation identification model based on the Transformer architecture, effectively identifies hidden semantic deviations through a deep semantic feature matrix, and uses an adaptive weight allocation mechanism to calculate the deviation scores of each semantic unit, improving the objectivity and consistency of the scores.
[0004] The technical solution adopted by the present invention is as follows: A method for identifying semantic deviations in legal judgments based on artificial intelligence provided by the present invention includes the following steps: Step S1: Data collection and preprocessing, collecting legal judgment documents, preprocessing and normalizing the legal judgment documents into a unified format; Step S2: Semantic unit segmentation, dividing the legal judgment document into semantic units, and annotating the logical relationships and semantic roles within each semantic unit; Step S3: Multi-level semantic parsing. Perform lexical semantic parsing, syntactic semantic parsing, and context semantic parsing on semantic units to construct a global semantic feature matrix; Step S4: Semantic deviation identification. Construct a semantic deviation identification model, calculate the deviation score of each semantic unit through the global semantic feature matrix, and output the deviation score matrix of the entire legal judgment document; Step S5: Judgment consistency evaluation. Calculate the judgment consistency evaluation result based on the deviation score matrix; Step S6: Result interpretation and application. Generate a semantic deviation identification report according to the judgment consistency evaluation result, mark the deviation area and provide improvement suggestions.
[0005] Furthermore, in Step S3, the multi-level semantic parsing specifically includes the following steps: Step S31: Lexical semantic parsing. Identify legal terms in semantic units, set the lexical weight of each word, and highlight the contributions of key logical relationships and semantic roles; Step S32: Syntactic semantic parsing. Check whether the syntactic logic between semantic units is consistent, parse the pronouns in semantic units, and aggregate the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector. The formula used is as follows: ; In the formula, represents the semantic unit index, represents the semantic unit, represents the semantic unit 's local semantic feature vector, represents the word index, represents the semantic unit contains the total number of words, represents the lexical weight, represents the word 's word vector representation; Step S33: Context semantic parsing. Analyze the semantic coherence of the entire legal judgment document, including the following steps: Step S331: Aggregate the local semantic feature vectors of all semantic units to form a global semantic feature matrix. The formula used is as follows: ; In the formula, represents the global semantic feature matrix, represents the total number of semantic units; Step S332: Adopt a sliding window mechanism to calculate the context importance of each semantic unit and enhance the context awareness ability of the global semantic feature matrix. The formula used is as follows: ; ; In the formula, represents the semantic unit the influence weight on , represents the context window matrix composed of influence weights, represents the parameter for controlling the window size, represents the enhanced global semantic feature matrix.
[0006] Furthermore, in step S4, the semantic deviation identification specifically includes the following steps: Step S41: Model construction, constructing a semantic deviation identification model based on the deep learning Transformer architecture, including an input layer, a Transformer encoding layer, a global attention layer, a deviation score calculation layer, and an output layer; Step S42: The input layer inputs the enhanced global semantic feature matrix; Step S43: The Transformer encoding layer processes the enhanced global semantic feature matrix. Each semantic unit serves as an input processing unit, and the attention weights of each input processing unit are aggregated and calculated through multi-head attention to obtain the deep semantic feature matrix. The formula used is as follows: ; In the formula, represents the deep semantic feature matrix, represents the Transformer encoding layer; Step S44: The global attention layer calculates the importance of each semantic unit using an attention weighting mechanism to generate the attention weights of each semantic unit. The formula used is as follows: ; In the formula, represents the th attention weight of the semantic unit, represents the deep semantic feature vector, represents the deviation detection function, represents the exponential function, represents the normalization function; Step S45: The deviation score calculation layer performs adaptive weight allocation, combines the deep semantic feature matrix and the attention weights of each semantic unit to calculate the deviation score of the semantic unit. The higher the deviation score, the greater the possibility that the semantic unit has a semantic deviation; Step S46: The output layer generates a deviation score matrix. The formula used is as follows: ; In the formula, Represents a semantic unit of the deviation score, represents the deviation score matrix.
[0007] Furthermore, in step S5, the judgment consistency evaluation is specifically as follows: Calculate the global deviation mean and standard deviation of the legal judgment document based on the deviation score matrix, and output the judgment consistency evaluation result. The formula used is as follows: ; ; ; In the formula, represents the judgment consistency evaluation result, and respectively represent the global deviation mean and standard deviation, and respectively represent the weight parameters.
[0008] The beneficial effects achieved by the present invention using the above solution are as follows: (1) Aiming at the problem that traditional legal text parsing methods rely on rule matching and lack sufficient context awareness when dealing with complex legal texts, making it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing ability. This solution extracts semantic features from three levels: vocabulary, syntax, and context, enhances the overall semantic representation of the judgment document through the attention mechanism and the dynamic context window mechanism, ensures that the semantic connections of each part are tight, captures long-term dependencies, avoids misjudgment caused by a single semantic unit being out of context, and improves the accuracy of detection.
[0009] (2) Aiming at the problem that general semantic deviation recognition methods have insufficient recognition ability for the implicit reasoning logic in legal judgments, limited application scope, poor scalability, and difficulty in adapting to the automated analysis of different types of legal judgment documents. This solution constructs a semantic deviation recognition model based on the Transformer architecture, effectively identifies hidden semantic deviations through the deep semantic feature matrix, and uses an adaptive weight allocation mechanism to calculate the deviation scores of each semantic unit, improving the objectivity and consistency of the scores. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic flowchart of a method for identifying semantic deviations in legal judgments based on artificial intelligence proposed by the present invention; Figure 2 is a schematic diagram of the construction of the global semantic feature matrix.
[0011] The accompanying drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention, and do not constitute a limitation to the present invention. Detailed Embodiments
[0012] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments; based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0013] Embodiment 1, refer to Figure 1 , a method for identifying semantic deviation in legal judgments based on artificial intelligence provided by the present invention, the method comprising the following steps: Step S1: Data collection and preprocessing, collecting legal judgment documents from a publicly available legal database, preprocessing the legal judgment documents and normalizing them into a unified format; Step S2: Semantic unit segmentation, dividing the legal judgment document into semantic units, and annotating the logical relationships and semantic roles within each semantic unit; Step S3: Multi-level semantic parsing, performing lexical semantic parsing, syntactic semantic parsing, and context semantic parsing on the semantic units, and constructing a global semantic feature matrix; Step S4: Semantic deviation identification, constructing a semantic deviation identification model, calculating the deviation score of each semantic unit through the global semantic feature matrix, and outputting the deviation score matrix of the entire legal judgment document; Step S5: Judgment consistency evaluation, calculating the judgment consistency evaluation result based on the deviation score matrix; Step S6: Result interpretation and application, generating a semantic deviation identification report according to the judgment consistency evaluation result, marking the deviation area and providing improvement suggestions.
[0014] Embodiment 2, refer to Figure 1 , this embodiment is based on the above embodiment. In step S2, semantic unit segmentation specifically includes the following steps: Step S21: Divide the legal judgment document into independent parsing objects according to sentence-level splitting, and each independent parsing object is a semantic unit; Step S22: Further divide the semantic unit into logical units to represent lexical sequences, annotate the logical relationships and semantic roles within each semantic unit, the logical relationships include factual statements, legal bases, adjudication viewpoints, adjudication conclusions, reasoning logics, and the semantic roles include parties, actions, time, place, legal provisions, evidence, and the formula used is as follows: ; In the formula, represents a semantic unit, represents the index of the semantic unit, represents the lexical sequence included in the semantic unit; Step S23: Store the segmented semantic units and their included logical relationships and semantic roles as structured data.
[0015] Example 3, refer to Figure 1 and Figure 2 , this example is based on the above example. In step S3, multi-level semantic parsing specifically includes the following steps: Step S31: Lexical semantic parsing. Based on a legal dictionary, identify legal terms in the semantic unit, set the lexical weight of each word, and highlight the contributions of key logical relationships and semantic roles; Step S32: Syntactic semantic parsing. Use rule-based logical reasoning to check whether the syntactic logic between semantic units is consistent, use the SpaCy anaphora resolution model to parse the pronouns in the semantic unit, and aggregate the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector. The formula used is as follows: ; In the formula, represents the semantic unit index, represents the semantic unit, represents the semantic unit 's local semantic feature vector, represents the lexical index, represents the semantic unit contains the total number of words, represents the lexical weight, represents the word 's word vector representation; Step S33: Context semantic parsing. Analyze the semantic coherence of the entire legal judgment document, including the following steps: Step S331: Aggregate the local semantic feature vectors of all semantic units to form a global semantic feature matrix. The formula used is as follows: ; In the formula, represents the global semantic feature matrix, represents the total number of semantic units; Step S332: Use a sliding window mechanism to calculate the context importance of each semantic unit and enhance the context awareness ability of the global semantic feature matrix. The formula used is as follows: ; ; In the formula, represents a semantic unit The influence weight on and represents the context window matrix composed of influence weights. represents the parameter for controlling the window size, represents the enhanced global semantic feature matrix.
[0016] By performing the above operations, for the problem that traditional legal text parsing methods rely on rule matching and lack sufficient context awareness when dealing with complex legal texts, making it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing ability, this solution extracts semantic features from three levels: vocabulary, syntax, and context, enhances the overall semantic representation of judgment documents through the attention mechanism and the dynamic context window mechanism, ensures that the semantic connections of each part are close, captures long-term dependencies, avoids misjudgment caused by a single semantic unit being out of context, and improves the accuracy of detection.
[0017] Example 4, refer to Figure 1 , based on the above example, in step S4, semantic deviation identification specifically includes the following steps: Step S41: Model construction, constructing a semantic deviation identification model based on the deep learning Transformer architecture, including an input layer, a Transformer encoding layer, a global attention layer, a deviation score calculation layer, and an output layer; Step S42: The input layer inputs the enhanced global semantic feature matrix; Step S43: The Transformer encoding layer processes the enhanced global semantic feature matrix. Each semantic unit serves as an input processing unit, and the attention weights of each input processing unit are calculated through multi-head attention aggregation to obtain the deep semantic feature matrix. The formula used is as follows: ; In the formula, represents the deep semantic feature matrix, represents the Transformer encoding layer; Step S44: The global attention layer uses the attention weighting mechanism to calculate the importance of each semantic unit and generates the attention weight of each semantic unit. The formula used is as follows: ; In the formula, represents the attention weight of the th semantic unit, represents the deep semantic feature vector, represents the deviation detection function, represents an exponential function, represents a normalization function; Step S45: The deviation score calculation layer performs adaptive weight allocation, and combines the deep semantic feature matrix and the attention weights of each semantic unit to calculate the deviation score of the semantic unit. The higher the deviation score, the greater the possibility that the semantic unit has a semantic deviation; Step S46: The output layer generates a deviation score matrix, and the formula used is as follows: ; In the formula, represents the deviation score of the semantic unit , represents the deviation score matrix.
[0018] By performing the above operations, aiming at the problems that the general semantic deviation recognition method has insufficient recognition ability for the inference logic hidden in legal judgments, limited application scope, poor scalability, and difficulty in adapting to the automated analysis of different types of legal judgment documents, this solution constructs a semantic deviation recognition model based on the Transformer architecture, effectively identifies hidden semantic deviations through the deep semantic feature matrix, and uses the adaptive weight allocation mechanism to calculate the deviation scores of each semantic unit, improving the objectivity and consistency of the scores.
[0019] Example Five, refer to Figure 1 , based on the above example, in step S5, the judgment consistency evaluation is specifically as follows: Calculate the global deviation mean and standard deviation of the legal judgment document based on the deviation score matrix, and output the judgment consistency evaluation result. The formula used is as follows: ; ; ; In the formula, represents the judgment consistency evaluation result, and respectively represent the global deviation mean and standard deviation, and respectively represent the weight parameters.
[0020] Example Six, refer to Figure 1 , based on the above example, in step S6, the result interpretation and application specifically include the following steps: Step S61: Generate a semantic deviation recognition report based on the judgment consistency evaluation result; Step S62: Put forward targeted optimization suggestions in combination with the deviation score matrix, including semantic correction, context supplementation, and logical reconstruction; Step S63: Present the optimization suggestions in a visual form.
[0021] It should be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device.
[0022] Although the embodiments of the present invention have been shown and described, those of ordinary skill in the art can understand that various changes, modifications, substitutions and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
[0023] The above describes the present invention and its implementation manners. Such description is not restrictive. What is shown in the drawings is only one of the implementation manners of the present invention, and the actual structure is not limited thereto. Generally speaking, if those of ordinary skill in the art are inspired by it and design, without creative efforts, structural manners and embodiments similar to the technical solution without departing from the purpose of the present invention, they shall fall within the protection scope of the present invention.
Claims
1. An artificial intelligence-based method for identifying semantic biases in legal judgments, characterized in that: The method includes the following steps: Step S1: Data collection and preprocessing. Collect legal judgment documents, preprocess the legal judgment documents and normalize them into a unified format; Step S2: Semantic unit segmentation. Divide the legal judgment documents into semantic units, and label the logical relationships and semantic roles inside each semantic unit; Step S3: Multi-level semantic parsing. Conduct lexical semantic parsing, syntactic semantic parsing and context semantic parsing on the semantic units, and construct a global semantic feature matrix; Step S4: Semantic deviation identification. Construct a semantic deviation identification model, calculate the deviation score of each semantic unit through the global semantic feature matrix, and output the deviation score matrix of the whole legal judgment document; Step S5: Judgment consistency evaluation. Calculate the judgment consistency evaluation result based on the deviation score matrix; Step S6: Result interpretation and application. Generate a semantic deviation identification report according to the judgment consistency evaluation result, mark the deviation area and provide improvement suggestions.
2. The method for identifying semantic deviation in legal judgments based on artificial intelligence according to claim 1, characterized in that: In step S3, the multi-level semantic parsing includes the following steps: Step S31: Lexical semantic parsing. Identify legal terms in the semantic units, set the lexical weight of each word, and highlight the contributions of key logical relationships and semantic roles; Step S32: Syntactic semantic parsing. Check whether the syntactic logic between semantic units is consistent, parse the pronouns in the semantic units, and aggregate the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector; Step S33: Context semantic parsing. Aggregate the local semantic feature vectors of all semantic units to form a global semantic feature matrix, and adopt a sliding window mechanism to enhance the context awareness ability of the global semantic feature matrix.
3. A semantic deviation recognition method for legal judgments based on artificial intelligence according to claim 1, characterized in that: In step S4, the semantic deviation identification includes the following steps: Step S41: Model construction. Construct a semantic deviation identification model based on the deep learning Transformer architecture, including an input layer, a Transformer encoding layer, a global attention layer, a deviation score calculation layer, and an output layer; Step S42: The input layer inputs the global semantic feature matrix; Step S43: The Transformer encoding layer processes the global semantic feature matrix. Each semantic unit serves as an input processing unit, and the attention weights of each input processing unit are calculated through multi-head attention aggregation to obtain a deep semantic feature matrix; Step S44: The global attention layer calculates the importance of each semantic unit by using an attention weighting mechanism and generates the attention weight of each semantic unit; Step S45: The deviation score calculation layer conducts adaptive weight allocation, combines the deep semantic feature matrix and the attention weight of each semantic unit to calculate the deviation score of the semantic unit. The higher the deviation score, the greater the possibility that the semantic unit has a semantic deviation; Step S46: The output layer generates a deviation score matrix, and the formula used is as follows: ; In the formula, represents the deviation score of the semantic unit , and represents the deviation score matrix.
4. The semantic deviation recognition method for legal judgments based on artificial intelligence according to claim 3, characterized in that: In step S5, the judgment consistency evaluation is specifically: Calculate the global deviation mean and standard deviation of the legal judgment document based on the deviation score matrix, and output the judgment consistency evaluation result. The formula used is as follows: ; wherein, represents the judgment consistency evaluation result, and respectively represent the global deviation mean and standard deviation, and respectively represent the weight parameters.
Citation Information
Patent Citations
Document association auditing method based on semantic analysis
CN111091009A
Contract and law consistency review method based on fine-grained semantic multi-task learning
CN119250077A
Real-time assessment of text consistency
US20200302011A1
Cited By
Medication curative effect evaluation model training method for rheumatism and immunology department
CN122348083A
Optimal transmission method based on structure tree logic and semantic hybrid constraint
CN122414331A