Class case recommendation method based on deep understanding
Through a case recommendation method based on deep understanding, the Legal-BERT encoder and legal bar graph database are used to solve the problems of low recognition accuracy and insufficient recognition of legal term boundaries in long legal texts, and more efficient case recommendation and judgment support are achieved.
Patent Information
- Application Number
- CN202510906740.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-02
- Publication Date
- 2025-08-15
- Estimated Expiration
- 2045-07-02
AI Technical Summary
The existing case recommendation system has low recognition accuracy in long legal texts and insufficient identification of precise semantic boundaries of legal terms, making it difficult to accurately distinguish similar legal concepts and capture the systematic correlation between legal provisions.
A case recommendation method based on deep understanding is adopted, semantic features are extracted through the Legal-BERT encoder, a bar graph database is constructed for analysis of requirements, and the preliminary crime prediction results are dynamically fused with the entity-element matching results to recommend similar cases.
It improves the accuracy and practicality of similar case recommendations, can better understand the deep semantics and logical structure of legal texts, enhances the ability to identify legal terms, and reduces judgment differences.
Smart Images

Figure CN120492612A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a similar case recommendation method based on deep understanding. Background Art
[0002] With the rapid development of big data, artificial intelligence, and information technology, legal artificial intelligence is undergoing a profound transformation. Currently, the application of existing large-scale natural language processing models has significantly deepened the understanding of legal texts. However, the accuracy of similar case recommendation systems, processed by large-scale natural language models, has not yet reached its potential application value. With the advancement of existing technologies, the accuracy and practicality of similar case recommendations are expected to be further improved. It is not difficult to understand that similar case recommendations must be "fast" to continuously improve efficiency, reduce the workload of case analysis, and help judges and mediators make decisions quickly; at the same time, similar case recommendations must be "accurate" to minimize discrepancies in judgments in similar cases and provide key technical support for various judicial platforms. However, the speed and accuracy of similar case recommendations are currently hindered by factors such as the length and technical nature of legal documents, limiting their role in predicting legal decisions or assisting judicial mediation.
[0003] Faced with the numerous challenges of similar case recommendation in the field of legal artificial intelligence (AI), researchers have proposed a variety of solutions, primarily keyword-based case retrieval, tag-based case retrieval, and basic natural language processing (NLP) text recommendation algorithms. Existing methods mostly focus on calculating the similarity between two texts. Unlike basic word frequency counting methods, scholars have attempted to extract features from legal documents or improve these by converting documents into embeddings using vector space models, then evaluating the similarity between the extracted features or embeddings. These methods are highly effective, but they only compare extracted features without incorporating full-text information or capturing context and inherent features. Consequently, researchers have proposed a context-aware similar case recommendation model, which significantly improves text feature extraction compared to traditional methods. However, considerable room for improvement remains in terms of accuracy and applicability to long legal texts. Additionally, research has used NLP-related techniques to improve the quality of similar case recommendations. However, most existing methods lack a detailed understanding of legal terminology, the connections between legal texts, and legal reasoning logic. This makes it difficult to uncover key information hidden within documents. Consequently, they face challenges in accurately identifying the semantic boundaries of legal terminology, capturing the systematic connections between legal texts, and explicitly modeling judicial reasoning logic. This leads to difficulties in accurately distinguishing between similar legal concepts, insufficient modeling of the unique logical structures of legal texts, and an inability to effectively integrate legal expertise. Therefore, there is an urgent need to propose a similar case recommendation method based on deep understanding to address the technical issues of existing methods, such as low recognition accuracy in long legal texts and insufficient identification of the precise semantic boundaries of legal terminology. Summary of the Invention
[0004] The main purpose of this invention is to propose a similar case recommendation method based on deep understanding, aiming to solve the technical problems of low recognition accuracy in long legal texts and insufficient recognition of the precise semantic boundaries of legal terms in existing methods.
[0005] To achieve the above-mentioned object, the present invention provides a method for recommending similar cases based on deep understanding, wherein the method for recommending similar cases based on deep understanding comprises the following steps:
[0006] S1. Semantic extraction: pre-process the case text and extract semantic features from the pre-processed case text through an encoder; the semantic feature extraction includes initial crime prediction and legal entity recognition;
[0007] S2. Structural extraction: converting nonlinear legal provisions, judicial interpretations, and adjudication rules into a legal provision map database and performing element analysis, then matching legal entity recognition results with elements;
[0008] S3. Similar case retrieval: dynamically fuse the preliminary crime prediction results with the entity-element matching results to obtain a case feature fusion vector, perform similarity calculation based on the case feature fusion vector, and recommend similar cases.
[0009] In one preferred solution, step S1 pre-processes the case text, specifically:
[0010] Mapping unstructured case texts to unified legal element nodes and building a semantic association network of terminology through legal concept embedding to support term alignment across legal systems;
[0011] The case text is divided into tokens through WordPiece segmentation, and structural tags are injected into the tokens.
[0012] One of the preferred solutions is that in S1, semantic features are extracted from the preprocessed case text using the Legal-BERT encoder.
[0013] In one of the preferred solutions, the Legal-BERT encoder includes a 24-layer Transformer encoder, and the Transformer encoder includes a multi-head attention mechanism and a feedforward neural network.
[0014] In one preferred solution, step S1 extracts semantic features from the pre-processed case text through an encoder, specifically:
[0015] Calculate the association weights between words in the input sequence to form a global semantic dependency graph;
[0016] The encoder calculates multiple groups of attention in parallel to obtain semantic associations of different dimensions, and performs nonlinear transformation on the attention output to output the initial crime prediction and legal entity recognition results of the case text.
[0017] One of the preferred solutions is to calculate the association weights between the words in the input sequence to form a global semantic dependency graph, specifically:
[0018]
[0019] in, are the input embedding layer parameters of the Legal-BERT encoder, is a digital ID sequence, is the trainable weight matrix of the digital ID sequence, is the position code, is the trainable weight matrix for position encoding, Encode the paragraph, A trainable weight matrix encoding a paragraph.
[0020] One of the preferred solutions is to calculate multiple attention groups in parallel through the encoder to obtain semantic associations of different dimensions and perform nonlinear transformation on the attention output, specifically:
[0021] Through multi-head self-attention, multiple groups of attention are calculated in parallel to obtain semantic associations of different dimensions, and residual connections and normalization are performed;
[0022] Each of the self-attentions is:
[0023]
[0024] in, For the Self-attention, Transformer encoder layer Level output, Respectively queries, keys, and values for self-attention;
[0025] The residual connection and normalization processing are:
[0026]
[0027] in, For the The intermediate output of the layer, is layer normalization, is the output matrix of the multi-head self-attention mechanism;
[0028] The attention output is nonlinearly transformed through a feedforward neural network, and quadratic residual and layer normalization are performed;
[0029] The output of the feedforward neural network is:
[0030]
[0031] in, is the output of the feedforward neural network, is the activation function, is the first layer weight of the feedforward neural network, is the first layer bias of the feedforward neural network, is the second layer weight of the feedforward neural network, It is the bias of the second layer of the feedforward neural network;
[0032] The quadratic residual and layer normalization process is:
[0033]
[0034] in, Transformer encoder layer Level output.
[0035] In one preferred solution, step S3 dynamically fuses the preliminary crime prediction result with the entity-element matching result to obtain a case feature fusion vector, specifically:
[0036] The dynamic fusion is:
[0037]
[0038] in, For the crime The comprehensive score of is the semantic weight, is the initial crime prediction result, For the crime With the The confidence level of the entity-element match;
[0039] The case feature fusion vector is:
[0040]
[0041] in, is the case feature fusion vector, is a string concatenation function, For the crime Structural matching score.
[0042] In one preferred solution, step S3 calculates similarity based on the case feature fusion vector and recommends similar cases, specifically:
[0043] The similarity calculation is performed based on the case feature fusion vector, specifically:
[0044]
[0045] in, To query the comprehensive similarity between the case and historical cases, that is, the comprehensive similarity between the case text and historical cases, is the feature fusion vector of the query case, is the feature fusion vector of historical cases, and They are and The semantic sub-vector of the crime in Score the entity-element match, is the matching threshold;
[0046] The recommended similar cases are as follows:
[0047]
[0048] in, Recommended for similar cases Case output, is the sorting weight, For example 's comprehensive rating.
[0049] One of the preferred solutions, after step S3, further includes:
[0050] User feedback is processed for similar case retrieval and recommendation, and dynamic fusion is adjusted and similar case retrieval strategies are updated based on the user feedback processing results.
[0051] In the above-mentioned technical solution of the present invention, the method for recommending similar cases based on deep understanding includes the following steps: semantic extraction, preprocessing the case text, and extracting semantic features from the preprocessed case text through an encoder; the semantic feature extraction includes initial charge prediction and legal entity recognition; structural extraction, converting nonlinear legal provisions, judicial interpretations, and adjudication rules into a legal provision map database and performing element parsing, and performing entity-element matching between the legal entity recognition results and the elements; similar case retrieval, dynamically fusing the preliminary charge prediction results with the entity-element matching results to obtain a case feature fusion vector, performing similarity calculation based on the case feature fusion vector, and recommending similar cases. The present invention solves the technical problems of low recognition accuracy in long legal texts and insufficient recognition of the precise semantic boundaries of legal terms in existing methods. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.
[0053] Figure 1 This is a first schematic diagram of a similar case recommendation method based on deep understanding according to an embodiment of the present invention;
[0054] Figure 2 This is a second schematic diagram of a similar case recommendation method based on deep understanding according to an embodiment of the present invention;
[0055] Figure 3 This is a third schematic diagram of a similar case recommendation method based on deep understanding according to an embodiment of the present invention;
[0056] Figure 4 This is a fourth schematic diagram of a similar case recommendation method based on deep understanding according to an embodiment of the present invention.
[0057] The realization of the objectives, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0058] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of the present invention.
[0059] In addition, the terms "first," "second," and so on, used in this disclosure are for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, features specified as "first" or "second" may explicitly or implicitly include at least one of these features.
[0060] Moreover, the technical solutions between the various embodiments of the present invention may be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is mutually contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0061] See also Figure 1-Figure 4 According to one aspect of the present invention, the present invention proposes a similar case recommendation method based on deep understanding, comprising the following steps:
[0062] S1. Semantic extraction: pre-process the case text and extract semantic features from the pre-processed case text through an encoder; the semantic feature extraction includes initial crime prediction and legal entity recognition;
[0063] S2. Structural extraction: converting nonlinear legal provisions, judicial interpretations, and adjudication rules into a legal provision map database and performing element analysis, then matching legal entity recognition results with elements;
[0064] S3. Similar case retrieval: dynamically fuse the preliminary crime prediction results with the entity-element matching results to obtain a case feature fusion vector, perform similarity calculation based on the case feature fusion vector, and recommend similar cases.
[0065] Specifically, in this embodiment, step S1 pre-processes the case text, specifically:
[0066] Mapping unstructured case texts to unified legal element nodes, and through legal concept embedding, building a semantic association network of terminology, supporting term alignment across legal systems; through legal terminology standardization, mapping legal concepts with different expressions to unified legal element nodes, eliminating ambiguity in textual expressions, specifically:
[0067]
[0068] in, For the standardized case text, For the original case text, It is a legal phrase dictionary; through the embedding of legal concepts, a semantic association network between terms is constructed to support term alignment across legal systems; through WordPiece word segmentation, the case text is divided into word units to prepare for the input of the subsequent encoder. Through WordPiece word segmentation, a domain-adaptive table can be constructed to inject special tags without over-splitting and over-merging, and structured tags can be injected into the word units. When adding structured tags, a dynamic tag expansion mechanism based on active learning and a hierarchical tag system can be used. Specifically, 、 Structured tagging provides display prompts for subsequent semantic coding, enhancing the understanding of the unique semantics and logic of legal texts. The tagging mainly includes element boundaries, legal citations, evidence types, and logical relationships. It breaks down vocabulary in case texts into smaller semantic units, improving the model's ability to process long sentences while maintaining semantic integrity.
[0069] Segment the case text into words, specifically:
[0070]
[0071] in, For word element;
[0072] Inject structured tags into the word, specifically:
[0073]
[0074] in, To inject the structured tokens, is the label for the classification task, A text describing the facts of the case. A marker to separate sentences. The text of the legal provisions;
[0075] After injecting the structured tag into the word unit, the method further includes: converting the structured tag word unit into encoder input; specifically:
[0076]
[0077]
[0078]
[0079] in, is a digital ID sequence, For the legal field vocabulary, is the position code, for length, Encode the paragraph, is the length of the fact description, is the length of the legal reference, Invalid .
[0080] Specifically, in this embodiment, the S1 uses the Legal-BERT encoder to extract semantic features of the preprocessed case text; the Legal-BERT encoder includes a 24-layer Transformer encoder, which adopts a hierarchical attention mechanism. The bottom-level encoder perceives character-level encoding to eliminate the ambiguity of legal terms, the middle-level encoder understands paragraph-level encoding and infers cross-paragraph requirements, and the high-level encoder grasps the logical encoding between paragraphs and paragraph structures, abstracts and summarizes legal logic, and nests each layer to promote the understanding of legal language from shallow to deep. It also embeds a global attention mechanism to understand the long-distance dependency of legal texts, and combines the global attention mechanism with the hierarchical attention mechanism to better explore the deep understanding of legal documents; the Transformer encoder includes a multi-head attention mechanism and a feedforward neural network.
[0081] Specifically, in this embodiment, step S1 extracts semantic features from the pre-processed case text through an encoder, specifically:
[0082] Calculate the association weights between each word in the input sequence to form a global semantic dependency graph; that is, convert discrete legal text words into continuous vector representations through word embedding; specifically:
[0083]
[0084] in, The input embedding layer parameter of the Legal-BERT encoder is a common design of the Transformer model in natural language processing. It is only used in the forward propagation process of the Legal-BERT encoder to output the semantic features of the case text (such as crime prediction and entity recognition) and does not directly participate in the construction of the legal article map. is a digital ID sequence, is the trainable weight matrix of the digital ID sequence, is the position code, is the trainable weight matrix for position encoding, Encode the paragraph, A trainable weight matrix encoding the paragraph;
[0085] The encoder calculates multiple attention groups in parallel to obtain semantic associations in different dimensions, and performs nonlinear transformation on the attention output to output the initial crime prediction and legal entity recognition results of the case text; specifically:
[0086] Multi-head self-attention is used to parallelly calculate multiple attention groups to obtain semantic associations of different dimensions, and residual connections and normalization are performed. The single-layer Transformer is the basic processing unit in the Transformer architecture. It uses the multi-head self-attention mechanism and feedforward neural network to perform context-aware feature conversion on legal texts. The multi-head self-attention is:
[0087]
[0088] in, For the The output matrix of the multi-head self-attention in the Transformer layer, For the Self-attention, is the output projection matrix;
[0089] Each of the self-attentions is:
[0090]
[0091] in, For the Self-attention, Transformer encoder layer Level output, Respectively The query, key, and value of self-attention; 64 is the scaling factor;
[0092] The residual connection and normalization processing are:
[0093]
[0094]
[0095] in, For the The intermediate output of the layer, is layer normalization, is the output matrix of multi-head self-attention; are the learnable scaling and offset parameters, is the mean of the input, is the variance of the input;
[0096] The attention output is nonlinearly transformed by a feedforward neural network, and is subjected to quadratic residual and layer normalization processing; the output of the feedforward neural network is:
[0097]
[0098] in, is the output of the feedforward neural network, is the activation function, is the first layer weight of the feedforward neural network, is the first layer bias of the feedforward neural network, is the second layer weight of the feedforward neural network, It is the bias of the second layer of the feedforward neural network;
[0099] The quadratic residual and layer normalization process is:
[0100]
[0101] in, Transformer encoder layer Level output;
[0102] Combining word embedding with a single-layer Transformer, that is, first encoding the prior knowledge of legal terminology through word embedding, and then using Transformer to model the logical relationship between legal elements.
[0103] Specifically, in this embodiment, 24 layers of stacked Transformers are used to gradually refine the deep semantic representation of legal texts. The bottom encoder consists of 1-6 layers of Transformers, which are used to capture vocabulary or phrase-level features. The middle encoder consists of 7-18 layers, which are used to understand inter-sentence logic. The top encoder consists of 19-24 layers of Transformers, which are used to build a global case understanding. Specifically:
[0104]
[0105] in, It is the output of 24-layer stacked Transformer. It is the result of the first-layer Transformer encoder processing the input embedding E.
[0106] Specifically, in this embodiment, the complete legal entity identification token output is:
[0107]
[0108] in, As a result of legal entity identification, is a conditional random field, is the output of the linear projection layer, Transformer encoder layer Level output;
[0109] The results of the initial crime prediction of the case text are:
[0110]
[0111] in, is the initial crime prediction output, is the crime classification weight matrix, is the bias term, A collection of crimes.
[0112] Specifically, in this embodiment, the structural extraction is structural feature extraction. Through the structured prior knowledge of the legal field, nonlinear legal provisions, judicial interpretations and judgment rules are converted into computable logical graphs, forming a collaborative cognitive system with semantic extraction; the legal graph database is deeply deconstructed, and legal-related methods are used to extract constituent element nodes, logical relationships between elements and cross-legal citation rules; when the semantic channel completes the legal entity recognition, the structural channel starts a multi-level matching engine, including surface matching, logical verification and conflict detection; the real-time evolution of the legal relationship graph has the ability of self-correction and counterfactual reasoning; the two channels of structural recognition and semantic recognition are coordinated, so that the system can not only identify the degree of matching between the elements of the crime and the legal entity in the legal provisions, but also explore the deep semantics in the case text, providing a basis for subsequent similar case retrieval.
[0113] Specifically, in this embodiment, a legal article map is constructed, and the legal article map is:
[0114]
[0115] in, For the legal provisions map, For legal provisions nodes, It is the logical edge between legal provisions;
[0116] Article The set of elements is:
[0117]
[0118] in, For Articles The set of elements, To analyze the provisions the elements of
[0119] Construct a legal article relationship map; assume that the expanded legal article map is:
[0120]
[0121] in, To expand the legal map, is the union of all elements, , is the dependency relationship between the elements; the dependency relationship between the elements is:
[0122]
[0123] in, For the Elements, For the elements;
[0124] It can be viewed as a heterogeneous graph, and the dependency information between elements is propagated through the graph neural network, specifically:
[0125]
[0126] in, For the requirements In the The layer representation, is the activation function,
[0127] For the layer-specific learnable weight matrices, For the requirements In the Representation of layers;
[0128] Entity-element matching; from the results perspective, the results of legal entity identification can be expressed as:
[0129]
[0130] in, As a result of legal entity identification, For the identified legal entity, The type label corresponding to the identified legal entity, is the total number of legal entity and type label pairs identified from the case text;
[0131] The matching score matrix is:
[0132]
[0133] in, is the matching score matrix, Type tag Partial Match Requirements When , the matching score matrix takes a constant from 0 to 1;
[0134] Overall requirement satisfaction degree vector; the degree vector is:
[0135]
[0136] in, is the degree vector, and finally the highest matching score for each element is obtained.
[0137] Specifically, in this embodiment, step S3 is a reinforcement learning feedback loop, which realizes the cognitive leap from static recommendation to dynamic adaptation through continuous learning. This mechanism converts the implicit experience in judicial practice into a fine-tunable signal of model parameters, forming a closed-loop learning system of recommendation-feedback-optimization. Its technical framework and legal value are reflected in the following dimensions: judicial quantification equipment of feedback signals, dynamic optimization of policy networks and continuous precipitation of judicial cognition; among them, the judicial quantification design of feedback signals is to convert user behavior in legal scenarios into structured rewards, with the functions of explicit feedback, implicit feedback and compliance verification, and the dynamic optimization of policy networks refers to the feedback signal driving the parameter update of the fusion device and retrieval strategy; the continuous precipitation of parameter cognition refers to enhancing entity recognition, reconstructing feature space, and expanding structural channels; in general, the reinforcement learning feedback loop step-by-step learns data laws, and realizes cognitive evolution in the interaction of the human legal community.
[0138] Specifically, in this embodiment, step S3 dynamically fuses the preliminary crime prediction result with the entity-element matching result to obtain a case feature fusion vector, specifically:
[0139] The dynamic fusion engine dynamically fuses the preliminary crime prediction results with the entity-element matching results. This means that semantic features and structural features are integrated into a unified representation at a high level, achieving the collaborative calculation of the formal logic and substance of the legal text. This breaks through the limitations of the separation of semantics and knowledge in traditional legal text processing and constructs a composite feature space that conforms to the laws of judicial cognition.
[0140] The dynamic fusion is:
[0141]
[0142] in, For the crime The comprehensive score of is the semantic weight, is the initial crime prediction result, For the crime With the Confidence of entity-element matching, crime For the crime collection A subset of
[0143] The case feature fusion vector is:
[0144]
[0145] in, is the case feature fusion vector, is a string concatenation function, For the crime Structural matching score.
[0146] Specifically, in this embodiment, step S3 performs similarity calculation based on the case feature fusion vector and recommends similar cases, specifically as follows:
[0147] Similar case retrieval and similarity calculation are performed based on the case feature fusion vector; specifically:
[0148] Similar case retrieval is achieved through a similar case retrieval engine. Through multi-dimensional similarity calculation, it accurately links pending cases with historical cases, providing users with intelligent auxiliary support for similar cases. In other words, it converts the legal principles of similar case retrieval into a computable algorithm model. The similar case retrieval engine is:
[0149]
[0150] in, For similar case search engine, is the graph index, It is the Top-K most similar case;
[0151] The similarity is:
[0152]
[0153] in, To query the comprehensive similarity between the case and historical cases, that is, the comprehensive similarity between the case text and historical cases, is the feature fusion vector of the query case, is the feature fusion vector of historical cases, and They are and The semantic sub-vector of the crime in Score the entity-element match, is the matching threshold;
[0154] The recommended similar cases are as follows:
[0155]
[0156] in, Recommended for similar cases Case output, is the sorting weight, For example 's comprehensive rating.
[0157] Specifically, in this embodiment, after step S3, the following steps are further included:
[0158] Process user feedback on similar case searches and recommendations, and adjust dynamic integration and update similar case search strategies based on user feedback processing results;
[0159] The user feedback processing captures users' decision preferences and correction behaviors in a structured manner, converting their professional judgment into machine-understandable optimization information, thereby achieving continuous optimization of legal case recommendations. Specifically:
[0160]
[0161] in, Feedback processing results to users, The overall optimization cycle recommended for similar cases, is the current time step, For the time steps, for The reward obtained at any time is Instant rewards at all times, is the discount factor, for The reward obtained at any time is Instant rewards at all times, is the regularization coefficient, is the strategy entropy;
[0162] Based on the results of the user feedback processing, instant rewards and cumulative rewards are obtained through the reward calculator. Through the design of multi-dimensional reward functions, it is ensured that the decision-making behavior of similar case retrieval and recommendation is kept dynamic and consistent with the requirements of relevant departments. The instant rewards are:
[0163]
[0164] in, For immediate rewards;
[0165] The accumulated rewards are:
[0166]
[0167] in, For accumulated rewards, for Instant rewards at every moment;
[0168] The policy network is updated. The input of the policy network depends on the user feedback signal, that is, the immediate reward. , reflects the user's modification or adoption behavior of the recommendation results, as well as the current policy state, the recommendation probability distribution generated by the feature fusion vector and similarity calculation, the updated policy network can optimize the retrieval strategy, adjust the ranking weight of the similar case retrieval engine, such as HNSW search, to make future recommendations more in line with user preferences, and adjust the dynamic fusion parameters, which may be back-propagated to Equal weights are used to achieve end-to-end optimization; specifically:
[0169]
[0170] in, is the objective function of the policy optimization, is the expectation for all samples, For the strategy network, To select an action, For status, For the old strategy, is the advantage function, is the clipping threshold, For the general Restricted to ;
[0171] Update similar case retrieval strategy. The core of the updated similar case retrieval strategy is to integrate user feedback into the retrieval model through a reinforcement learning closed loop. Specifically:
[0172]
[0173] Output new parameters, specifically:
[0174]
[0175] in, are the parameters of the policy network, is the learning rate, is the gradient of the policy network parameters, is the action probability output by the policy network.
[0176] Specifically, in this embodiment, the present invention adopts the design ideas of semantic channels and structural channels to respectively extract the semantic features of case texts and the structural features of legal provisions. It not only realizes the conversion of original legal case texts into computer-recognizable language and can deeply understand the meaning of the text, but also ensures the rigor, systematicity and interpretability of reasoning in combination with legal provisions, and realizes a highly collaborative cognitive system of semantic channels and structural channels. After fusing the features of the two channels, candidate cases are retrieved and cases with high similarity are recommended. Users can use reinforcement learning methods to update parameters based on real-time feedback from related cases, continuously reduce the training time of the model and improve accuracy. The present invention solves the problems of insufficient representativeness of long legal texts in similar case recommendations, low accuracy, insufficient recognition of precise semantic boundaries of legal terms, difficulty in capturing systematic connections between legal provisions, and lack of explicit modeling of judicial reasoning logic.
[0177] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. All equivalent structural transformations made using the contents of the present description and drawings under the inventive concept of the present invention, or direct / indirect applications in other related technical fields, are included in the patent protection scope of the present invention.
Claims
1. A similar case recommendation method based on deep understanding, characterized by: The following steps are involved: S1. Semantic extraction: pre-process the case text and extract semantic features from the pre-processed case text through an encoder; the semantic feature extraction includes initial crime prediction and legal entity recognition; S2. Structural extraction: converting nonlinear legal provisions, judicial interpretations, and adjudication rules into a legal provision map database and performing element analysis, then matching legal entity recognition results with elements; S3. Similar case retrieval: dynamically fuse the preliminary crime prediction results with the entity-element matching results to obtain a case feature fusion vector, perform similarity calculation based on the case feature fusion vector, and recommend similar cases.
2. The method for recommending similar cases based on deep understanding according to claim 1, characterized in that: The step S1 pre-processes the case text, specifically: Mapping unstructured case texts to unified legal element nodes and building a semantic association network of terminology through legal concept embedding to support term alignment across legal systems; The case text is divided into tokens through WordPiece segmentation, and structural tags are injected into the tokens.
3. A similar case recommendation method based on deep understanding according to any one of claims 1-2, characterized in that: In S1, the Legal-BERT encoder is used to extract semantic features from the preprocessed case text.
4. The method for recommending similar cases based on deep understanding according to claim 3, characterized in that: The Legal-BERT encoder includes a 24-layer Transformer encoder, which includes a multi-head attention mechanism and a feedforward neural network.
5. The method for recommending similar cases based on deep understanding according to claim 4, characterized in that: The step S1 extracts semantic features from the pre-processed case text through an encoder, specifically: Calculate the association weights between words in the input sequence to form a global semantic dependency graph; The encoder calculates multiple groups of attention in parallel to obtain semantic associations of different dimensions, and performs nonlinear transformation on the attention output to output the initial crime prediction and legal entity recognition results of the case text.
6. The method for recommending similar cases based on deep understanding according to claim 5, characterized in that: The calculation of the association weights between the words in the input sequence to form a global semantic dependency graph is as follows: ; in, are the input embedding layer parameters of the Legal-BERT encoder, is a digital ID sequence, is the trainable weight matrix of the digital ID sequence, is the position code, is the trainable weight matrix for position encoding, Encode the paragraph, A trainable weight matrix encoding a paragraph.
7. The method for recommending similar cases based on deep understanding according to claim 5, characterized in that: The encoder calculates multiple attention groups in parallel to obtain semantic associations of different dimensions and performs nonlinear transformation on the attention output, specifically: Through multi-head self-attention, multiple groups of attention are calculated in parallel to obtain semantic associations of different dimensions, and residual connections and normalization are performed; Each of the self-attentions is: ; in, For the Self-attention, Transformer encoder layer Level output, Respectively queries, keys, and values for self-attention; The residual connection and normalization processing are: ; in, For the The intermediate output of the layer, is layer normalization, is the output matrix of the multi-head self-attention mechanism; The attention output is nonlinearly transformed through a feedforward neural network, and quadratic residual and layer normalization are performed; The output of the feedforward neural network is: ; in, is the output of the feedforward neural network, is the activation function, is the first layer weight of the feedforward neural network, is the first layer bias of the feedforward neural network, is the second layer weight of the feedforward neural network, It is the bias of the second layer of the feedforward neural network; The quadratic residual and layer normalization process is: ; in, Transformer encoder layer Level output.
8. A similar case recommendation method based on deep understanding according to any one of claims 1-2, characterized in that: The step S3 dynamically fuses the preliminary crime prediction result with the entity-element matching result to obtain the case feature fusion vector, specifically: The dynamic fusion is: ; in, For the crime The comprehensive score of is the semantic weight, is the initial crime prediction result, For the crime With the The confidence level of the entity-element match; The case feature fusion vector is: ; in, is the case feature fusion vector, is a string concatenation function, For the crime Structural matching score.
9. The method for recommending similar cases based on deep understanding according to claim 8, characterized in that: The step S3 calculates similarity based on the case feature fusion vector and recommends similar cases, specifically: The similarity calculation is performed based on the case feature fusion vector, specifically: ; in, To query the comprehensive similarity between the case and historical cases, that is, the comprehensive similarity between the case text and historical cases, is the feature fusion vector of the query case, is the feature fusion vector of historical cases, and They are and The semantic sub-vector of the crime in Score the entity-element match, is the matching threshold; The recommended similar cases are as follows: ; in, Recommended for similar cases Case output, is the sorting weight, For example 's comprehensive rating.
10. A similar case recommendation method based on deep understanding according to any one of claims 1-2, characterized in that: After step S3, the method further includes: User feedback is processed for similar case retrieval and recommendation, and dynamic fusion is adjusted and similar case retrieval strategies are updated based on the user feedback processing results.
Citation Information
Patent Citations
Class case recommendation method and device based on legal element hierarchical network and text features
CN117149999A
Historical legal case similarity recommendation method based on big data analysis
CN118210915A
Class case text pushing method and device based on artificial intelligence
CN119807521A
Intelligent legal text analysis method based on legal concept pedigree
CN119990290A
Biomarker for diagnosing rheumatoid arthritis and uses thereof
KR1020220149863A
Cited By
Legal element map auxiliary class case recommendation method and device and program product
CN120780850A
A legal element graph assisted case recommendation method, device and program product
CN120780850B
Intelligent legal file retrieval method and system based on multi-modal heterogeneous large model
CN121051277A
Intelligent legal file retrieval method and system based on multi-modal heterogeneous large model
CN121051277B
Class case retrieval method and system based on collaborative fusion of laws and affairs
CN121833923A