A legal case similarity calculation method and system based on knowledge graph matching
By using text encoder and graph neural network in legal case calculation, the knowledge graph matching score of the case is calculated, and the problem of insufficient calculation results in the prior art is solved, and a higher precision similarity calculation is achieved.
Patent Information
- Application Number
- CN202111264122.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-28
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2041-10-28
AI Technical Summary
When calculating the similarity of legal cases, the results are not accurate enough and the accuracy is not high, and it does not consider how to coordinate local matching and global matching to obtain higher precision results.
The entity and relational information in the knowledge graph of the legal case is converted into initial vectors through a text encoder, and the vectorized representation of entities is obtained using a graph neural network, the matching score matrix between the graphs is calculated, and the pooling and multi-layer perceptrons are obtained Similarity scores for cases.
It realizes higher-precision legal case similarity calculations, which can fully consider the proprietary knowledge and semantic logic in the judicial field, and coordinate local and global matching, thereby improving the accuracy of the calculation results.
Smart Images

Figure CN114092283B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of graph processing and computer technology applications, and in particular to a legal case similarity calculation method and system based on knowledge graph matching. Background Art
[0002] The new round of technological development, such as artificial intelligence, big data, blockchain, and 5G, has had a profound impact on the economy and society. Intelligence and digitalization have become development trends. In terms of the construction of smart courts, the current advanced information science and information technology have been increasingly integrated. Generally speaking, when judges adjudicate cases, they will be restricted by subjective conditions such as personal level differences, cognitive differences, and differences in the scale of discretion, which may lead to the phenomenon of "different judgments for the same case" in actual situations. Once it occurs, it will seriously affect the credibility of the judiciary. Therefore, judges usually refer to the judgment results of similar cases when adjudicating cases. However, the usual method is to rely on manual means, manually retrieve cases, and then manually judge whether the selected case is similar to the target case. This process is time-consuming and labor-intensive, and violates the concept of building smart courts.
[0003] The current methods for calculating case similarity in the scientific research field can be mainly divided into four categories: the first category is based on word vectors, which constructs a vector space of specific legal-related texts, and then calculates the word vectors involved in the case to obtain the text similarity in the case. The second category is based on word embedding models, which trains texts into different embedding vectors through specially designed neural networks, compares the vectors, and calculates the case similarity. The third category is based on event templates, which extracts events from corresponding cases according to pre-designed event templates, and then compares the similarity of event tuples of two cases to obtain case similarity. The fourth category is based on graph neural networks, which converts case texts into knowledge graphs with graph structures, and then processes graph structure data through graph neural networks to obtain embedding vectors, and calculates the similarity of cases through embedded vectors.
[0004] However, all of the above methods have defects to varying degrees. The methods based on word vectors and word embeddings do not involve legal domain-specific knowledge, so their calculation results are not accurate enough. Although the event template-based method contains legal domain-specific knowledge, it can only represent cases in a coarse-grained manner and its accuracy is not high. In the past, methods based on graph neural networks mostly relied on inefficient global matching procedures, which only considered the similarity score of the entire graph, but did not consider how to coordinate local matching and global matching to obtain more accurate results. Summary of the invention
[0005] The purpose of the invention is to provide a method and system for calculating the similarity of legal cases based on knowledge graph matching, which solves the problems in the prior art that the calculation results are not precise enough, the accuracy is not high enough, and how to coordinate local matching and global matching to obtain higher precision results is not considered.
[0006] The present invention is implemented as follows: a method for calculating the similarity of legal cases based on knowledge graph matching, comprising the following steps:
[0007] S1. Converting entity and relationship information in the knowledge graphs of two cases into initial vectors through a text encoder; the knowledge graphs of the two cases are a source graph and a target graph respectively;
[0008] S2. Using the initial vectors of entities and relationships as input features, obtain the vectorized representation of entities in the knowledge graph through the first graph neural network;
[0009] S3. taking the vectorized representation of the entity as input, and obtaining a matching score matrix between the two graphs according to a graph matching algorithm;
[0010] S4. Pooling the matching score matrix to obtain a first score vector;
[0011] S5. Input the first score vector into a multilayer perceptron to obtain similarity scores of the two cases. Alternatively, the first score vector may be connected with the text encoding similarity or / and the graph encoding similarity between the cases to form a second score vector, and the second score vector may be input into a multilayer perceptron to obtain similarity scores of the two cases.
[0012] The text encoder in step S1 is an initial text embedding model generated based on the parameters of a large pre-trained model, and the large pre-trained model can be one of a BERT-wwm pre-trained model, an ERNIE pre-trained model, and a RoBERTa pre-trained model.
[0013] In step S1, the text encoder is used to reduce the dimension of the variable-length text code into a fixed-length vector to facilitate computer calculation and processing.
[0014] In step S2, the role of the graph neural network is to aggregate the information of the surrounding nodes and relationships of each entity node, and use the node update function to update the representation of the entity node, and fine-tune the parameters in a supervised manner so that the final representation of the node can reflect the local node matching information from the source graph to the target graph, wherein the vector output by the text encoding in step S1 is used as the initialization representation of the nodes and relationships.
[0015] In step S3, the matching score matrix represents the mapping scores of all nodes from the source graph to the target graph, and its shape is m*n, where m and n correspond to the number of nodes in the source graph and the target graph respectively. The higher the score, the more similar the two nodes at the corresponding positions are.
[0016] In step S3, the matching score matrix is initially obtained based on the local information matching, and then it is continuously iteratively updated based on the global information. The final matching result takes into account both the local information and the global information of the graph.
[0017] In step S4, the pooling operation extracts and retains the matching results with the highest similarity as much as possible, and the results can reflect the similarity between the source image and the target image to a considerable extent.
[0018] In step S5, text encoding and graph encoding are used to further incorporate known correspondence information (such as known seed correspondence) into the score. The acquisition of text encoding similarity and graph encoding similarity will be discussed later.
[0019] Preferably, the text encoder in step S1 is specifically an initial text embedding model generated based on parameters of the BERT-wwm pre-trained model.
[0020] Preferably, the first graph neural network in step S2 is based on a message passing neural network (MPNN) framework, and the framework includes:
[0021] S21. Aggregate function for aggregating surrounding node information and edge information;
[0022] S22. Update function used to iteratively update node information.
[0023] Preferably, the first graph neural network loss function in step S2 is specifically:
[0024]
[0025] Among them, V s Represents the set of source graph nodes, π gt (i) represents the target graph node corresponding to the source graph node i in the real world. It can be seen that when the loss function The smaller it is, the closer the node matching results between graphs generated by the algorithm are to the node matching results between graphs in the real world.
[0026] Preferably, step S3 is specifically implemented as follows:
[0027] S31. Use the source image embedding matrix to multiply the transpose of the target image embedding matrix to obtain an initial matching score matrix;
[0028] S32. To improve the computational efficiency as much as possible, the initial matching score matrix is sparsely processed, and only the first M largest values of each row are retained, where M is a pre-specified hyperparameter;
[0029] S33. Perform softmax normalization on the result matrix of the previous step;
[0030] S34. Initialize the source graph node color, and give each entity node a randomly generated color vector that conforms to a specific distribution;
[0031] S35. Obtaining the color embedding aggregation of the source graph nodes and the color embedding aggregation of the target graph nodes mapped from the source graph nodes to the target graph nodes through the second graph neural network, the neural network is also based on the MPNN framework, and its network structure is the same as the first graph neural network, except that the parameters of the two are different;
[0032] S36. For any node i in the source graph and any node j in the target graph, the difference is calculated according to the node color embedding aggregation result, and the difference vector can reasonably reflect the quality of the match from node i to node j;
[0033] S37. Input the difference vector into the multilayer perceptron, that is, map the vector into a specific value, and finally use the value to update the content of the corresponding position of the matching score matrix;
[0034] S38. Repeat the above S33-S37 operations L times, where L is the number of iterations set in advance.
[0035] Preferably, step S4 is specifically implemented as follows:
[0036] S41. Perform max-pooling operations on the matching score matrix row by row and column by column to obtain two result vectors;
[0037] S42. Perform kernel pooling operations on the result vectors respectively, and take the average of the two kernel pooling results to obtain a first score vector.
[0038] Preferably, step S5 is specifically implemented as follows:
[0039] S51. Using the text vector output by the text encoder as an input feature, a similarity score matrix between all entity node features from the source graph to the target graph is obtained based on vector alignment;
[0040] S52. Obtain text encoding similarity between cases through maximum pooling and kernel pooling;
[0041] S53. extract the embedding vector after the aggregation of the entity nodes corresponding to the case names in the matrix output by the first graph neural network, and calculate the similarity between the two case name vectors as the graph encoding similarity;
[0042] S54. Connect the first score vector, the text encoding similarity, and the graph encoding similarity obtained in step S4 by using a concatenation operation to obtain a second score vector;
[0043] S55. Input the second score vector into the multilayer perceptron to obtain a final similarity score;
[0044] In the above step S55, the loss function of the multilayer perceptron can be calculated in a supervised manner using the similarity scores between cases in the real situation, or in an unsupervised manner using the similarity scores between cases automatically calculated by the algorithm. The specific implementation depends on whether the data set has an initial score.
[0045] The second implementation scheme provided by the present invention is a legal case similarity calculation system based on knowledge graph matching, the system comprising a text encoding module, a knowledge graph embedding module, a matching score matrix calculation module, a matrix pooling module, and a graph similarity calculation module, the style encoding module is connected to the knowledge graph embedding module and the matrix pooling module, the matching score matrix calculation module is connected to the knowledge graph embedding module and the matrix pooling module, the knowledge graph embedding module is connected to the graph similarity calculation module, and the matrix pooling module is connected to the graph similarity calculation module, wherein:
[0046] The text encoding module is used to convert node attributes and relationships in the knowledge graph into fixed-length vector representations;
[0047] The knowledge graph embedding module is used to aggregate the information of neighboring nodes and edges so that the knowledge graph node features can represent the vector representation of the local matching information between the source graph and the target graph;
[0048] The matching score matrix calculation module is used to initialize and iteratively update the matching score matrix and output it;
[0049] The matrix pooling module is used to extract the main features in the score matrix as vectors of specific dimensions and output them;
[0050] The graph similarity calculation module is used to calculate the text encoding similarity and graph encoding similarity between cases, connect the two similarities with the first score vector to form a second score vector, and input it into the multi-layer perceptron to obtain the final score;
[0051] Preferably, the graph similarity calculation module is only used to input the first score vector into a multi-layer perceptron to obtain a final score;
[0052] Preferably, the graph similarity calculation module is used to calculate any one of the text encoding similarity or the graph encoding similarity between cases, connect it with the first score vector to form a second score vector, and input it into a multi-layer perceptron to obtain a final score.
[0053] The beneficial effects of the present invention are as follows: compared with the case similarity calculation method using non-neural network methods, the calculation method of the present invention is based on the knowledge graph training in the judicial field, so it can fully take into account the proprietary knowledge, semantic logic and entity relationships in the judicial field, so that it can be applied to different types of more complex cases; compared with the method of using non-graph neural networks to calculate case similarity, the graph neural network method based on the graph can be free from the interference of a large amount of redundant information, and it is easier to capture the high-dimensional correlation between cases; compared with other methods of case similarity calculation based on graph neural networks, the method of the present invention can further coordinate local matching and global matching, and approximate the one-to-one correspondence between graph nodes, thereby obtaining higher-precision legal case similarity results. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A flowchart of a method for calculating legal case similarity based on knowledge graph matching according to an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of a legal case similarity calculation system based on knowledge graph matching according to an embodiment of the present invention;
[0056] Figure 3 This is a sample diagram used as the initial data case knowledge graph for displaying the present invention. DETAILED DESCRIPTION
[0057] The following is a detailed description of the implementation method of the present invention, which can explain the specific details of some seemingly unreasonable statements in the above description and provide a complete implementation scheme. It should be noted that the embodiments are only partial embodiments of the present invention. For ordinary technicians in this field, other embodiments that can be obtained by replacement or change without the need for creativity still belong to the protection scope of the present invention.
[0058] Embodiment 1:
[0059] The embodiment of the present invention provides a method for calculating the similarity of legal cases based on knowledge graph matching, comprising the following steps:
[0060] S1. Convert the entity and relationship information in the knowledge graph of the two cases into initial vectors through the text encoder:
[0061] The initial data used by the algorithm is a knowledge graph constructed based on the triple (h, r, t) of the RDF model, where h is the head node, r is the relationship edge, and t is the tail node. The graph display sample of the source graph or target graph is as follows: Figure 3 As shown; the present invention adopts Figure 3The knowledge graph input in the judicial field shown, combined with the calculation method described in the present invention, ultimately enables the acquisition of results close to those evaluated by experts in the field.
[0062] S11. Assign different ids to all entities and relationships in the knowledge graph, using id e and id r Indicates that the case title entity corresponds to id e Fixed to 1;
[0063] S12. Tokenize the text descriptions of entities and relationships in the knowledge graph, and set the maximum length of the token sequence to n;
[0064] S13. The parameters of the BERT-wwm pre-trained model are introduced through the TokenEmbedding class to vectorize the token, and finally the embedding vector representation of the entity e and relation r in the knowledge graph is obtained, which are v e 、v r ;
[0065] S2. Take the initial vectors of entities and relationships as input features and obtain the vectorized representation of entities in the knowledge graph through the first graph neural network:
[0066] S21. Initialize the node representation of the graph Where X i is the input feature, that is, the embedding vector of entity id = i
[0067] S22. Update node representation A total of K times, the specific update method is as follows:
[0068]
[0069] in is a learnable parameter based on self-attention, which includes both the importance of the relationship and the importance of the node, that is, the weight of node j in the graph for node i; N(i) refers to the neighborhood of node i, that is, the set of nodes connected to node i in the graph; W (l) is a learnable parameter; σ is a nonlinear activation function;
[0070] Self-attention parameters The calculation formula is as follows:
[0071]
[0072] in is the learnable weight vector of each layer, represents the embedding vector of the edge from node i to node j, ∥ represents the connection operation;
[0073] S23. Calculation The result is used as the initial matching score matrix Then the initial matching score matrix is sparsely processed and softmax normalized to obtain the standardized matching score matrix S (0) ;
[0074] Here, H s and Represents the transpose of the node representation matrix of the source graph and the node representation matrix of the target graph, S (0) The value at any position in represents the similarity score from the source graph node to the target graph node corresponding to that position;
[0075] The loss function of the first graph neural network in S22. is:
[0076]
[0077] Among them, V s Represents the set of source graph nodes, π gt (i) represents the target graph node corresponding to the source graph node i in the real world;
[0078] Obviously, using this loss function to train the graph neural network is equivalent to using To fit the matching score matrix of the actual situation, that is, to fine-tune the pre-training results downstream, so that the final node representation can reflect the node matching information from the source graph to the target graph; in addition, since each node only gathers the node information within its K-hop neighbors and does not contain global information, the matching in this step is actually equivalent to node similarity matching based only on local information;
[0079] Since the above step S23 needs to be looped later, this method puts it into step S3 in actual operation. Here, in order to explain the details of the algorithm clearly, it is put into step S2;
[0080] S3. Taking the vectorized representation of the entity as input, according to the graph matching algorithm, obtain the matching score matrix between the two graphs:
[0081] S31. Pair Matrix Perform softmax normalization to obtain S (l-1) ;
[0082] S32. Use standard normal distribution to randomly initialize the node color features of the source graph And the color features are calculated according to S (l-1) Mapped to the target graph node, that is,
[0083] It should be noted that here The result is to capture the global information of the source graph. The color of any node in the target graph is the weighted sum of the color features of all nodes in the source graph.
[0084] S33. Aggregate the source graph node color features and the target graph node color features respectively through the second graph neural network, which is equivalent to using the generated color features to replace the initial input feature X i The second graph neural network is also based on the MPNN framework. Its network structure is the same as the first graph neural network, but the parameters are different. The output results of the source graph and the target graph are O s and O t ;
[0085] Among them, the loss function of the second graph neural network is:
[0086]
[0087] S34. Calculation i∈V s , j∈V t ,here Represents the difference vector between the color of source graph node i and the color of target graph node j after aggregating surrounding information;
[0088] S35. Update matching score matrix Here φ1(·) is a multi-layer perceptron, which can be simply designed as a two-layer structure with only one hidden layer: H = σ(XW h +b h ), O=HW o +b o ;
[0089] The multi-layer perceptron maps the vector to a specific value. Since the color mapping from the source image to the target image itself captures the global information, the iterative update here is equivalent to multiple adjustments to the matching score matrix based on the global information.
[0090] S36. Repeat the above S31-S35 for a total of L times;
[0091] S4. Pooling the matching score matrix to obtain a first score vector:
[0092] S41. Use row max pooling and column max pooling for the matching score matrix, that is, take the maximum value of each row to get a vector v row , take the maximum value of each column to get a vector v col, Note that here in the first row of row max pooling and the first column of column max pooling, since the first node corresponds to the case names of the two cases by default, both directly retain the value with subscript (1,1) in the matching score matrix;
[0093] S42. Then, v row and v col Kernel pooling is performed. Kernel pooling captures high-order information in the vector in the form of a kernel function, and because the parameters are differentiable, they can be optimized together with the neural network, and finally two new vectors with dimensions d are obtained. and
[0094] S43. Calculate the final score vector
[0095] S5. Connect the first score vector, the text encoding similarity between cases and the graph encoding similarity to form a second score vector, input the second score vector into a multilayer perceptron, and obtain the similarity scores of the two cases:
[0096] S51. Represent v using the embedding vector of the entity in step S13 e , the source graph and target graph node features are represented as matrices X s and X t , according to the formula i∈V s The initial node embedding similarity score matrix S of the source graph and the target graph can be obtained text , where concat refers to the concatenate function, It is a function that can map a matrix to a vector. Specifically, in Python code, we can use the sum function. |·| means to find the absolute value. refers to the bitwise multiplication of matrices;
[0097] Here, we do not consider edge information or domain expertise, but simply compare the similarity in the literal sense, and the result is used to calibrate the final score;
[0098] S52.To S text Perform the same pooling operation as in step S4, and the final result is
[0099] S53. Calculation The result is a graph encoding similarity;
[0100] because and They correspond to the embedding of the target graph title entity and the source graph title entity respectively, and aggregate the information of neighboring nodes and edges within the surrounding K hops after the graph neural network calculation. When calculating the final similarity score, considering the similarity between the two can, to a certain extent, suppress the result of subsequent adjustments based on global information developing in the wrong direction;
[0101] S54.Yes Use the concatenation operation to connect into a new vector
[0102] S55. Vector Input the multilayer perceptron φ2(·), the structure of which is similar to step S35, and calculate the final similarity score of the case.
[0103] The loss function of the above results is:
[0104]
[0105] Here D refers to the set of any training graph pairs, |D| refers to the number of elements in set D, and y ij refers to the true graph similarity score, where y ij It can be the known true similarity score in the dataset, or a one-to-one mapping from the GED (graph edit distance) calculation result; for the latter, since we know the correct node matching between the graph pairs, the GED here can be directly calculated by using a specific cost function;
[0106] So the final objective loss function is:
[0107]
[0108] The final target loss function combines local matching, global matching, and adjustment of other related parameters. When the sum of the three is minimized, the result is optimal.
[0109] Embodiment 2:
[0110] An embodiment of the present invention provides a legal case similarity calculation system based on knowledge graph matching, the system comprising a text encoding module, a knowledge graph embedding module, a matching score matrix calculation module, a matrix pooling module, and a graph similarity calculation module, the style encoding module is connected to the knowledge graph embedding module and the matrix pooling module, the matching score matrix calculation module is connected to the knowledge graph embedding module and the matrix pooling module, the knowledge graph embedding module is connected to the graph similarity calculation module, and the matrix pooling module is connected to the graph similarity calculation module, wherein:
[0111] The text encoding module is used to convert node attributes and relationships in the knowledge graph into fixed-length vector representations;
[0112] The knowledge graph embedding module is used to aggregate the information of neighboring nodes and edges so that the knowledge graph node features can represent the vector representation of the local matching information between the source graph and the target graph;
[0113] The matching score matrix calculation module is used to initialize and iteratively update the matching score matrix and output it;
[0114] The matrix pooling module is used to extract the main features in the score matrix as vectors of specific dimensions and output them;
[0115] The graph similarity calculation module is used to calculate the text encoding similarity and graph encoding similarity between cases, connect the two similarities with the first score vector to form a second score vector, and input it into the multi-layer perceptron to obtain the final score;
[0116] Alternatively, the graph similarity calculation module is only used to input the first score vector into the multi-layer perceptron to obtain the final score;
[0117] Alternatively, the graph similarity calculation module is used to calculate any one of the text encoding similarity or the graph encoding similarity between cases, connect it with the first score vector to form a second score vector, and input it into the multilayer perceptron to obtain the final score.
[0118] Finally, it should be noted that the above embodiments are only for explaining the method of the present invention, and do not represent detailed description of all implementation details, nor do they represent that the present invention is limited to the above contents. Those skilled in the art can make various changes or modifications within the scope of the claims, and if these changes or modifications do not require creative work, they still fall within the scope of protection of the present invention.
Claims
1. A method for calculating the similarity of legal cases based on knowledge graph matching, characterized in that: The calculation method comprises the following steps: S1. The entity and relationship information in the knowledge graphs of the two cases are respectively converted into initial vectors through a text encoder; the knowledge graphs of the two cases are a source graph and a target graph respectively; S2. Using the initial vectors of the entities and relationships as input features, obtaining vectorized representations of entities in the knowledge graph through a first graph neural network; S3. taking the vectorized representation of the entity as input, and obtaining a matching score matrix between the two graphs according to a graph matching algorithm; S4. Pooling the matching score matrix to obtain a first score vector; S5. Connect the first score vector with the text encoding similarity and / or graph encoding similarity between cases to form a second score vector, input the second score vector into a multilayer perceptron, and obtain similarity scores of the two cases; The graph matching algorithm in step S3 is specifically: S31. Use the source image embedding matrix to multiply the transpose of the target image embedding matrix to obtain an initial matching score matrix; S33. Normalize the matrix of the result of the previous step; S34. Initialize the source graph node colors, give each source graph entity node a randomly generated color vector that conforms to a specific distribution; multiply the source graph node color matrix by the current matching score matrix to obtain the target graph node color matrix; S35. Obtaining, through a second graph neural network, a color embedding aggregation of source graph nodes and a color embedding aggregation of target graph nodes mapped from source graph nodes to target graph nodes, wherein the second graph neural network is also based on the MPNN framework; S36. According to the results of the source graph and the target graph node color embedding aggregation, the color representation of all nodes in the source graph and the color representation of all nodes in the target graph are differentiated according to the one-to-one correspondence between the nodes to obtain a difference vector; S37. Use a multilayer perceptron to map the difference vector into a specific score value, and finally use the score value to update the matching score matrix; S38. Repeat the above operations from S33 to S37 until the iteration condition is met.
2. According to claim 1, a method for calculating the similarity of legal cases based on knowledge graph matching is characterized in that: The text encoder in step S1 is an initial text embedding model generated based on the parameters of a large pre-trained model.
3. According to claim 1, a method for calculating the similarity of legal cases based on knowledge graph matching is characterized in that: The first graph neural network in step S2 is a graph neural network algorithm and its variants that conform to the message passing neural network (MPNN) framework concept.
4. According to claim 1, a method for calculating legal case similarity based on knowledge graph matching is characterized in that: The graph matching algorithm in step S3 further includes step S32. Sparse processing is performed on the initial matching score matrix. Step S32 can be placed before or after step S33.
5. A method for calculating legal case similarity based on knowledge graph matching according to any one of claims 1 to 4, characterized in that: The pooling in step S4 is a method that can reduce the scale of matrix representation and convert the matrix into a vector.
6. According to claim 1, a method for calculating legal case similarity based on knowledge graph matching is characterized in that: Step S5 is specifically as follows: S51. Using the initial vector output by the text encoder as the input feature, the feature similarity score matrix between all entity nodes of the source graph and the target graph is obtained according to the vector alignment; S52. Obtaining text encoding similarity between cases by performing a pooling operation on the feature similarity score matrix; S53. extract the embedding vector of the entity node corresponding to the case name in the first graph neural network output matrix, and calculate the vector similarity between the two case names as the graph encoding similarity; S54. Connect the first score vector in step S4 with the vector of the text encoding similarity between cases in step S52 and / or the vector of the image encoding similarity in step S53 using a function to obtain a second score vector; S55. Input the second score vector into the multilayer perceptron to obtain a final similarity score.
7. According to claim 1, a method for calculating legal case similarity based on knowledge graph matching is characterized in that: When the multilayer perceptron described in step S5 is training parameters, the algorithm supports the calculation of its loss function using the similarity scores between cases of the actual situation in a supervised manner; it also supports the calculation using the similarity scores between cases automatically calculated by the algorithm in an unsupervised manner; and it also supports a semi-supervised manner; the algorithm will automatically select the calculation method of its loss function based on whether the real scores of the training data are known.
8. A legal case similarity calculation system based on knowledge graph matching, characterized in that: The system includes a text encoding module, a knowledge graph embedding module, a matching score matrix calculation module, a matrix pooling module, and a graph similarity calculation module. The text encoding module is connected to the knowledge graph embedding module and the matrix pooling module, the matching score matrix calculation module is connected to the knowledge graph embedding module and the matrix pooling module, the knowledge graph embedding module is connected to the graph similarity calculation module, and the matrix pooling module is connected to the graph similarity calculation module, wherein: The text encoding module is used to convert node attributes and relationships in the knowledge graph into fixed-length vector representations; The knowledge graph embedding module is used to aggregate the information of neighboring nodes and edges so that the knowledge graph node features can represent the vector representation of the local matching information between the source graph and the target graph; A matching score matrix calculation module, used to obtain a matching score matrix according to the graph matching algorithm according to any one of claims 1 to 7, and output it; The matrix pooling module is used to extract the main features in the score matrix as vectors of specific dimensions and output them; The graph similarity calculation module is used to connect the first score vector with the text encoding similarity and / or graph encoding similarity between cases to form a second score vector, and input the second score vector into a multilayer perceptron to obtain a final score.
Citation Information
Patent Citations
Judgment document similarity judgment method and system based on legal knowledge graph
CN110795926A
Knowledge graph question-answering method and system based on graph neural network embedding matching
CN112765312A