A legal system case search method and system
By assessing the ambiguity of legal elements and using semantic vector analysis, similar cases with subtle differences are screened out, solving the problem of difficulty in capturing differences between cases in existing technologies, and achieving more accurate case retrieval and legal analysis.
Patent Information
- Application Number
- CN202510829676.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-06-20
AI Technical Summary
Existing case retrieval systems struggle to capture subtle differences between cases, leading to divergent judgments and a lack of differentiated retrieval capabilities.
By determining the ambiguity of each legal element of the case to be searched, and based on semantic vector analysis and nonlinear layer processing, the similarity and difference between cases are calculated, and cases with a total similarity greater than a threshold and the similarity of the legal element with the highest ambiguity less than the threshold are selected.
It enables searches that focus on subtle differences in broadly similar cases, providing a more comprehensive legal understanding and more ways to defend oneself, thus improving the accuracy and depth of case searches.
Smart Images

Figure CN120353922B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of information retrieval technology, and in particular to a method and system for case retrieval in a legal system. Background Technology
[0002] In legal practice, case retrieval refers to finding highly similar historical cases from a large case database based on a specific legal case, in order to compare and analyze their application of law, fact-finding, judgment logic, and even the final judgment. It has irreplaceable and important value in legal practice and research.
[0003] Currently, existing case retrieval systems primarily offer coarse-grained similarity searches, often focusing on keyword matching, co-occurrence of legal provisions, case tags, party identities, and basic case categories. This retrieval mechanism relies on relatively superficial similarity standards, emphasizing the degree of similarity in structured attributes (such as basic facts and charges) or textual semantics, while lacking in-depth exploration and presentation of the "key differences" between cases. However, in judicial decisions, many disagreements lie precisely behind seemingly similar cases. These types of cases—which we can call cases where subtle differences lead to divergent judgments—are the part that existing case retrieval systems struggle to capture.
[0004] Therefore, it is essential to propose a differentiated case retrieval strategy. The goal of this type of retrieval is no longer merely to find the "most similar" cases, but rather to deliberately identify and compare subtle differences that may affect the judgment, provided that the cases are broadly similar (e.g., consistent basic facts and applicable legal frameworks), and present these differences in an interpretable manner. This not only helps judges to understand the application of various similar provisions more comprehensively and deeply, but also allows defense lawyers to find more ways to raise objections. Summary of the Invention
[0005] This invention provides a legal system case retrieval method and system to address the shortcomings of existing case retrieval methods that make it difficult to perform differentiated retrieval.
[0006] This invention provides a method for case retrieval in a legal system, comprising:
[0007] Receive the case query text containing the basic facts and judgment of the case to be searched;
[0008] Determine the ambiguity of each legal element of the case to be searched based on the relevant legal provisions; the higher the ambiguity of any legal element, the higher the possibility that any legal element contains multiple legal interpretations.
[0009] Based on the legal provisions upon which the case to be searched is based, a case database is retrieved to obtain intermediate query results;
[0010] Based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the fuzziness of each legal element, the similarity between any case and the case to be retrieved for each legal element, and the total similarity between any case and the case to be retrieved are determined.
[0011] The query results are obtained by filtering out cases from the intermediate query results whose total similarity with the case to be retrieved is greater than the first threshold and whose similarity with the legal constituent elements with the highest ambiguity is less than the second threshold.
[0012] According to the case retrieval method for a legal system provided by the present invention, the ambiguity of any legal element constituting the case to be retrieved based on the legal provisions is determined based on the following steps:
[0013] Retrieve a set of cases in the case database that are based on the same legal provisions as the case to be retrieved;
[0014] For any legal element, determine the initial semantic vector of the factual text fragments corresponding to any legal element in each case in the case set;
[0015] Based on the differences between the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case, the ambiguity of any of the legal elements is determined.
[0016] According to a case retrieval method for a legal system provided by the present invention, determining the ambiguity of any legal element based on the differences between the initial semantic vectors of the factual text fragments corresponding to any legal element in each case includes:
[0017] Cluster the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case to obtain one or more clusters;
[0018] If there is only one cluster, the ambiguity of determining any of the legal constituent elements is the first preset value;
[0019] Otherwise, the ambiguity of any legal constituent element is determined based on the number of cluster pairs whose distance between cluster centers is greater than a preset threshold.
[0020] According to the case retrieval method for a legal system provided by the present invention, the semantic vector of the first factual text fragment or the second factual text fragment corresponding to any legal element is determined based on the following steps:
[0021] The initial semantic vector of the target factual text fragment corresponding to any legal element is obtained based on the language model; the target factual text fragment is either the first factual text fragment or the second factual text fragment.
[0022] The initial semantic vector of the target factual text fragment is input into a nonlinear layer to obtain the directional vector of the target factual text fragment; the directional vector has the same dimension as the initial semantic vector.
[0023] For any dimension, the vector value corresponding to the dimension in the initial semantic vector of the target fact text fragment is taken as the real part, and the vector value corresponding to the dimension in the directional vector is taken as the imaginary part, to obtain the complex value corresponding to the dimension.
[0024] The complex values corresponding to each dimension are combined to form the semantic vector of the target factual text fragment.
[0025] According to the case retrieval method for a legal system provided by the present invention, the similarity between any case and any legal element corresponding to the case to be retrieved is calculated based on the following steps:
[0026] The initial semantic vector of the second factual text fragment corresponding to any legal element of any case is calculated, and the initial semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved is used as the first similarity.
[0027] Calculate the conjugate vector of the semantic vector of the second factual text fragment corresponding to any legal element of the case and the dot product of the semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved;
[0028] The degree of difference is determined based on the phase angle of the dot product;
[0029] Based on the first similarity and the difference, the similarity between any case and any legal element corresponding to the case to be retrieved is determined.
[0030] According to a legal system case retrieval method provided by the present invention, the total similarity between any case and the case to be retrieved is calculated based on the following steps:
[0031] Based on the ambiguity of each legal element, the similarity between any case and the case to be retrieved for each legal element is weighted and summed to obtain the total similarity between any case and the case to be retrieved.
[0032] This invention also provides a legal system case retrieval system, comprising:
[0033] The query text receiving unit is used to receive the case query text containing the basic case facts and judgment results corresponding to the case to be retrieved;
[0034] The ambiguity assessment unit is used to determine the ambiguity of each legal element of the case to be retrieved based on the legal provisions; the higher the ambiguity of any legal element, the higher the possibility that the legal element contains multiple legal interpretations.
[0035] The first retrieval unit is used to retrieve a case library based on the legal provisions upon which the case to be retrieved is based, and to obtain intermediate query results;
[0036] The similarity assessment unit is used to determine the similarity between any case and the case to be retrieved for each legal element based on the semantic vector of the first factual text fragment corresponding to each legal element in the basic case, the semantic vector of the second factual text fragment corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element.
[0037] The second retrieval unit is used to filter cases from the intermediate query results that have a total similarity greater than a first threshold and a similarity of the legal constituent element with the highest ambiguity less than a second threshold, thereby obtaining the query results.
[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the legal system case retrieval method as described above.
[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the legal system case retrieval method as described above.
[0040] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the legal system case retrieval method as described above.
[0041] This invention provides a legal system case retrieval method and system. By determining the ambiguity of each legal element of the case to be retrieved, and searching a case database based on the legal element, intermediate query results are obtained. Then, based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case facts, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element, the similarity between the case and the case to be retrieved for each legal element, as well as the total similarity between the two cases, is determined. Cases with a total similarity greater than a first threshold and a similarity to the legal element with the highest ambiguity less than a second threshold are selected from the intermediate query results and returned to the user. By introducing ambiguity assessment of legal elements, legal element-level comparison based on semantic vectors, and a filtering strategy combining similarity and difference conditions, case retrieval focusing on differences is achieved. Attached Figure Description
[0042] Figure 1 This is a flowchart illustrating the case retrieval method for the legal system provided by the present invention;
[0043] Figure 2 This is a flowchart illustrating the method for determining the ambiguity of constituent elements provided by the present invention;
[0044] Figure 3 This is a flowchart illustrating the semantic vector extraction method provided by the present invention;
[0045] Figure 4 This is a schematic diagram of the structure of the legal system case retrieval system provided by the present invention;
[0046] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0048] Figure 1 This is a flowchart illustrating the case retrieval method for the legal system provided by the present invention, as shown below. Figure 1 As shown, the method includes:
[0049] Step 110: Receive the case query text containing the basic facts and judgment of the case to be searched;
[0050] Step 120: Determine the ambiguity of each legal element of the case to be searched based on the legal provisions; the higher the ambiguity of any legal element, the higher the possibility that any legal element contains multiple legal interpretations.
[0051] Step 130: Based on the legal provisions upon which the case to be searched is based, search the case database to obtain intermediate query results;
[0052] Step 140: Based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the fuzziness of each legal element, determine the similarity between any case and the case to be retrieved for each legal element, and the total similarity between any case and the case to be retrieved.
[0053] Step 150: Filter out cases from the intermediate query results that have a total similarity greater than the first threshold and a similarity of the legal constituent element with the highest ambiguity less than the second threshold to obtain the query results.
[0054] Specifically, users can input the case query text corresponding to the case they wish to retrieve through a human-computer interaction interface. This query text includes a description of the cause of action, the judgment, and the basic facts of the case (i.e., the description of the fact-finding section). Using natural language processing technology, based on existing language models, the case query text can be semantically structured and parsed to extract the legal provisions upon which the judgment is based, as well as factual text fragments related to the legal elements corresponding to those provisions. The legal elements corresponding to any legal provision can be obtained from a pre-built legal knowledge base, and the factual text fragments related to any legal element may or may not meet the conditions of that legal element in terms of factual determination.
[0055] After extracting the aforementioned textual structure information from the case query text, the next step is to identify the ambiguity of legal elements. Each legal provision typically contains multiple legal elements in judicial application, such as "subjective intent" and "damage." However, due to the inherent ambiguity of some legal elements, these vague legal concepts may lead to different legal interpretations. For example, "negligence" refers to the actor's failure to foresee the potential harmful consequences, but if, under the same conditions, the actor should have foreseen the consequences, it could be considered negligence. However, in actual cases, the term "negligence" is quite ambiguous, and determining whether the actor "should" have foreseen the result often leads to completely different legal judgments. It is evident that the legal interpretation of ambiguous legal elements may differ in different cases, and these differences can lead to entirely different judgments. Therefore, in order to retrieve cases that are broadly similar (e.g., consistent basic facts and legal application framework) but with subtle differences affecting the judgment, it is possible to identify cases with ambiguous legal elements.
[0056] Therefore, the ambiguity of each legal element in the legal provisions upon which the searched case is based can be quantitatively assessed to obtain the ambiguity of each legal element. The higher the ambiguity of any legal element, the higher the likelihood that the element will be subject to multiple legal interpretations in practice, the more likely it is to cause controversy, and the more likely it is to become the root cause of differences in judgments.
[0057] In some embodiments, such as Figure 2 As shown, the ambiguity of any legal element constituting the case to be searched, based on the legal provisions, is determined according to the following steps:
[0058] Step 210: Retrieve a set of cases in the case database whose legal provisions are the same as those of the case to be retrieved;
[0059] Step 220: For any legal element, determine the initial semantic vector of the factual text fragments corresponding to any legal element in each case in the case set;
[0060] Step 230: Based on the differences between the initial semantic vectors of the factual text fragments corresponding to any legal element in each case, determine the ambiguity of any legal element.
[0061] Legal provisions are often structured, containing several specific legal elements. In traditional searches, these elements are often treated as a whole, making it difficult to identify potential ambiguities. This embodiment treats legal elements as core semantic units, processing and evaluating them separately. Here, in order to quantitatively identify the degree of ambiguity of each legal element in the searched cases, and thus support the subsequent "focusing on differences" case selection logic, a method for calculating the ambiguity of legal elements based on semantic vector distribution differences is designed. This method quantifies the "ambiguity" or "degree of divergence" of the legal element in practice by analyzing the differences in language expression regarding the same legal element in different historical cases under the same legal provision within a case database.
[0062] To assess the ambiguity of each legal element, the system first performs clause-level screening in the case database, selecting a set of cases from all historical cases that share the same legal clauses as the case to be retrieved. This set forms the sample pool for ambiguity assessment. Next, for each specific legal element under that legal clause, the system extracts the corresponding factual text fragment from each case in the case database. After obtaining the factual text fragments corresponding to each legal element in each case, each fragment is transformed into an initial semantic vector using a language model (e.g., LegalBERT). Subsequently, the differences between the initial semantic vectors of the factual text fragments corresponding to the same legal element in different cases are measured, and the ambiguity of the legal element is determined based on these differences.
[0063] In some embodiments, statistical distribution methods can be used to analyze the differences in the initial semantic vectors corresponding to the same legal element in different cases. For example, the sum of the variances of each initial semantic vector in each semantic dimension can be calculated as the ambiguity of the legal element. The larger the variance, the greater the expression difference of the same legal element in different cases, indicating that there are more possible interpretation paths. In other embodiments, unsupervised clustering can be performed on the initial semantic vectors of the factual text fragments corresponding to the legal element in each case to obtain one or more clusters. If there is only one cluster, the ambiguity of the legal element is determined to be a first preset value (which can be a small value). Otherwise, the ambiguity of the legal element is determined based on the number of cluster pairs whose distance between cluster centers is greater than a preset threshold (this can be achieved by combining clusters in pairs to obtain several cluster pairs, and then calculating the distance between the two cluster centers in each cluster pair to filter out cluster pairs whose distance between cluster centers is greater than a preset threshold). The greater the number of cluster pairs whose distance between cluster centers is greater than a preset threshold, the more distinct semantic clusters are formed by the vectors of the legal elements, the greater the possibility that the legal elements have multiple interpretations in practice, and thus the greater the ambiguity in determining the legal elements.
[0064] As can be seen, the above embodiments, by introducing a fuzziness recognition mechanism based on semantic vector distribution, achieve accurate modeling of the fuzziness of legal elements, making the entire case retrieval system more sensitive when dealing with complex cases, marginal precedents, or case disagreements. Throughout the case retrieval process, this fuzziness information will be used as a core parameter for subsequent case screening and weighting.
[0065] After preparing the data as described above, based on the legal provisions upon which the cases to be searched are grounded, a set of cases in the case database that are based on the same legal provisions but have different judgments are retrieved, forming the intermediate query results. This crucial step ensures that subsequent screening steps do not focus on all similar cases, but rather on those that are factually similar but have differing legal consequences, thus providing material for analyzing the legal application logic behind subtle differences.
[0066] Next, a detailed semantic comparison is performed on each case in the intermediate query results and the case to be retrieved. Specifically, for any case in the intermediate query results, factual text fragments related to the legal elements isomorphic to the legal elements of the case to be retrieved are extracted from that case, and semantic vector encoding is performed on each fragment. For ease of description, the factual text fragments corresponding to each legal element in the basic facts of the case to be retrieved are referred to as the first factual text fragments, and the factual text fragments corresponding to each legal element in the basic facts of the cases in the intermediate query results are referred to as the second factual text fragments. The semantic vectors of the first and second factual text fragments corresponding to the same legal element are obtained. Based on the semantic vectors of the first and second factual text fragments corresponding to each legal element, and combined with the ambiguity of each legal element, the similarity between the corresponding case in the intermediate query results and the case to be retrieved for each legal element, as well as the total similarity between the case and the case to be retrieved, can be determined. In some embodiments, based on the similarity between the case and the case to be retrieved for each legal element, the ambiguity of each legal element can be introduced for weighting, thereby obtaining the total similarity between the case and the case to be retrieved. By weighting the similarity and ambiguity of each legal element, a higher similarity is required for legal elements with lower ambiguity to ensure a higher overall similarity, while the similarity requirement is less stringent for legal elements with higher ambiguity. The significance of this approach is that it allows us to focus on cases where the facts corresponding to certain legal elements (i.e., those with lower ambiguity) are similar, but the facts corresponding to ambiguous legal elements (i.e., those with higher ambiguity) differ.
[0067] Considering the unique characteristic of difference-based retrieval tasks compared to regular retrieval tasks—the need to simultaneously focus on both "similarity" and "difference"—it is necessary to design a suitable semantic vector extraction scheme and a similarity measurement scheme based on it specifically for difference-based retrieval tasks. Regarding the semantic vector extraction scheme, in some embodiments, such as... Figure 3 As shown, the semantic vector of the first or second factual text fragment corresponding to any legal element can be determined based on the following steps:
[0068] Step 310: Obtain the initial semantic vector of the target factual text fragment corresponding to any legal element based on the language model; the target factual text fragment is either the first factual text fragment or the second factual text fragment.
[0069] Step 320: Input the initial semantic vector of the target factual text fragment into a nonlinear layer to obtain the directional vector of the target factual text fragment; the directional vector has the same dimension as the initial semantic vector;
[0070] Step 330: For any dimension, take the vector value corresponding to the dimension in the initial semantic vector of the target fact text fragment as the real part and the vector value corresponding to the dimension in the directional vector as the imaginary part to obtain the complex value corresponding to the dimension.
[0071] Step 340: Combine the complex values corresponding to each dimension into a semantic vector of the target factual text fragment.
[0072] In this embodiment, to further enhance the semantic expressive power of factual statements at the level of legal elements in legal cases, a complex vector structure is introduced to strengthen the directionality and ambiguity expression capabilities of semantic vectors. Especially when dealing with detailed descriptions of legal elements in cases where there are significant disagreements in legal interpretation, this mechanism can provide a richer and more refined representation of the "directionality" of factual text fragments in a specific legal semantic dimension, thereby supporting more accurate alignment of legal elements and identification of semantic differences.
[0073] Specifically, for any legal element involved in any case in the search results or any case in the intermediate query results, semantic vectors of the first and second factual text fragments corresponding to that element can be constructed. These semantic vectors are expressed in complex form, with each dimension containing not only basic semantics (real part) but also the directional features (imaginary part) exhibited by that semantics in the context. First, the target factual text fragment (either the first or second factual text fragment) is encoded using a pre-trained language model to obtain an initial semantic vector. This vector is a real number vector, meaning each vector value is a real number. This vector primarily reflects the basic semantic components carried in the corresponding factual text fragment, such as the involved subject behavior and descriptive context, but lacks the ability to model the semantic "direction," i.e., it cannot characterize the differences in the interpretive path of certain semantics. To compensate for this deficiency, after obtaining the initial semantic vector, a non-linear layer is designed. The initial semantic vector obtained in the previous step is input into this non-linear layer (e.g., a fully connected layer with ReLU or tanh activation) to obtain a directional vector with dimensions completely consistent with the initial semantic vector. This directional vector can be understood as the semantic offset trend of each dimension of semantics. If two factual text fragments corresponding to the same legal element have different interpretations of that legal element, then the difference can be reflected in the corresponding directional vectors, that is, the directional vectors of these two factual text fragments will have a large difference.
[0074] To enable the nonlinear layer to possess the above capabilities, it can be pre-trained based on the following steps:
[0075] The initial semantic vectors of each sample factual text corresponding to the above-mentioned legal elements are input into the nonlinear layer to obtain the directional vectors of each sample factual text output by the nonlinear layer.
[0076] Based on the legal interpretation annotations of any two sample factual texts (if the two sample factual texts interpret the constituent elements of the sample law differently, then their corresponding legal interpretation annotations are different), and the distance between each pair of the directional vectors of the above two sample factual texts, the model loss corresponding to the above two sample factual texts is determined; wherein, if the legal interpretation annotations of the above two sample factual texts are different, the larger the distance between the directional vectors of the above two sample factual texts, the smaller the model loss corresponding to the above two sample factual texts; if the legal interpretation annotations of the above two sample factual texts are the same, the smaller the distance between the directional vectors of the above two sample factual texts, the smaller the model loss corresponding to the above two sample factual texts.
[0077] The total model loss is determined by summing the model losses for any two sample factual texts, and the parameters of the nonlinear layer are adjusted based on the total model loss.
[0078] By repeating the above process, a trained nonlinear layer can be obtained, and the directional vector of the target factual text fragment can be obtained based on the nonlinear layer.
[0079] After obtaining the initial semantic vector (real part) and directional vector (imaginary part) of the target factual text fragment, these two sets of vectors are combined dimension by dimension. That is, for any dimension, the vector value corresponding to that dimension in the initial semantic vector of the target factual text fragment is taken as the real part, and the vector value corresponding to that dimension in the directional vector is taken as the imaginary part, and the combination is used to obtain the complex value corresponding to that dimension. The complex values corresponding to each dimension are combined to form the semantic vector of the target factual text fragment, thus obtaining the complex vector representation of the target factual text fragment in the semantic space.
[0080] Regarding similarity measurement schemes, in some embodiments, to better measure whether the factual statements of the case to be retrieved and any case in the intermediate query results are similar in each legal element, and to simultaneously reflect semantic differences, a fusion matching method combining real number similarity and complex phase difference is proposed. This further enhances the case retrieval system's ability to identify cases that are broadly similar but have subtle differences that affect the judgment conclusion. This scheme is mainly based on the operation of semantic vectors of the first and second factual texts corresponding to the same legal element, including the vector similarity of the real parts (first similarity) and the difference in the dot product phase angle between the semantic vectors (difference degree), constructing a legal element-level similarity that comprehensively reflects semantic commonalities and directional differences. Specifically, the similarity between any case in the intermediate query results and any legal element corresponding to the case to be retrieved can be calculated based on the following steps:
[0081] The initial semantic vector of the second factual text fragment corresponding to the legal elements of the case is calculated as the initial semantic vector of the first factual text fragment corresponding to the legal elements of the case to be retrieved (which can be calculated based on cosine similarity). This first similarity measures whether the two factual text fragments involve similar legal element descriptions and behavioral structures.
[0082] Calculate the dot product of the conjugate vector (the conjugate vector is the vector obtained by inverting the imaginary part signs of each dimension of the semantic vector) of the second factual text fragment corresponding to the legal elements of the case and the semantic vector of the first factual text fragment corresponding to the legal elements of the case to be retrieved; the dot product is a complex number.
[0083] Based on the phase angle of the dot product, the degree of difference is determined; where the phase angle represents the directional offset angle of the two sets of semantic vectors in the complex space, that is, it describes the directional difference of the semantic vectors of the two factual text fragments. Therefore, the larger the phase angle of the dot product, the greater the degree of difference.
[0084] Based on the aforementioned first similarity and the aforementioned difference, the similarity between this case and the case to be searched for corresponding legal elements is determined. For example, the ratio of the aforementioned first similarity to the aforementioned difference can be used as the similarity between this case and the case to be searched for corresponding legal elements.
[0085] After obtaining the overall similarity between all cases in the intermediate query results and the case to be retrieved, a screening strategy based on a combination of similarity and difference criteria is executed. Specifically, cases from the intermediate query results with an overall similarity greater than a first threshold and a similarity to the legal element with the highest degree of ambiguity less than a second threshold are selected. This dual-threshold screening mechanism effectively balances the requirements of "overall similarity" and "key differences." The final selected cases are consistent with the case to be retrieved in most legal elements, but exhibit different semantic features in specific, highly ambiguous legal elements, leading to different judgments. These differing cases have high reference value for law enforcement personnel and researchers, and can be used for in-depth research on issues such as the application boundaries of legal elements, discrepancies in judgment standards, and judicial uniformity.
[0086] In summary, the case retrieval method provided by this invention determines the ambiguity of each legal element of the case to be retrieved based on the legal provisions, and retrieves a case database based on the legal provisions of the case to be retrieved to obtain intermediate query results. Then, based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case facts, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element, it determines the similarity between the case and the case to be retrieved for each legal element, as well as the total similarity between the case and the case to be retrieved. Finally, it selects cases from the intermediate query results whose total similarity to the case to be retrieved is greater than a first threshold and whose similarity to the legal element with the highest ambiguity is less than a second threshold, and returns these cases to the user as query results. By introducing ambiguity assessment of legal elements, legal element-level comparison based on semantic vectors, and a filtering strategy combining similarity and difference conditions, it achieves case retrieval focused on differences.
[0087] The legal system case retrieval system provided by this invention is described below. The legal system case retrieval system described below and the legal system case retrieval method described above can be referred to in correspondence.
[0088] Based on any of the above embodiments Figure 4 This is a schematic diagram of the legal system case retrieval system provided by the present invention, as shown below. Figure 4 As shown, the system includes:
[0089] The query text receiving unit 410 is used to receive the case query text containing the basic case facts and judgment results corresponding to the case to be retrieved;
[0090] The ambiguity assessment unit 420 is used to determine the ambiguity of each legal element of the legal provisions on which the case to be retrieved is based; the higher the ambiguity of any legal element, the higher the possibility that the legal element contains multiple legal interpretations.
[0091] The first retrieval unit 430 is used to retrieve a case library based on the legal provisions upon which the case to be retrieved is based, and obtain intermediate query results.
[0092] The similarity evaluation unit 440 is used to determine the similarity between any case and the case to be retrieved for each legal element based on the semantic vector of the first factual text fragment corresponding to each legal element in the basic case, the semantic vector of the second factual text fragment corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element.
[0093] The second retrieval unit 450 is used to filter cases from the intermediate query results that have a total similarity greater than a first threshold and a similarity of the legal constituent element with the highest ambiguity less than a second threshold, so as to obtain the query results.
[0094] The system provided in this invention determines the ambiguity of each legal element of a case to be retrieved based on the legal provisions, and retrieves a case database based on the legal provisions of the case to be retrieved to obtain intermediate query results. Then, based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case facts, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element, it determines the similarity between the case and the case to be retrieved for each legal element, as well as the total similarity between the case and the case to be retrieved. Finally, it selects cases from the intermediate query results whose total similarity to the case to be retrieved is greater than a first threshold and whose similarity to the legal element with the highest ambiguity is less than a second threshold, and returns these cases to the user as query results. By introducing ambiguity assessment of legal elements, legal element-level comparison based on semantic vectors, and a filtering strategy combining similarity and difference conditions, it achieves case retrieval focused on differences.
[0095] Based on any of the above embodiments, the ambiguity of any legal element constituting the case to be retrieved according to the legal provisions is determined based on the following steps:
[0096] Retrieve a set of cases in the case database that are based on the same legal provisions as the case to be retrieved;
[0097] For any legal element, determine the initial semantic vector of the factual text fragments corresponding to any legal element in each case in the case set;
[0098] Based on the differences between the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case, the ambiguity of any of the legal elements is determined.
[0099] Based on any of the above embodiments, determining the ambiguity of any legal element based on the differences between the initial semantic vectors of the factual text fragments corresponding to any legal element in each case includes:
[0100] Cluster the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case to obtain one or more clusters;
[0101] If there is only one cluster, the ambiguity of determining any of the legal constituent elements is the first preset value;
[0102] Otherwise, the ambiguity of any legal constituent element is determined based on the number of cluster pairs whose distance between cluster centers is greater than a preset threshold.
[0103] Based on any of the above embodiments, the semantic vector of the first factual text fragment or the second factual text fragment corresponding to any legal element is determined based on the following steps:
[0104] The initial semantic vector of the target factual text fragment corresponding to any legal element is obtained based on the language model; the target factual text fragment is either the first factual text fragment or the second factual text fragment.
[0105] The initial semantic vector of the target factual text fragment is input into a nonlinear layer to obtain the directional vector of the target factual text fragment; the directional vector has the same dimension as the initial semantic vector.
[0106] For any dimension, the vector value corresponding to the dimension in the initial semantic vector of the target fact text fragment is taken as the real part, and the vector value corresponding to the dimension in the directional vector is taken as the imaginary part, to obtain the complex value corresponding to the dimension.
[0107] The complex values corresponding to each dimension are combined to form the semantic vector of the target factual text fragment.
[0108] Based on any of the above embodiments, the similarity between any case and any legal element corresponding to the case to be searched is calculated based on the following steps:
[0109] The initial semantic vector of the second factual text fragment corresponding to any legal element of any case is calculated, and the initial semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved is used as the first similarity.
[0110] Calculate the conjugate vector of the semantic vector of the second factual text fragment corresponding to any legal element of the case and the dot product of the semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved;
[0111] The degree of difference is determined based on the phase angle of the dot product;
[0112] Based on the first similarity and the difference, the similarity between any case and any legal element corresponding to the case to be retrieved is determined.
[0113] Based on any of the above embodiments, the total similarity between any case and the case to be retrieved is calculated based on the following steps:
[0114] Based on the ambiguity of each legal element, the similarity between any case and the case to be retrieved for each legal element is weighted and summed to obtain the total similarity between any case and the case to be retrieved.
[0115] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 5 As shown, the electronic device may include: a processor 510, a memory 520, a communication interface 530, and a communication bus 540, wherein the processor 510, the memory 520, and the communication interface 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 520 to execute a case retrieval method for a legal system. This method includes: receiving a case query text containing basic facts and judgment results corresponding to a case to be retrieved; determining the ambiguity of each legal element of the case to be retrieved based on the legal provisions; the higher the ambiguity of any legal element, the higher the possibility that the legal element contains multiple legal interpretations; retrieving a case library based on the legal provisions of the case to be retrieved to obtain intermediate query results; determining the similarity between any case and the case to be retrieved for each legal element, and the total similarity between any case and the case to be retrieved, based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic facts, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element; and selecting cases from the intermediate query results whose total similarity to the case to be retrieved is greater than a first threshold and whose similarity to the legal element with the highest ambiguity is less than a second threshold, to obtain query results.
[0116] Furthermore, the logical instructions in the aforementioned memory 520 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0117] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, wherein when the program instructions are executed by a computer, the computer is able to execute the legal system case retrieval method provided by the above methods, the method comprising: receiving a case query text containing basic case facts and judgment results corresponding to a case to be retrieved; determining the ambiguity of each legal element of the legal provisions upon which the case to be retrieved is based; the higher the ambiguity of any legal element, the higher the possibility that any legal element contains multiple legal interpretations; based on the legal provisions upon which the case to be retrieved is based... The legal provisions are retrieved from the case database to obtain intermediate query results. Based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element, the similarity between any case and the case to be retrieved for each legal element, as well as the total similarity between any case and the case to be retrieved, are determined. Cases with a total similarity greater than a first threshold and a similarity to the legal element with the highest ambiguity less than a second threshold are selected from the intermediate query results to obtain the query results.
[0118] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements the aforementioned legal system case retrieval methods. The method includes: receiving a case query text containing basic facts and judgment results corresponding to a case to be retrieved; determining the ambiguity of each legal element of the case to be retrieved based on the legal provisions; the higher the ambiguity of any legal element, the higher the possibility that the legal element contains multiple legal interpretations; retrieving a case database based on the legal provisions of the case to be retrieved to obtain intermediate query results; determining the similarity between any case and the case to be retrieved for each legal element, and the total similarity between any case and the case to be retrieved, based on the semantic vectors of first factual text fragments corresponding to each legal element in the basic facts, the semantic vectors of second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element; and selecting cases from the intermediate query results whose total similarity to the case to be retrieved is greater than a first threshold and whose similarity to the legal element with the highest ambiguity is less than a second threshold, to obtain query results.
[0119] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0120] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0121] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for case retrieval in a legal system, characterized in that, include: Receive the case query text containing the basic facts and judgment of the case to be searched; Determine the ambiguity of each legal element of the case to be searched based on the relevant legal provisions; the higher the ambiguity of any legal element, the higher the possibility that any legal element contains multiple legal interpretations. Based on the legal provisions upon which the case to be searched is based, a case database is retrieved to obtain intermediate query results; Based on the semantic vectors of the first factual text fragments corresponding to each legal element in the basic case, the semantic vectors of the second factual text fragments corresponding to each legal element in any case in the intermediate query results, and the fuzziness of each legal element, the similarity between any case and the case to be retrieved for each legal element, and the total similarity between any case and the case to be retrieved are determined. From the intermediate query results, cases with a total similarity greater than a first threshold and a similarity to the legal constituent element with the highest ambiguity less than a second threshold are selected to obtain the query results; The ambiguity of any legal element constituting the case to be searched, based on the following steps, is determined: Retrieve a set of cases in the case database that are based on the same legal provisions as the case to be retrieved; For any legal element, determine the initial semantic vector of the factual text fragments corresponding to any legal element in each case in the case set; Based on the differences between the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case, the ambiguity of any of the legal elements is determined.
2. The legal system case retrieval method according to claim 1, characterized in that, The determination of the ambiguity of any legal element based on the differences between the initial semantic vectors of the factual text fragments corresponding to any legal element in each case includes: Cluster the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case to obtain one or more clusters; If there is only one cluster, the ambiguity of determining any of the legal constituent elements is the first preset value; Otherwise, the ambiguity of any legal constituent element is determined based on the number of cluster pairs whose distance between cluster centers is greater than a preset threshold.
3. The legal system case retrieval method according to claim 1 or 2, characterized in that, The semantic vector of the first or second factual text fragment corresponding to any legal element is determined based on the following steps: The initial semantic vector of the target factual text fragment corresponding to any legal element is obtained based on the language model; the target factual text fragment is either the first factual text fragment or the second factual text fragment. The initial semantic vector of the target factual text fragment is input into a nonlinear layer to obtain the directional vector of the target factual text fragment; the directional vector has the same dimension as the initial semantic vector. For any dimension, the vector value corresponding to the dimension in the initial semantic vector of the target fact text fragment is taken as the real part, and the vector value corresponding to the dimension in the directional vector is taken as the imaginary part, to obtain the complex value corresponding to the dimension. The complex values corresponding to each dimension are combined to form the semantic vector of the target factual text fragment.
4. The legal system case retrieval method according to claim 3, characterized in that, The similarity between any case and any legal element corresponding to the case to be searched is calculated based on the following steps: The initial semantic vector of the second factual text fragment corresponding to any legal element of any case is calculated, and the initial semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved is used as the first similarity. Calculate the conjugate vector of the semantic vector of the second factual text fragment corresponding to any legal element of the case and the dot product of the semantic vector of the first factual text fragment corresponding to any legal element of the case to be retrieved; The degree of difference is determined based on the phase angle of the dot product; Based on the first similarity and the difference, the similarity between any case and any legal element corresponding to the case to be retrieved is determined.
5. The legal system case retrieval method according to claim 3, characterized in that, The total similarity between any case and the case to be retrieved is calculated based on the following steps: Based on the ambiguity of each legal element, the similarity between any case and the case to be retrieved for each legal element is weighted and summed to obtain the total similarity between any case and the case to be retrieved.
6. A case retrieval system for a legal affairs system, characterized in that, include: The query text receiving unit is used to receive the case query text containing the basic case facts and judgment results corresponding to the case to be retrieved; The ambiguity assessment unit is used to determine the ambiguity of each legal element of the case to be retrieved based on the legal provisions; the higher the ambiguity of any legal element, the higher the possibility that the legal element contains multiple legal interpretations. The first retrieval unit is used to retrieve a case library based on the legal provisions upon which the case to be retrieved is based, and to obtain intermediate query results; The similarity assessment unit is used to determine the similarity between any case and the case to be retrieved for each legal element based on the semantic vector of the first factual text fragment corresponding to each legal element in the basic case, the semantic vector of the second factual text fragment corresponding to each legal element in any case in the intermediate query results, and the ambiguity of each legal element. The second retrieval unit is used to filter cases from the intermediate query results that have a total similarity greater than a first threshold and a similarity of the legal constituent element with the highest ambiguity less than a second threshold, and to obtain query results. The ambiguity of any legal element constituting the case to be searched, based on the following steps, is determined: Retrieve a set of cases in the case database that are based on the same legal provisions as the case to be retrieved; For any legal element, determine the initial semantic vector of the factual text fragments corresponding to any legal element in each case in the case set; Based on the differences between the initial semantic vectors of the factual text fragments corresponding to any of the legal elements in each case, the ambiguity of any of the legal elements is determined.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the legal system case retrieval method as described in any one of claims 1 to 5.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the legal system case retrieval method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the legal system case retrieval method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Similar case retrieval method, similar case retrieval device and electronic equipment
CN110928994A
Historical legal case similarity recommendation method based on big data analysis
CN118210915A