An artificial intelligence-based method for identifying semantic deviations in legal judgments
By extracting semantic features from the vocabulary, syntax and context levels in legal judgment documents, and constructing a semantic deviation recognition model of Transformer architecture, the problems of insufficient context perception and insufficient inference logic recognition capabilities in traditional methods are solved, and high-precision and widely applicable semantic deviation recognition are achieved.
Patent Information
- Application Number
- CN202510748230.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-06
- Publication Date
- 2025-09-02
- 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 CN120258002B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of legal information technology, and specifically to an artificial intelligence-based method for identifying semantic deviations in legal judgments. Background Art
[0002] Legal judgment documents are important carriers of judicial decision-making, and their contents usually involve complex legal provisions, factual descriptions, and logical reasoning processes. Traditional legal text parsing methods rely on rule matching. When processing complex legal texts, they lack sufficient context perception capabilities and find it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing capabilities. General semantic deviation recognition methods have insufficient recognition capabilities for the reasoning logic implicit in legal judgments, have a limited scope of application, and poor scalability, making them difficult to adapt to the automated analysis of different types of legal judgment documents. Summary of the Invention
[0003] In response to the above situation, in order to overcome the shortcomings of the existing technology, the present invention provides an artificial intelligence-based method for identifying semantic deviations in legal judgments. Traditional legal text parsing methods rely on rule matching. When processing complex legal texts, they lack sufficient context perception capabilities and find it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing capabilities. This solution extracts semantic features from three levels: vocabulary, syntax, and context. It enhances the overall semantic representation of judgment documents through attention mechanisms and dynamic context window mechanisms, ensures that the semantic connections between various parts are close, captures long-term dependencies, avoids misjudgments caused by a single semantic unit being out of context, and improves detection accuracy. In response to the problem that general semantic deviation recognition methods have insufficient recognition capabilities for the reasoning logic implicit in legal judgments, have a limited scope of application, poor scalability, and are difficult to adapt 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 a deep semantic feature matrix, and uses an adaptive weight distribution mechanism to calculate the deviation score of each semantic unit, thereby improving the objectivity and consistency of the score.
[0004] The technical solution adopted by the present invention is as follows: The present invention provides a method for identifying semantic deviations in legal judgments based on artificial intelligence, the method comprising the following steps:
[0005] Step S1: Data collection and preprocessing: collecting legal judgment documents, preprocessing the legal judgment documents and normalizing them into a unified format;
[0006] Step S2: Semantic unit segmentation: divide the legal judgment document into semantic units and mark the logical relationship and semantic role within each semantic unit;
[0007] Step S3: Multi-level semantic analysis, which performs lexical semantic analysis, syntactic semantic analysis, and contextual semantic analysis on semantic units to construct a global semantic feature matrix;
[0008] Step S4: semantic deviation identification, building 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;
[0009] Step S5: Decision consistency evaluation, calculating the decision consistency evaluation result based on the deviation scoring matrix;
[0010] Step S6: Result interpretation and application: Generate a semantic deviation identification report based on the judgment consistency assessment results, mark the deviation areas and provide improvement suggestions.
[0011] Furthermore, in step S3, the multi-level semantic parsing specifically includes the following steps:
[0012] Step S31: Lexical semantic analysis, identifying legal terms in semantic units, setting lexical weights for each word, and highlighting the contributions of key logical relationships and semantic roles;
[0013] Step S32: Syntactic and semantic analysis, checking whether the syntactic logic between semantic units is consistent, parsing the pronouns in the semantic units, and aggregating the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector. The formula used is as follows:
[0014] ;
[0015] Where, Represents the semantic unit index, Represents a semantic unit, Representing semantic units The local semantic feature vector of Represents a vocabulary index, Representing semantic units The total number of words included, represents the vocabulary weight, Expressing vocabulary The word vector representation of ;
[0016] Step S33: Contextual semantic analysis, analyzing the semantic coherence of the entire legal judgment document, including the following steps:
[0017] 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:
[0018] ;
[0019] Where, represents the global semantic feature matrix, Indicates the total number of semantic units;
[0020] Step S332: Calculate the contextual importance of each semantic unit using a sliding window mechanism to enhance the contextual awareness of the global semantic feature matrix. The formula used is as follows:
[0021] ;
[0022] ;
[0023] Where, Representing semantic units right The influence weight of represents the context window matrix consisting of influence weights, Indicates the parameters that control the window size, Represents the enhanced global semantic feature matrix.
[0024] Furthermore, in step S4, the semantic deviation identification specifically includes the following steps:
[0025] Step S41: Model construction, building a semantic deviation recognition 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;
[0026] Step S42: the input layer inputs the enhanced global semantic feature matrix;
[0027] Step S43: The Transformer encoding layer processes the enhanced global semantic feature matrix. Each semantic unit is used as an input processing unit. The attention weight of each input processing unit is calculated through multi-head attention aggregation to obtain the deep semantic feature matrix. The formula used is as follows:
[0028] ;
[0029] Where, represents the deep semantic feature matrix, Represents the Transformer encoding layer;
[0030] 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:
[0031] ;
[0032] Where, Indicates the The 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;
[0033] Step S45: The deviation score calculation layer performs adaptive weight allocation, combining 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 semantic deviation.
[0034] Step S46: The output layer generates a bias score matrix using the following formula:
[0035] ;
[0036] Where, Representing semantic units The deviation score, represents the bias score matrix.
[0037] Furthermore, in step S5, the judgment consistency assessment is specifically performed by calculating the global deviation mean and standard deviation of the legal judgment documents based on the deviation scoring matrix, and outputting the judgment consistency assessment result. The formula used is as follows:
[0038] ;
[0039] ;
[0040] ;
[0041] Where, represents the judgment consistency evaluation result, and denote the global mean and standard deviation respectively, and Represent the weight parameters respectively.
[0042] The beneficial effects achieved by the present invention using the above scheme are as follows:
[0043] (1) Traditional legal text parsing methods rely on rule matching. When processing complex legal texts, they lack sufficient context perception capabilities and find it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing capabilities. This solution extracts semantic features from three levels: vocabulary, syntax, and context. It enhances the overall semantic representation of judgment documents through attention mechanisms and dynamic context window mechanisms, ensuring that the semantic connections between various parts are close, capturing long-term dependencies, avoiding misjudgments caused by single semantic units being out of context, and improving detection accuracy.
[0044] (2) In response to the problems that general semantic deviation identification methods are insufficient in identifying the reasoning logic implicit in legal judgments, have a limited scope of application, poor scalability, and are difficult to adapt to the automated analysis of different types of legal judgment documents, this solution builds 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 score of each semantic unit, thereby improving the objectivity and consistency of the score. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 This is a flowchart of a method for identifying semantic deviations in legal judgments based on artificial intelligence proposed by the present invention;
[0046] Figure 2 Schematic diagram of the construction of the global semantic feature matrix.
[0047] The accompanying drawings are used to provide further understanding of the present invention and constitute a part of the specification. They are used to explain the present invention together with the embodiments of the present invention and do not constitute a limitation of the present invention. DETAILED DESCRIPTION
[0048] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] Example 1, see Figure 1 The present invention provides an artificial intelligence-based method for identifying semantic deviations in legal judgments, which includes the following steps:
[0050] Step S1: Data collection and preprocessing: collecting legal judgment documents from public legal databases, preprocessing the legal judgment documents and normalizing them into a unified format;
[0051] Step S2: Semantic unit segmentation: divide the legal judgment document into semantic units and mark the logical relationship and semantic role within each semantic unit;
[0052] Step S3: Multi-level semantic analysis, which performs lexical semantic analysis, syntactic semantic analysis, and contextual semantic analysis on semantic units to construct a global semantic feature matrix;
[0053] Step S4: semantic deviation identification, building 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;
[0054] Step S5: Decision consistency evaluation, calculating the decision consistency evaluation result based on the deviation scoring matrix;
[0055] Step S6: Result interpretation and application: Generate a semantic deviation identification report based on the judgment consistency assessment results, mark the deviation areas and provide improvement suggestions.
[0056] Example 2, see Figure 1 This embodiment is based on the above embodiment. In step S2, semantic unit segmentation specifically includes the following steps:
[0057] Step S21: Divide the legal judgment document into independent parsing objects according to sentence level splitting, where each independent parsing object is a semantic unit;
[0058] Step S22: The semantic units are further divided into logical units to represent the vocabulary sequence, and the logical relationships and semantic roles within each semantic unit are marked. The logical relationships include factual statements, legal basis, adjudication opinions, ruling conclusions, and reasoning logic. The semantic roles include parties, behavior, time, place, legal provisions, and evidence. The formula used is as follows:
[0059] ;
[0060] Where, Represents a semantic unit, Represents the index of the semantic unit, Indicates the vocabulary sequence contained in the semantic unit;
[0061] Step S23: storing the segmented semantic units and the logical relationships and semantic roles they contain as structured data.
[0062] Example 3, see Figure 1 and Figure 2 This embodiment is based on the above embodiment. In step S3, multi-level semantic parsing specifically includes the following steps:
[0063] Step S31: Lexical semantic analysis, identifying legal terms in semantic units based on the legal dictionary, setting lexical weights for each word, and highlighting the contributions of key logical relationships and semantic roles;
[0064] Step S32: Syntactic and semantic analysis: Use rule-based logical reasoning to check whether the syntactic logic between semantic units is consistent. Use the SpaCy reference resolution model to parse the pronouns in the semantic units. Aggregate the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector. The formula used is as follows:
[0065] ;
[0066] Where, Represents the semantic unit index, Represents a semantic unit, Representing semantic units The local semantic feature vector of Represents a vocabulary index, Representing semantic units The total number of words included, represents the vocabulary weight, Expressing vocabulary The word vector representation of ;
[0067] Step S33: Contextual semantic analysis, analyzing the semantic coherence of the entire legal judgment document, including the following steps:
[0068] 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:
[0069] ;
[0070] Where, represents the global semantic feature matrix, Indicates the total number of semantic units;
[0071] Step S332: Calculate the contextual importance of each semantic unit using a sliding window mechanism to enhance the contextual awareness of the global semantic feature matrix. The formula used is as follows:
[0072] ;
[0073] ;
[0074] Where, Representing semantic units right The influence weight of represents the context window matrix consisting of influence weights, Indicates the parameters that control the window size, Represents the enhanced global semantic feature matrix.
[0075] By performing the above operations, traditional legal text parsing methods rely on rule matching. When processing complex legal texts, they lack sufficient context awareness and find it difficult to accurately capture the semantic associations between words and their meanings in specific scenarios, resulting in insufficient parsing capabilities. This solution extracts semantic features from three levels: vocabulary, syntax, and context. It enhances the overall semantic representation of judgment documents through attention mechanisms and dynamic context window mechanisms, ensures that the semantic connections between various parts are close, captures long-term dependencies, avoids misjudgment caused by a single semantic unit being out of context, and improves detection accuracy.
[0076] Example 4, see Figure 1 This embodiment is based on the above embodiment. In step S4, semantic deviation identification specifically includes the following steps:
[0077] Step S41: Model construction, building a semantic deviation recognition 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;
[0078] Step S42: the input layer inputs the enhanced global semantic feature matrix;
[0079] Step S43: The Transformer encoding layer processes the enhanced global semantic feature matrix. Each semantic unit is used as an input processing unit. The attention weight of each input processing unit is calculated through multi-head attention aggregation to obtain the deep semantic feature matrix. The formula used is as follows:
[0080] ;
[0081] Where, represents the deep semantic feature matrix, Represents the Transformer encoding layer;
[0082] 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:
[0083] ;
[0084] Where, Indicates the The 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;
[0085] Step S45: The deviation score calculation layer performs adaptive weight allocation, combining 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 semantic deviation.
[0086] Step S46: The output layer generates a bias score matrix using the following formula:
[0087] ;
[0088] Where, Representing semantic units The deviation score, represents the bias score matrix.
[0089] By performing the above operations, this solution constructs a semantic deviation recognition model based on the Transformer architecture to address the problems that general semantic deviation recognition methods have insufficient ability to recognize the reasoning logic implicit in legal judgments, have a limited scope of application, poor scalability, and are difficult to adapt to the automated analysis of different types of legal judgment documents. It effectively identifies hidden semantic deviations through a deep semantic feature matrix, and uses an adaptive weight allocation mechanism to calculate the deviation score of each semantic unit, thereby improving the objectivity and consistency of the score.
[0090] Example 5, see Figure 1 This embodiment is based on the above embodiment. In step S5, the judgment consistency assessment is specifically as follows: the global deviation mean and standard deviation of the legal judgment document are calculated based on the deviation scoring matrix, and the judgment consistency assessment result is output. The formula used is as follows:
[0091] ;
[0092] ;
[0093] ;
[0094] Where, represents the judgment consistency evaluation result, and denote the global mean and standard deviation respectively, and They represent weight parameters respectively.
[0095] Example 6, see Figure 1 This embodiment is based on the above embodiment. In step S6, the result interpretation and application specifically includes the following steps:
[0096] Step S61: generating a semantic deviation identification report based on the judgment consistency evaluation result;
[0097] Step S62: Propose targeted optimization suggestions based on the deviation scoring matrix, including semantic correction, context supplementation, and logic reconstruction;
[0098] Step S63: Present the optimization suggestions in a visual form.
[0099] It should be noted that, in this document, relational terms such as first and second, etc., are used only 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 terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.
[0100] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
[0101] The present invention and its embodiments are described above. This description is not restrictive. The drawings show only one embodiment of the present invention, and the actual structure is not limited thereto. In short, if a person skilled in the art is inspired by this and, without departing from the purpose of the present invention, designs structures and embodiments similar to this technical solution without inventiveness, they shall fall within the scope of protection of the present invention.
Claims
1. An artificial intelligence-based method for identifying semantic deviations in legal judgments, characterized by: The method comprises the following steps: Step S1: Data collection and preprocessing: collecting legal judgment documents, preprocessing the legal judgment documents and normalizing them into a unified format; Step S2: Semantic unit segmentation: divide the legal judgment document into semantic units and mark the logical relationship and semantic role within each semantic unit; Step S3: Multi-level semantic analysis, which performs lexical semantic analysis, syntactic semantic analysis, and contextual semantic analysis on semantic units to construct a global semantic feature matrix; Step S4: semantic deviation identification, building 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: Decision consistency evaluation, calculating the decision consistency evaluation result based on the deviation scoring matrix; Step S6: Result interpretation and application: Generate a semantic deviation identification report based on the judgment consistency assessment results, mark the deviation areas and provide improvement suggestions.
2. The artificial intelligence-based method for identifying semantic deviations in legal decisions according to claim 1, characterized in that: In step S3, the multi-level semantic analysis includes the following steps: Step S31: Lexical semantic analysis, identifying legal terms in semantic units, setting lexical weights for each word, and highlighting the contributions of key logical relationships and semantic roles; Step S32: Syntactic and semantic analysis, checking whether the syntactic logic between semantic units is consistent, parsing the pronouns in the semantic units, and aggregating the weighted vectors of all words in each semantic unit to obtain a local semantic feature vector; Step S33: contextual semantic analysis, aggregating the local semantic feature vectors of all semantic units to form a global semantic feature matrix, and using a sliding window mechanism to enhance the contextual awareness of the global semantic feature matrix.
3. The artificial intelligence-based method for identifying semantic deviations in legal decisions according to claim 1, characterized in that: In step S4, the semantic deviation identification includes the following steps: Step S41: Model construction, building a semantic deviation recognition 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 is used as an input processing unit. The attention weight of each input processing unit is calculated through multi-head attention aggregation to obtain a deep semantic feature matrix. Step S44: The global attention layer uses the attention weighting mechanism to calculate the importance of each semantic unit and generate the attention weight of each semantic unit; Step S45: The deviation score calculation layer performs adaptive weight allocation, combining 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 semantic deviation. Step S46: The output layer generates a bias score matrix using the following formula: ; Where, Representing semantic units The deviation score, represents the bias score matrix.
4. The method for identifying semantic deviations in legal decisions based on artificial intelligence according to claim 3, characterized in that: In step S5, the judgment consistency assessment is specifically as follows: calculating the global deviation mean and standard deviation of the legal judgment document based on the deviation scoring matrix, and outputting the judgment consistency assessment result. The formula used is as follows: ; Where, represents the judgment consistency evaluation result, and denote the global mean and standard deviation respectively, and Represent the weight parameters respectively.
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