A similar case retrieval method based on domain graph perception
Patent Information
- Application Number
- CN202211030073.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-26
- Publication Date
- 2025-03-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When existing case search methods deal with long texts with professional terms, it is difficult to maintain information integrity, resulting in low retrieval efficiency and poor accuracy.
A case search method based on domain graph perception is adopted, and a graph neural network is combined with a pre-trained language model BERT, and the correlation signals between professional term entities in the domain graph are used to construct an initial query-candidate node feature matrix, and feature information is propagated through a multi-level graph perception layer to enhance the correlation signals and structural information between entities.
It improves the efficiency and accuracy of similar cases in legal scenarios, can capture feature representations and calculate text similarity more accurately, and enhances the search ability of long-text cases.
Smart Images

Figure CN115409019B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of information retrieval, and specifically is a similar case retrieval method based on domain graph perception. Background Art
[0002] In recent years, with the rapid development of the internet, a large number of judicial cases have been digitized. This makes it difficult for people to find relevant cases amidst the vast sea of cases. Similar case retrieval is a specific application of information retrieval in the judicial field. Its purpose is to quickly and accurately retrieve judicial cases related to the query from the judicial case database.
[0003] At present, similar case retrieval methods are mainly divided into two categories: keyword-based retrieval and semantic-based retrieval. Keyword-based retrieval estimates the degree of matching between two texts by calculating the number of overlapping words in them, which has been widely used in various fields. However, keyword-based retrieval methods cannot identify texts with high literal overlap but dissimilar semantics, which greatly limits the accuracy of retrieval results. Semantic-based retrieval mainly uses cutting-edge technologies such as deep learning and natural language processing to learn the semantic information of texts, so that the model can match the similarity of two texts at the semantic level. However, semantic-based retrieval methods have difficulty processing long texts with professional terms. Existing methods often obtain partial information of the text through operations such as truncation and summarization, which means that these methods lose most of the information, resulting in less accurate retrieval of long text cases. Summary of the Invention
[0004] The purpose of this invention is to address the low efficiency and accuracy of existing similar case retrieval methods by proposing a similar case retrieval method based on domain graph perception. This method explicitly proposes the use of domain graphs and graph neural network methods to complete case retrieval tasks in legal scenarios. It demonstrates the importance of domain knowledge in identifying cases and the effectiveness of graph neural networks in capturing feature representations and calculating text similarity. It also improves the efficiency and accuracy of similar case retrieval in legal scenarios.
[0005] The technical solution for achieving the purpose of the present invention is:
[0006] A similar case retrieval method based on domain graph perception includes the following steps:
[0007] Step 1: Split candidate cases in the case database into sentences, calculate the similarity between each sentence and the query case using TF-IDF, sort the sentences from high to low based on similarity, and select the top K sentences to form new candidate cases. Then, extract the key entities in the query case and candidate cases to obtain a query entity set and a candidate entity set.
[0008] Step 2: Match each entity in the query entity set and the candidate entity set with the entities in the domain graph to obtain a triple set of all related domain entities corresponding to each entity;
[0009] Step 3: Input each entity triple in the entity triple set into the pre-trained language model BERT to obtain the corresponding triple vector representation; then, using the aggregation operation, aggregate all the associated entities and relationship features matched by the entity to the entity to obtain an initial vector representation;
[0010]
[0011]
[0012] Step 4: Calculate the node feature matrix of the query entity and the candidate entity through the dot product operation, then normalize the node feature matrix and use the normalized matrix to construct a graph neural network for training;
[0013]
[0014]
[0015] Step 5: Construct the adjacency matrix required by the graph neural network. This matrix describes the relationship between nodes. Specifically, the connection relationship of the domain graph is used as the connection relationship between entities in the graph neural network.
[0016]
[0017] Step 6: Use graph neural networks to learn vector representations of query entities and candidate entities, and capture the connections between entities in the domain graph. In addition, to alleviate the problems of exploding and vanishing gradients that occur during signal propagation in graph neural networks, the adjacency matrix needs to be normalized.
[0018]
[0019] D i,i =∑ j A i,j ,
[0020] After multi-level propagation, graph neural networks spread the feature representation of an entity to the entire graph. They can also aggregate the feature representations of neighboring nodes onto themselves, thereby achieving more in-depth information interaction.
[0021]
[0022]
[0023] Step 7: After obtaining the feature representation of all nodes in the graph, aggregate the feature representations of all nodes and calculate the final similarity score through a linear layer;
[0024]
[0025]
[0026] In the above formula, p i represents the i-th entity in the entity set, l∈{q,c} represents the category of the case, q is the query case, c is the candidate case, and Represent the vector representations of the head entity, relation, and tail entity in the triple, respectively. Represents entity p in the entity set i The corresponding initial vector representation, n represents the entity p in the query entity set or candidate entity set i The number of triples matched with the domain graph; N and M represent the number of entities in the query entity set and the candidate entity set respectively; X * Represents the node feature matrix, which is used to represent the initial input vector of the graph neural network; is a domain graph, f(·) is a matching function, if the entity p in the candidate entity set i and entity p j All belong to Then f(p i ,p j )=1, indicating p i and p j There is a connection between them; Represents the normalized adjacency matrix, D is a diagonal matrix, and the self-transfer problem is solved by introducing the self-degree matrix; Z (t) represents the vector representation of the full graph nodes after propagation through the t-layer graph neural network, t is a custom hyperparameter, σ is a nonlinear activation function, which is ReLU(·), W (t-1) Represents the learnable weight parameter matrix of the t-1th layer; W o Represents the learnable weight parameter matrix of the prediction layer neural network, b o represents the bias term of the prediction layer neural network; o represents the correlation between the query case and the candidate case, y represents the score of each category output by the prediction layer neural network, and Y represents the final prediction score of each category after normalization; · represents the dot product, ⊙ represents the Hadamard product; the superscript T represents the transpose.
[0027] Compared with the existing technology, this technical solution utilizes the special correlation signals between professional terminology entities in the legal field graph to achieve matching between entities and aggregate the information of all related entities to the query entity or candidate entity, thereby constructing an initial query-candidate node feature matrix that contains rich legal field knowledge; in addition, feature information is propagated between query-candidate entities through a multi-level graph perception layer, enabling each entity to aggregate feature information from the entire graph. After information diffusion through the high-order graph, global interaction signals can be generated between query-candidate entities, thereby further strengthening the correlation signals and structural information between them.
[0028] This method clearly proposes the use of domain graphs and graph neural network methods to complete case retrieval tasks in legal scenarios, and demonstrates the importance of domain knowledge in identifying cases, as well as the effectiveness of graph neural networks in capturing feature representations and calculating text similarity. It can also improve the efficiency and accuracy of similar case retrieval in legal scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a model framework diagram of an embodiment;
[0030] Figure 2 Schematic diagram of entity perception of criminal case domain graph in the embodiment. DETAILED DESCRIPTION
[0031] The invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, but the invention is not limited thereto.
[0032] Example:
[0033] Reference Figure 1 , a similar case retrieval method based on domain graph perception, comprising the following steps:
[0034] Step 1: Split the candidate cases in the case database into sentences, calculate the similarity between each sentence and the query case using TF-IDF, and sort them from high to low according to the similarity, and select the top K sentences to form new candidate cases; then extract the key entities in the query case and the candidate case to obtain a set of query entity sets. and a set of candidate entity sets Where N and M represent the number of entities in the query entity set and candidate entity set respectively;
[0035] Generally, query cases and candidate cases are both specific case descriptions, such as Figure 2 An example showing a query case and a candidate case is shown:
[0036] Example of a case inquiry: ... Zhang took item A (valued at RMB 14,195) from Tong at a counter and fled the scene. The amount was substantial, and Zhang possessed the property for a specific purpose...
[0037] Example of a candidate case: ...Wang sold item B weighing less than 10 grams and earned RMB 200. Both parties' actions caused harm to society and should be held accountable...
[0038] Extract key entities from query cases and candidate cases to construct a set of query entity sets Q and a set of candidate entity sets C:
[0039] Q = {Zhang, counter, property A, Tong, RMB, ...},
[0040] C = {Wang, item B, 10 grams, RMB, ...};
[0041] Step 2: Match each entity in the query entity set and the candidate entity set with the entities in the domain graph to obtain a triple set of all related domain entities corresponding to each entity;
[0042] A knowledge graph is a large-scale semantic network, while a domain graph is a knowledge graph applied to a specific domain. Therefore, a domain graph contains all the attributes of a knowledge graph. In other words, a domain graph contains entities, concepts, and various semantic relationships between entities and concepts, and uses triples (head entity, relationship, tail entity) to represent a specific fact. At the same time, a domain graph also uses graph-structured data to express knowledge connections. It consists of nodes and edges. Nodes represent entities, and edges represent semantic relationships between entities. An entity is a specific thing that can exist independently in a domain graph, such as ethanol, motorcycles, and RMB. A concept refers to a type of entity in a domain graph, such as property, cars, and tools. A relationship refers to a semantic association between two entities.
[0043] pass Figure 2 Through the entity perception operation, we can obtain the triple sets of query cases and candidate cases. For example, the entities "Zhang" and "property A" in the query case are matched with "Zhang" and "property A" in the graph to obtain a triple (Zhang, taken, property A), while "Tong" and "property A" will be matched to a triple (Tong, taken away, property A). In the candidate case, "Wang" and "item B" are matched as (Wang, sell, item B), and "item B" and "ethanol" are matched as (item B, contains, ethanol). Therefore, after completing the matching, we get the entity triple sets of the query and candidate cases:
[0044]
[0045]
[0046] Where l∈{q,c} represents the category of the case, q is the query case, c is the candidate case, L∈{N,M} represents the number of entities in the query entity set and the candidate entity set, respectively, and n represents the entity p in the query entity set or the candidate entity set. i The number of triples matched with the domain graph;
[0047] Step 3: Input each entity triple in the entity triple set into the pre-trained language model BERT to obtain the corresponding triple vector representation:
[0048]
[0049]
[0050] Since an entity may match multiple triples in the domain graph, such as (item B, contains, ethanol) and (item B, contains, ingredient B), etc., the aggregation operation is used to represent the head entity vector of all triples matched by the entity. Relation vector representation and tail entity vector representation Aggregate onto the entity to get an initial vector representation:
[0051]
[0052]
[0053] Therefore, after the entity aggregation stage, all query entity representations that integrate domain knowledge are obtained. and candidate entity representations
[0054] Step 4: Calculate the node feature matrix of the query entity and the candidate entity through the dot product operation, then normalize the node feature matrix and use the normalized matrix to build a graph neural network for training:
[0055]
[0056]
[0057] exist Figure 2In the graph perception layer, each node is represented as an entity in the candidate entity set. These entities are aggregated to incorporate domain knowledge into themselves. Therefore, each node feature contains rich domain knowledge. For example, in the candidate entity set, the feature representation of the entity "item B" combines the feature representation of the relation "weight" and the feature representation of the entity "ten grams". In order to introduce the features of the query case into the graph, the node features are set as the interaction signals between the query case and the candidate case entity.
[0058] Step 5: Construct the adjacency matrix required by the graph neural network. This matrix describes the relationship between nodes. Specifically, the connection relationship of the domain graph is used as the connection relationship between entities in the graph neural network:
[0059]
[0060] Where p i and p j Represents an entity, which is also a node in the adjacency matrix, Represents the legal domain graph. If the entity p in the candidate entity set i and p j All in the picture Then find p i and p j Is there a connection between them? If they are connected, then f(p i ,p j )=1, that is, A i,j =1, otherwise A i,j =0;
[0061] Step 6: Use the graph neural network to learn the vector representations of the query entity and candidate entities and capture the connections between entities in the domain graph. In addition, to alleviate the problems of gradient explosion and gradient vanishing that occur in the process of signal propagation in the graph neural network, the adjacency matrix needs to be normalized:
[0062]
[0063] D i,i =∑ j A i,j ,
[0064] Where D represents the diagonal matrix, Represents the normalized adjacency matrix. The function of normalization is to assign a weight to each node and perform a weighted average of the features of adjacent nodes during the propagation process, making the final converged node features more stable and reliable.
[0065] After a single layer of information propagation, graph neural networks can spread the feature representation of an entity to neighboring nodes, and can also aggregate the feature representations of neighboring nodes onto themselves:
[0066]
[0067] Where σ represents the nonlinear activation function ReLU(·), X * represents the node feature input, W (0) represents the learnable weight parameter matrix of layer 0, With X * Multiplication means aggregating the neighbor node features around each node to obtain the updated current node features, and then multiplying the updated node features with the matrix W (0) Multiplication completes the linear transformation of the features, and then the nonlinear transformation is completed by the σ function to obtain the feature vector representation of the first layer, that is, the first-order feature vector representation;
[0068] Then, by propagating information through a multi-layer graph neural network, the feature representation of an entity can be spread to the entire graph, while also aggregating the feature representations of multi-level neighboring nodes onto itself, thereby obtaining more in-depth interactive information:
[0069]
[0070] Where Z (t-1) represents the t-1 order feature vector representation, that is, the feature obtained after t-1 layer graph propagation, W (t-1) Represents the weight parameter matrix of the t-1th layer;
[0071] Step 7: After obtaining the feature representation of all nodes in the graph, aggregate the feature representations of all nodes and calculate the final similarity score through the prediction layer:
[0072]
[0073]
[0074] Where W o represents the weight parameter of the prediction layer, b o represents the bias of the prediction layer, represents the final node feature representation output by the graph neural network, y represents the score of each category output by the prediction layer neural network, Y represents the normalized final prediction score of each category, and o∈{0,1,2,3} represents the relevance between the query case and the candidate case, which can be expressed as very irrelevant, irrelevant, relevant, and very relevant, respectively.
[0075] This example method clearly proposes the process of perceiving domain entities and building a graph neural network through a domain graph. Based on the extracted query entities and candidate entities, all domain entities are identified in the domain graph through entity perception operations, and the rich correlation signals and domain knowledge between domain entities are integrated into the source entities. In order to enhance the vector representation of query entities and candidate entities, a multi-level graph neural network is used to capture the connections between entities in the domain graph. Finally, the feature representation of each entity is spread to the entire graph, and the feature representations of multi-level neighbor nodes are aggregated to each entity, thereby achieving more in-depth information interaction. The technical advantage of this example is that it clearly proposes the use of domain graphs and graph neural network methods to complete case retrieval tasks in legal scenarios, and demonstrates the importance of domain knowledge in identifying cases, as well as the effectiveness of graph neural networks in capturing feature representations and calculating text similarity. Finally, similar case retrieval in legal scenarios is achieved with higher efficiency and higher accuracy.
Claims
1. A similar case retrieval method based on domain graph perception, characterized in that: The steps include: Step 1: Divide the candidate cases in the case database into sentences, use TF-IDF to calculate the similarity between each sentence and the query case, sort them from high to low according to the similarity, and select the top K sentences to form new candidate cases; Then, the key entities in the query cases and candidate cases are extracted respectively to obtain a set of query entity sets and a set of candidate entity sets; Step 2: Match each entity in the query entity set and the candidate entity set with the entity in the domain graph to obtain a triple set of all relevant domain entities corresponding to each entity; Step 3: Input each entity triple in the entity triple set into the pre-trained language model BERT to obtain the corresponding triple vector representation; Then, using the aggregation operation, all the associated entities and relationship features matched by the entity are aggregated onto the entity to obtain an initial vector representation; Step 4: Calculate the node feature matrix of the query entity and the candidate entity through the dot product operation, then normalize the node feature matrix, and use the normalized matrix to construct a graph neural network for training; Step 5: Construct the adjacency matrix required by the graph neural network, which describes the relationship between nodes; specifically, the connection relationship of the domain graph is used as the connection relationship between entities in the graph neural network; Step 6: Use graph neural networks to learn vector representations of query entities and candidate entities, and capture the connections between entities in the domain graph. In addition, in order to alleviate the problems of gradient explosion and gradient vanishing that occur in the process of signal propagation in graph neural networks, the adjacency matrix needs to be normalized. D i,i =S j A i,j , After multi-level propagation, the graph neural network spreads the feature representation of an entity to the entire graph, and can also aggregate the feature representation of neighboring nodes to itself, thereby completing information interaction in a more in-depth manner; Step 7: After obtaining the feature representation of all nodes in the graph, aggregate the feature representation of all nodes and calculate the final similarity score through a linear layer; In the above formula, p i represents the i-th entity in the entity set, l∈{q,c} represents the category of the case, q is the query case, c is the candidate case, and Respectively represent the vector representation of the head entity, relation, and tail entity in the triple, Represents entity p in the entity set i The corresponding initial vector represents n, which represents the entity p in the query entity set or candidate entity set. i The number of triples matched with the domain graph; N and M represent the number of entities in the query entity set and the candidate entity set, respectively; X * Represents the node feature matrix, which is used to represent the initial input vector of the graph neural network; is a domain graph, f(·) is a matching function, if entity p in the candidate entity set i and entity p j All belong to Then f(p i ,p j )=1, indicating p i and p j There is a connection between them; represents the normalized adjacency matrix, D is an angle matrix, and the self-transfer problem is solved by introducing the self-degree matrix; Z (t) represents the vector representation of the full graph nodes after propagation through the t-layer graph neural network. t is a custom hyperparameter, σ is a nonlinear activation function, which is ReLU(·), and W (t-1) represents the learnable weight parameter matrix of the t-1th layer; W o represents the learnable weight parameter matrix of the prediction layer neural network, b o represents the bias term of the prediction layer neural network; o represents the correlation between the query case and the candidate case, y represents the score of each category output by the prediction layer neural network, and Y represents the final prediction score of each category after normalization; · represents the dot product, ⊙ represents the Hadamard product; the superscript T represents the transpose.
Citation Information
Patent Citations
Legal case similarity calculation method and system based on knowledge graph matching
CN114092283A
Case similarity calculation method and system based on graph convolution
CN114169429A