A legal case retrieval method based on similarity calculation
By constructing a legal case retrieval method based on similarity calculation, the problems of low accuracy and poor interpretability in existing technologies are solved, achieving high-precision and interpretable legal case retrieval, improving retrieval accuracy and response speed, and providing traceable and verifiable retrieval references.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUNAN UNIV
- Filing Date
- 2026-05-11
- Publication Date
- 2026-07-31
AI Technical Summary
Existing case retrieval technologies suffer from low accuracy, limited dimensions, poor interpretability, and insufficient computing power, failing to meet the practical needs of unifying judgment standards and improving trial efficiency under massive case data.
By constructing a legal case retrieval method based on similarity calculation, including user retrieval request parsing, document preprocessing segmentation, text block structuring, feature extraction, multi-dimensional similarity comparison and weighted ranking, and combining legal ontology knowledge graph and distributed parallel computing, the method achieves standardized structuring transformation of unstructured judgment documents and deep intent recognition.
It achieves high-precision and interpretable legal case retrieval, provides traceable and verifiable retrieval references, assists in case analysis and legal reasoning, and improves retrieval accuracy and response speed.
Smart Images

Figure CN122489604A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent retrieval technology, and in particular to a legal case retrieval method based on similarity calculation. Background Technology
[0003] The need for "consistent judgments in similar cases and uniform standards of judgment" is becoming increasingly urgent in judicial practice. Case retrieval has become a key technical means to assist judges in making judgments, unify the application of law, and improve the quality and efficiency of trials.
[0004] However, existing case retrieval technologies generally suffer from many problems such as low accuracy, single dimension, poor interpretability, insufficient computing power, and lack of reasoning. They cannot meet the practical needs of unifying judgment standards and improving trial efficiency under massive case data. Therefore, the industry urgently needs a new type of case retrieval system that is high-performance, high-precision, interpretable, and has the ability to provide legal reasoning. Summary of the Invention
[0005] To overcome the shortcomings of the prior art, this application provides a legal case retrieval method based on similarity calculation.
[0006] This application provides a legal case retrieval method based on similarity calculation, the method comprising: Step S1: Obtain the user's search request; based on the user's search request, perform legal intent analysis and standardized expansion to generate query metadata, which includes case nature, cause of action, judgment time, territorial jurisdiction, and core legal relationship tags. Step S2: Based on the query metadata, retrieve the corresponding unstructured judgment documents, perform text cleaning, privacy desensitization, and sentence standardization on the unstructured judgment documents to obtain preprocessed text, obtain the semantic boundary rules of legal documents, and based on the semantic boundary rules of legal documents, divide the preprocessed text into key fact segments, dispute focus segments, and legal application segments. Perform semantic integrity recursive block division on the text segments in the key fact segments, dispute focus segments, and legal application segments that exceed the preset length threshold, and output the block-divided structured text. Step S3: Based on the segmented structured text, feature extraction and vector encoding are performed on the key fact section, the disputed focus section, and the legal application section respectively, and multi-dimensional structured features and high-dimensional semantic vectors are obtained in combination. Step S4: Obtain the full case database. Based on the query metadata, multi-dimensional structured features, and high-dimensional semantic vectors, perform a three-dimensional hybrid comparison of vector cosine similarity, action sequence LCS similarity, and legal provision hierarchical overlap on the full case database using distributed parallel computing to obtain a Top-K preliminary screening list of cases that match the user's query intent. Step S5: Based on the case types determined by the Top-K preliminary screening case list and the query metadata, retrieve the corresponding matching weight coefficients from the preset weight library for weighted sorting, and perform secondary fine sorting and legal reasoning on the multi-dimensional structured features to obtain interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.
[0007] Preferably, the system receives precise query, conditional combination query, or natural language fuzzy query information input by the user and outputs the user's search request. Acquire historical judgment documents and legal databases, and construct a legal ontology knowledge graph based on the historical judgment documents and legal databases. The legal ontology knowledge graph includes legal entity relationships, cause-of-case hierarchical relationships, legal provision relationships, and claims basis relationships. Based on the aforementioned legal ontology knowledge graph, the user's search request is processed in four layers: legal entity identification, case classification, basis of claim analysis, and query intent disambiguation, to obtain the processing result. The processing results are expanded using synonyms, hierarchical concepts, and legal provisions to generate query metadata.
[0008] Preferably, the key fact segments in the segmented structured text are subjected to dual representation processing of structured sequence and dense vector, and the dual representation results of key facts are output. Based on the key fact annotation data in the historical judgment documents, a legal behavior action extraction model is constructed. The dual representation results of the key facts are input into the legal behavior action extraction model to form a five-tuple sequence of subject, behavior, object, result and time, and mapped into an action tag chain. We acquire a massive amount of legal judgment documents, construct a pre-trained language model specifically for the legal field, and input the dual representation results of key facts into the pre-trained language model for encoding to obtain the key fact encoding results.
[0009] Preferably, the action tag chain is subjected to time-weighted LCS processing to obtain the key fact action sequence similarity results; The key fact encoding results are fused and statistically analyzed using cosine similarity and Manhattan distance to obtain the key fact semantic similarity results; The key fact action sequence similarity results and key fact semantic similarity results are combined into a key fact comprehensive similarity result, which is then incorporated into multidimensional structured features and high-dimensional semantic vectors.
[0010] Preferably, based on the data of disputed focus marking in historical judgment documents, a multi-level disputed focus labeling system for judicial scenarios is constructed, consisting of primary focus, secondary focus, and tertiary focus, and a focus label set is output; Map the disputed focus segments to a focus label set and output the focus label confidence results; Based on the opposing relationships of disputed points, the correspondence between claims and defenses marked in historical judgment documents, a supervision signal is constructed. According to the supervision signal, the disputed point segments are specifically coded in judicial semantics, and the focus semantic coding results are output. The label hierarchy overlap is statistically analyzed based on the confidence scores of the focus labels to obtain coarse-grained results of the disputed focus matching. Vector similarity statistics are performed on the semantic encoding results of the focus to obtain fine-grained semantic comparison results of the disputed focus; The coarse-grained matching results and fine-grained semantic comparison results of the disputed focus are combined to form a comprehensive similarity result of the disputed focus, which is then incorporated into multi-dimensional structured features and high-dimensional semantic vectors.
[0011] Preferably, based on the legal ontology knowledge graph and the legal regulations database, structured extraction rules for legal provisions and alignment rules for the legal knowledge graph are constructed. Based on the aforementioned legal text structure extraction rules and legal knowledge graph alignment rules, legal information is extracted from the legal application section of the segmented structured text to obtain the legal information extraction results. The extracted legal information is matched with the legal database to output the structured matching results of the legal provisions. Based on the relationships in the legal ontology knowledge graph, the extracted legal information is labeled with judicial attributes and related legal basis to obtain the legal application labeling results; Based on the legal ontology knowledge graph and historical judgment texts, a multidimensional judicial weight coefficient is preset. Based on the structured matching results of the legal provisions and the legal application annotation results, the multidimensional judicial weight coefficient is introduced for weighted statistics to obtain the multidimensional legal application similarity. The multidimensional legal application similarity is then incorporated into the multidimensional structured features and the high-dimensional semantic vector.
[0012] Preferably, a weight database is preset based on the legal ontology knowledge graph, historical judgment documents and legal database. Based on the case type determined by the query metadata, the matching weight coefficients of the five dimensions of key facts, action sequence, points of contention and application of law corresponding to the case type are retrieved from the weight database. Based on the matching weight coefficient, the Top-K preliminary screening case list is weighted to obtain a comprehensive similarity score. The comprehensive similarity scores are then sorted in descending order to output a candidate case ranking table. Based on multidimensional structured features, the time sequence of key facts of candidate cases in the candidate case ranking table is matched with the time sequence of search requirements of the query metadata. The focus of the dispute of candidate cases in the candidate case ranking table is compared with the focus of the search requirements of the query metadata, generating interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.
[0013] Compared with the prior art, the present invention has the following characteristics and beneficial effects: By constructing a complete closed-loop process from user search request parsing, document preprocessing and segmentation, text block structuring, to feature extraction, multi-dimensional similarity comparison, and weighted ranking, this approach breaks through the traditional legal search model of simple keyword matching. It breaks down judgment documents into key fact sections, disputed focus sections, and legal application sections, and solves the problem of semantic fragmentation in long texts through recursive block division based on semantic integrity, achieving standardized and structured transformation of unstructured judgment documents. Through a legal ontology knowledge graph, four-layer intent parsing, and multi-dimensional concept expansion, it can accurately identify the deeper intents behind fuzzy natural language searches, such as legal causes of action, legal relationships, and the basis of claims, effectively solving the problems of missed detections, false detections, and synonym matching failures in traditional keyword searches. By introducing a distributed parallel computing architecture, it supports batch comparison of three-dimensional hybrid similarity across the entire judgment document database, balancing search accuracy and response speed. It breaks the traditional "black box output" model of search, simultaneously outputting factual basis, comparison of differences in disputed focus, and logical reasons for the application of legal provisions after ranking, providing legal practitioners with traceable and verifiable search references to assist in case analysis, similar case reference, and legal reasoning. Attached Figure Description
[0014] Figure 1 This is a flowchart illustrating the steps of a legal case retrieval method based on similarity calculation, which is the main feature of this embodiment. Detailed Implementation
[0015] The present invention will be further described in detail below with reference to the following embodiments.
[0016] Reference Figure 1 A legal case retrieval method based on similarity calculation, the method includes the following steps: Step S1: Obtain the user's search request. Based on the user's search request, perform legal intent analysis and standardized expansion to generate query metadata. The query metadata includes the nature of the case, cause of action, judgment time, territorial jurisdiction, and core legal relationship tags.
[0017] Step S2: Based on the query metadata, retrieve the corresponding unstructured judgment documents, perform text cleaning, privacy desensitization, and sentence standardization on the unstructured judgment documents to obtain preprocessed text, obtain the semantic boundary rules of legal documents, and based on the semantic boundary rules of legal documents, divide the preprocessed text into key fact segments, dispute focus segments, and legal application segments. For text segments in the key fact segments, dispute focus segments, and legal application segments that exceed a preset length threshold, perform semantic integrity recursive segmentation, and output the segmented structured text.
[0018] Step S3: Based on the segmented structured text, feature extraction and vector encoding are performed on the key fact paragraphs, disputed focus paragraphs, and applicable law paragraphs, respectively, to obtain multi-dimensional structured features and high-dimensional semantic vectors.
[0019] Step S4: Obtain the full case database. Based on the query metadata, multi-dimensional structured features, and high-dimensional semantic vectors, perform a three-dimensional hybrid comparison of vector cosine similarity, action sequence LCS similarity, and legal provision hierarchical overlap on the full case database using distributed parallel computing to obtain a Top-K preliminary screening list of cases that match the user's query intent.
[0020] Step S5: Based on the case types determined by the Top-K preliminary screening case list and the query metadata, retrieve the corresponding matching weight coefficients from the preset weight library for weighted sorting, and perform secondary fine sorting and legal reasoning on the multi-dimensional structured features to obtain interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.
[0021] Specifically, this involves constructing a complete closed-loop process from parsing user search requests, preprocessing and segmenting documents, structuring text blocks, to feature extraction, multi-dimensional similarity comparison, and weighted ranking. It breaks through the traditional legal search model of simple keyword matching by splitting judgment documents into key fact sections, disputed focus sections, and legal application sections. Furthermore, it addresses the semantic fragmentation problem of long texts through recursive segmentation based on semantic integrity, achieving standardized and structured transformation of unstructured judgment documents. Through legal ontology knowledge graphs, four-layer intent analysis, and multi-dimensional concept expansion, it can accurately identify the deeper intents behind fuzzy natural language searches, such as legal causes of action, legal relationships, and the basis of claims, effectively solving the problems of missed detections, false detections, and failed synonym matching in traditional keyword searches. By introducing a distributed parallel computing architecture, this system supports batch comparison of three-dimensional hybrid similarity across the entire database of court judgments, balancing retrieval accuracy and response speed. It breaks away from the traditional "black box output" model of retrieval, synchronously outputting factual basis, comparisons of differences in disputed points, and logical justifications for the application of legal provisions after fine-tuning. This provides legal professionals with traceable and verifiable retrieval references, assisting in case analysis, similar case reference, and legal reasoning. The system mentioned in this paper includes a user query input module, a data preprocessing module, a key fact processing module, a disputed point processing module, a legal application processing module, a database module, a supercomputer computing processing module, a retrieval result processing module, and a rearrangement reasoning module. In step S2, the data preprocessing module cleans and desensitizes the input unstructured court judgment text. Based on semantic boundary recognition rules, the unstructured court judgment is divided into three functional text blocks: key facts, disputed points, and legal application. Long texts undergo recursive block processing based on semantic integrity. In step S4, the supercomputer computing processing module, as the core computing engine of the system, receives the semantic vectors, action tag sequences, and sets of legal entries to be processed. This module utilizes the parallel computing framework of supercomputing to perform full-scale hybrid similarity comparison tasks, including cosine similarity calculation in vector space, longest common subsequence (LCS) calculation of label sequences, and weighted similarity calculation of label sets, and summarizes the multidimensional comparison results to return a Top-K preliminary screening list.
[0022] The specific step S1 includes the following sub-steps: It receives precise queries, combined condition queries, or natural language fuzzy queries from users and outputs the user's search request.
[0023] We acquire historical judgment data and legal databases, and based on this data, we construct a legal ontology knowledge graph. This legal ontology knowledge graph includes legal entity relationships, cause-of-case hierarchical relationships, legal provision relationships, and the basis of claims.
[0024] Based on the legal ontology knowledge graph, the user's search request is processed in four layers: legal entity identification, case classification, basis of claim analysis, and query intent disambiguation, to obtain the processing result.
[0025] The processing results are expanded using synonyms, hierarchical concepts, and legal provisions to generate query metadata.
[0026] Specifically, the system receives this fuzzy natural language query information and treats it as a user search request. The processing of the user search request and query metadata is handled by the user query input module. The system obtains data on judgments issued by courts nationwide over the past five years from publicly available sources, and also accesses legal databases such as the Civil Code and the Civil Procedure Law, using this data and legal provisions to construct a legal ontology knowledge graph. Based on this knowledge graph, the system first identifies the legal entities from the user search request, then categorizes the cases, analyzes the user's claim basis, and eliminates vague expressions in the query intent to determine that the user is not seeking legal advice but rather searching for similar judgments. After completing these four layers of processing, the system expands the processing results and, combined with the nature of the case, generates complete query metadata.
[0027] The specific step S3 includes the following sub-steps: The key fact segments in the segmented structured text are processed by dual representation of structured sequence and dense vector, and the dual representation results of key facts are output.
[0028] Based on the key fact annotation data in historical judgment documents, a legal behavior action extraction model is constructed. The dual representation results of key facts are input into the legal behavior action extraction model to form a five-tuple sequence of subject, behavior, object, result and time, and then mapped into an action label chain.
[0029] We acquire a massive amount of legal judgment documents, construct a pre-trained language model specifically for the legal field, and input the dual representation results of key facts into the pre-trained language model for encoding to obtain the key fact encoding results.
[0030] Temporally weighted LCS processing is performed on the action tag chain to obtain the key fact action sequence similarity results.
[0031] The key fact encoding results are fused and statistically analyzed using cosine similarity and Manhattan distance to obtain the key fact semantic similarity results.
[0032] The key fact action sequence similarity results and key fact semantic similarity results are combined into a key fact comprehensive similarity result, which is then incorporated into multidimensional structured features and high-dimensional semantic vectors.
[0033] Based on the data of disputed focus markings in historical judgment documents, a multi-level disputed focus labeling system for judicial scenarios is constructed, consisting of primary, secondary, and tertiary focus points, and a focus label set is output.
[0034] Map the disputed focal segments to the focal label set and output the focal label confidence results.
[0035] Based on the opposing relationships of disputed points, the correspondence between claims and defenses marked in historical judgment documents, a supervisory signal is constructed. According to the supervisory signal, the disputed point segments are specifically coded in judicial semantics, and the semantic coding results of the points are output.
[0036] By performing label hierarchy overlap statistics on the confidence scores of the focus labels, coarse-grained results of the disputed focus matching are obtained.
[0037] Vector similarity statistics are performed on the semantic encoding results of the focus to obtain fine-grained semantic comparison results of the disputed focus.
[0038] The coarse-grained matching results and the fine-grained semantic comparison results of the disputed focus are combined into the comprehensive similarity result of the disputed focus, and the comprehensive similarity result of the disputed focus is incorporated into the multi-dimensional structured features and high-dimensional semantic vectors.
[0039] Based on the legal ontology knowledge graph and the legal regulations database, we construct structured extraction rules for legal provisions and alignment rules for the legal knowledge graph.
[0040] Based on the rules for structured extraction of legal provisions and the alignment rules for legal knowledge graphs, legal information is extracted from the legal application sections of the segmented structured text to obtain the results of the legal information extraction.
[0041] The extracted legal information is matched with the legal database to output a structured matching result of the legal provisions.
[0042] Based on the relationships in the legal ontology knowledge graph, the extracted legal information is labeled with judicial attributes and related bases to obtain the legal application labeling results.
[0043] Based on the legal ontology knowledge graph and historical judgment texts, a multidimensional judicial weight coefficient is preset. Based on the structured matching results of legal provisions and the annotation results of legal application, the multidimensional judicial weight coefficient is introduced for weighted statistics to obtain the multidimensional legal application similarity. The multidimensional legal application similarity is then incorporated into the multidimensional structured features and high-dimensional semantic vector.
[0044] Specifically, the key fact processing module receives key fact segments transmitted by the data preprocessing module. This module uses a pre-trained action extraction model to restore the text to an abstract semantic action label sequence; simultaneously, it uses a legal pre-trained language model to extract high-dimensional key fact semantic vectors, achieving a dual representation of fact description from natural language to structured sequences and dense vectors. For example, the key fact segments in the previously obtained segmented structured text are processed, transforming the text into a structured sequence arranged in chronological order and into dense vectors, completing the dual representation processing and outputting the dual representation results of key facts. The system extracts 10,000 decoration and renovation contract dispute documents labeled with key facts from historical judgments, using this data to train and construct a legal action extraction model (for example, the system collects a large number of publicly available judgments in the legal field as training corpus. Using these legal-specific corpora, the system performs legal semantic learning and optimization on existing general text encoding models, familiarizing the model with legal terminology, judgment sentence structures, and case fact descriptions. After learning and training, a legal-specific pre-trained language model suitable for semantic understanding and vector encoding of legal documents is constructed). The system trains a pre-trained language model specifically for the legal domain (e.g., it collects a large number of publicly available legal judgments as training corpora. Using these legal-specific corpora, the system performs legal semantic learning and optimization on existing general text encoding models (such as BERT), familiarizing the model with legal terminology, judgment sentence structures, and the way facts are expressed in cases. After training, a pre-trained language model specifically for the legal domain, suitable for semantic understanding and vector encoding of legal documents, is constructed. This model can accurately understand the semantic logic of legal texts. The dual representation results of key facts are input into this model for encoding, resulting in key fact encoding results containing complete semantic information of the case facts. Temporal weighted LCS processing is applied to the previously obtained action label chain, assigning different weights to actions at different time points. Breach of contract during the construction phase has a higher weight than preparatory actions, and actions causing actual losses have a higher weight than simple breach of contract actions. The similarity of the key fact action sequences is calculated. After temporal weighted LCS processing, the similarity of the action sequences reaches 0.86. The system simultaneously calculates cosine similarity and Manhattan distance for the encoded key facts, and then merges the two similarity results in a 1:1 ratio to obtain the semantic similarity result for the key facts. The semantic similarity between this document and the user's search request is 0.82. The action sequence similarity result and the semantic similarity result for the key facts are combined in a 0.6:0.4 ratio to obtain a comprehensive similarity result of 0.844. This result is then incorporated into multidimensional structured features and high-dimensional semantic vectors as an important basis for subsequent case comparisons. The dispute focus processing module receives dispute focus segments transmitted by the data preprocessing module. This module uses a dispute focus classification model to map the text to a predefined set of standard dispute focus labels and simultaneously generates semantic vectors for the dispute focus. For example, from historical judgment documents' dispute focus annotation data, a multi-level dispute focus label system for judicial scenarios is constructed. The first-level focus is whether the contract is valid; the second-level focus is whether a breach of contract has occurred; and the third-level focus is how liability for breach of contract should be borne, forming a focus label set containing more than 200 labels. The system maps the dispute focus segment "Did the decoration company delay the construction period and substitute materials? Does the homeowner have the right to terminate the contract and demand compensation?" in the segmented structured text to the focus label set, obtaining the confidence results for the focus labels. The confidence score for "breach of contract established" is 0.92, and the confidence score for "right to terminate the contract established" is 0.88. Based on the opposing relationships of dispute focus already annotated in historical judgment documents, such as the breaching party's defense that the construction delay was caused by the homeowner, and that substituting materials is an industry practice, as well as the correspondence between the right to claim and the right to defend, the system constructs a supervisory signal. This monitoring signal is used to perform judicial semantic-specific encoding on the disputed focus segments, outputting the focus semantic encoding results. The encoding results can distinguish the semantic differences between reasonable and unreasonable defenses. The system performs label-level overlap statistics on the focus label confidence results to obtain coarse-grained results of disputed focus matching, with a label overlap of 0.85 with the target case; vector similarity statistics are performed on the focus semantic encoding results to obtain fine-grained semantic comparison results of disputed focus, with a semantic similarity of 0.83. The coarse-grained matching results and fine-grained semantic comparison results of disputed focus are combined at a ratio of 0.5:0.5 to obtain a comprehensive similarity result of 0.84 for disputed focus, which is then incorporated into multi-dimensional structured features and high-dimensional semantic vectors. The system receives the legal application segment transmitted by the data preprocessing module through the legal application processing module. This module uses regular expressions and knowledge graph alignment technology to extract legal entries and matches them with the program's built-in legal database, recording structured information including the code name, entry number, and legal effect hierarchy. For example, based on the previously constructed legal ontology knowledge graph and legal database, it formulates structured extraction rules for legal provisions, specifying the number, content, and applicable circumstances of the extracted provisions. Simultaneously, it formulates legal knowledge graph alignment rules to ensure precise alignment between the extracted provisions and the legal entities and relationships in the knowledge graph. Using these two rules, the system extracts legal provision information from the legal application segment in the segmented structured text, obtaining Articles 509, 577, 585, and 945 of the Civil Code of the People's Republic of China. The extracted legal provision information is matched with the legal database, outputting the structured matching results, confirming that these provisions are applicable to decoration and renovation contract disputes. Based on the relationships within the legal ontology knowledge graph, the system labels the extracted legal information with judicial attributes. Article 509 is a clause on contract performance obligations, Article 577 is a clause on breach of contract liability, Article 585 is a clause on liquidated damages, and Article 945 is a clause specific to decoration and renovation contracts. The system also labels the association based on the fact that the decoration company's failure to fulfill its contractual obligations constitutes a breach of contract, and the homeowner can claim breach of contract liability, thus obtaining the legal application labeling result. Based on the legal ontology knowledge graph and historical judgment texts, the system presets multi-dimensional judicial weight coefficients: 0.4 for breach of contract liability clauses, 0.3 for contract performance clauses, 0.2 for liquidated damages clauses, and 0.1 for specific clauses. Using the structured matching results of the legal provisions and the legal application labeling results, combined with the multi-dimensional judicial weight coefficients, a weighted statistical analysis is performed, resulting in a multi-dimensional legal application similarity of 0.87, which is then incorporated into the multi-dimensional structured features and high-dimensional semantic vector. Based on multidimensional structured features and high-dimensional semantic vectors, features, vectors, legal provisions, and original texts are linked and bound using a unified case identifier (Case_ID). This is achieved through a hybrid storage system consisting of a vector database and a relational database. The vector database stores high-dimensional semantic vectors of key facts and points of contention; the relational database stores legal and regulatory entries, original document texts, structured tags, and sequence information.
[0045] The specific step S5 includes the following sub-steps: Based on the legal ontology knowledge graph, historical judgment documents, and legal database, a weight database is preset. Based on the case type determined by the query metadata, the matching weight coefficients of five dimensions corresponding to the case type are retrieved from the weight database: key facts, action sequence, points of contention, and applicable law.
[0046] Based on the matching weight coefficient, the Top-K preliminary screening case list is weighted to obtain a comprehensive similarity score. The comprehensive similarity scores are then sorted in descending order to output a candidate case ranking table.
[0047] Based on multidimensional structured features, the time sequence of key facts of candidate cases in the candidate case ranking table is matched with the time sequence of search requirements of the query metadata. The focus of the dispute of candidate cases in the candidate case ranking table is compared with the focus of the search requirements of the query metadata, generating interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.
[0048] Specifically, the retrieval results processing module receives the Top-K preliminary case list returned by the supercomputer computing processing module. This module employs an adaptive linear weighted fusion strategy, weighting and summing the vector similarity of key fact segments, the LCS similarity of action sequences, the vector similarity of disputed focus segments, the label overlap of disputed focus segments, and the hierarchical overlap of the applicable law segment. This generates a comprehensive similarity score, which is then sorted in descending order. The original text is restored using Case_ID. For example, based on a legal ontology knowledge graph, a vast database of historical judgments, and a legal database, multi-dimensional weighting preset rules are established. First, cases with different causes of action are labeled, and the influence of key facts, action sequences, disputed focus, and applicable law on the case matching results is statistically analyzed. Then, the basic weights for each dimension are obtained through fitting using the analytic hierarchy process and entropy weighting method, forming a preset weight library. For decoration and renovation contract disputes, based on historical data of such cases, matching weight coefficients are fitted with: key facts weight 0.3, action sequence weight 0.2, disputed focus weight 0.3, and applicable law weight 0.2. The system determines the case type as a decoration and renovation contract dispute based on the query metadata, and retrieves the corresponding weight coefficients for the five dimensions from the weight database. These coefficients are then used to weight each case in the Top-K initial screening case list: the overall similarity of key facts is multiplied by 0.3, the similarity of action sequences by 0.2, the overall similarity of the points of contention by 0.3, and the similarity of applicable law by 0.2. These are then summed to obtain the overall similarity score. For example, the case ranked first in the initial screening list has an overall similarity score of 0.852, the second ranked case has 0.813, and the third ranked case has 0.786. The cases are then sorted from highest to lowest score, and a candidate case ranking table is output. Through the rearrangement reasoning module, the candidate case ranking table undergoes secondary fine-tuning (e.g., fine-tuning based on factual chronology alignment and focus hierarchy matching) and legal reasoning (e.g., reasoning based on factual basis, focus comparison, and legal application logic). Based on multi-dimensional structured features, the key factual chronology of the cases in the candidate case ranking table is matched with the factual chronology of the retrieval requirements corresponding to the query metadata, confirming that the case ranked first is completely consistent with the factual occurrence order and behavioral flow of the user's retrieval request. Then, the disputed focus of the candidate cases is compared with the focus of the retrieval requirements, confirming that the core disputes are exactly the same, and finally, interpretable retrieval results are generated.
[0049] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A similarity calculation-based legal case search method, characterized by, Includes the following steps: Step S1: Obtain the user's search request; based on the user's search request, perform legal intent analysis and standardized expansion to generate query metadata, which includes case nature, cause of action, judgment time, territorial jurisdiction, and core legal relationship tags. Step S2: Based on the query metadata, retrieve the corresponding unstructured judgment documents, perform text cleaning, privacy desensitization, and sentence standardization on the unstructured judgment documents to obtain preprocessed text, obtain the semantic boundary rules of legal documents, and based on the semantic boundary rules of legal documents, divide the preprocessed text into key fact segments, dispute focus segments, and legal application segments. Perform semantic integrity recursive block division on the text segments in the key fact segments, dispute focus segments, and legal application segments that exceed the preset length threshold, and output the block-divided structured text. Step S3: Based on the segmented structured text, feature extraction and vector encoding are performed on the key fact section, the disputed focus section, and the legal application section respectively, and multi-dimensional structured features and high-dimensional semantic vectors are obtained in combination. Step S4: Obtain the full case database. Based on the query metadata, multi-dimensional structured features, and high-dimensional semantic vectors, perform a three-dimensional hybrid comparison of vector cosine similarity, action sequence LCS similarity, and legal provision hierarchical overlap on the full case database using distributed parallel computing to obtain a Top-K preliminary screening list of cases that match the user's query intent. Step S5: Based on the case types determined by the Top-K preliminary screening case list and the query metadata, retrieve the corresponding matching weight coefficients from the preset weight library for weighted sorting, and perform secondary fine sorting and legal reasoning on the multi-dimensional structured features to obtain interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.
2. The legal case retrieval method based on similarity calculation according to claim 1, characterized in that, Step S1 includes: Receive precise query, combined condition query, or natural language fuzzy query information input by the user, and output the user's search request; Acquire historical judgment documents and legal databases, and construct a legal ontology knowledge graph based on the historical judgment documents and legal databases. The legal ontology knowledge graph includes legal entity relationships, cause-of-case hierarchical relationships, legal provision relationships, and claims basis relationships. Based on the aforementioned legal ontology knowledge graph, the user's search request is processed in four layers: legal entity identification, case classification, basis of claim analysis, and query intent disambiguation, to obtain the processing result. The processing results are expanded using synonyms, hierarchical concepts, and legal provisions to generate query metadata.
3. The legal case retrieval method based on similarity calculation according to claim 2, characterized in that, Step S3 includes: The key fact segments in the segmented structured text are subjected to dual representation processing of structured sequence and dense vector, and the dual representation results of key facts are output. Based on the key fact annotation data in the historical judgment documents, a legal behavior action extraction model is constructed. The dual representation results of the key facts are input into the legal behavior action extraction model to form a five-tuple sequence of subject, behavior, object, result and time, and mapped into an action tag chain. We acquire a massive amount of legal judgment documents, construct a pre-trained language model specifically for the legal field, and input the dual representation results of key facts into the pre-trained language model for encoding to obtain the key fact encoding results.
4. The legal case retrieval method based on similarity calculation according to claim 3, characterized in that, Step S3 also includes: The action tag chain is subjected to time-weighted LCS processing to obtain the key fact action sequence similarity results; The key fact encoding results are fused and statistically analyzed using cosine similarity and Manhattan distance to obtain the key fact semantic similarity results; The key fact action sequence similarity results and key fact semantic similarity results are combined into a key fact comprehensive similarity result, which is then incorporated into multidimensional structured features and high-dimensional semantic vectors.
5. The legal case retrieval method based on similarity calculation according to claim 4, characterized in that, Step S3 also includes: Based on the data of disputed issues marked in historical judgment documents, a multi-level disputed issue labeling system for judicial scenarios is constructed, consisting of primary, secondary, and tertiary issues, and a set of issue labels is output. Map the disputed focus segments to a focus label set and output the focus label confidence results; Based on the opposing relationships of disputed points, the correspondence between claims and defenses marked in historical judgment documents, a supervision signal is constructed. According to the supervision signal, the disputed point segments are specifically coded in judicial semantics, and the focus semantic coding results are output. The label hierarchy overlap is statistically analyzed based on the confidence scores of the focus labels to obtain coarse-grained results of the disputed focus matching. Vector similarity statistics are performed on the semantic encoding results of the focus to obtain fine-grained semantic comparison results of the disputed focus; The coarse-grained matching results and fine-grained semantic comparison results of the disputed focus are combined to form a comprehensive similarity result of the disputed focus, which is then incorporated into multi-dimensional structured features and high-dimensional semantic vectors.
6. The legal case retrieval method based on similarity calculation according to claim 5, characterized in that, Step S3 also includes: Based on the legal ontology knowledge graph and the legal regulations database, we construct structured extraction rules for legal provisions and alignment rules for the legal knowledge graph. Based on the aforementioned legal text structure extraction rules and legal knowledge graph alignment rules, legal information is extracted from the legal application section of the segmented structured text to obtain the legal information extraction results. The extracted legal information is matched with the legal database to output the structured matching results of the legal provisions. Based on the relationships in the legal ontology knowledge graph, the extracted legal information is labeled with judicial attributes and related legal basis to obtain the legal application labeling results; Based on the legal ontology knowledge graph and historical judgment texts, a multidimensional judicial weight coefficient is preset. Based on the structured matching results of the legal provisions and the legal application annotation results, the multidimensional judicial weight coefficient is introduced for weighted statistics to obtain the multidimensional legal application similarity. The multidimensional legal application similarity is then incorporated into the multidimensional structured features and the high-dimensional semantic vector.
7. The legal case retrieval method based on similarity calculation according to claim 6, characterized in that, Step 5 includes: Based on the legal ontology knowledge graph, historical judgment documents, and legal database, a weight database is preset. Based on the case type determined by the query metadata, the matching weight coefficients of the five dimensions of key facts, action sequence, points of contention, and applicable law corresponding to the case type are retrieved from the weight database. Based on the matching weight coefficient, the Top-K preliminary screening case list is weighted to obtain a comprehensive similarity score. The comprehensive similarity scores are then sorted in descending order to output a candidate case ranking table. Based on multidimensional structured features, the time sequence of key facts of candidate cases in the candidate case ranking table is matched with the time sequence of search requirements of the query metadata. The focus of the dispute of candidate cases in the candidate case ranking table is compared with the focus of the search requirements of the query metadata, generating interpretable search results that include factual basis, focus comparison, and reasons for the application of legal provisions.