Semantic search method based on legal knowledge graph

By decomposing user query text into structured legal core element subgraphs and performing structured alignment retrieval in a legal knowledge graph, the problem of inaccurate legal element matching in existing technologies is solved, achieving high-precision case retrieval and transparent search results.

CN121681802AInactive Publication Date: 2026-03-17GUANGDONG OCEAN UNIVERSITY
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511797231.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-02
Publication Date
2026-03-17
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing technologies cannot effectively identify and match the topological relationships between legal elements in legal semantic search, resulting in insufficient accuracy in case retrieval. This is especially true in complex cases involving multiple parties, intertwined behaviors, or cross-legal fields, where high-precision matching is difficult to achieve.

Method used

The user query text is decomposed into a structured subgraph of core legal elements through a multi-stage legal semantic deconstruction process. The structured alignment retrieval is then performed in a pre-built large-scale legal knowledge graph. Weighted aggregation is performed using node semantic similarity and logical weight matrix to generate a comprehensive relevance measure.

Benefits of technology

It significantly improves the accuracy of legal semantic search and the reference value of search results, achieves precise alignment from unstructured text to structured legal elements, and enhances the accuracy and transparency of case retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121681802A_ABST
    Figure CN121681802A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of artificial intelligence, and discloses a semantic search method based on a legal knowledge graph, and the method comprises the steps: carrying out legal semantic element deconstruction on a natural language query of a user, and generating a query element sub-graph; in the pre-constructed legal knowledge graph, executing structured alignment retrieval in a mode of combining core node semantic pre-screening and graph structure isomorphism test; and performing weighted aggregation on the multi-dimensional element matching scores based on a legal element weight model to generate comprehensive correlation measurement, and sorting and returning a result according to the comprehensive correlation measurement. The system comprises a legal knowledge graph construction module, a query deconstruction module, a structured retrieval module and an interpretable abstract generation module. According to the method, through structured legal element alignment and weighted correlation evaluation, the accuracy, logicality and interpretability of class case retrieval are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of artificial intelligence, specifically relating to a semantic search method based on legal knowledge graphs. Background Technology

[0002] With the deep integration of artificial intelligence and legal technology, legal intelligent retrieval systems based on natural language processing have been widely used in judicial practice, legal consultation, and compliance review. Current mainstream semantic search methods primarily rely on pre-trained language models to represent user queries and case law texts as a whole semantic vector, and then achieve matching through vector similarity.

[0003] However, legal cases are highly structured and element-based, with their core judgment logic relying on the logical connections between legally defined elements such as "subject—behavior—object—result—subjective state." Traditional semantic search treats complex cases as unstructured text fragments, making it difficult to identify and distinguish the multidimensional legal elements and their interrelationships. This results in search results that, while similar on the surface semantic level, exhibit significant deviations at the level of legal elements.

[0004] Precise case retrieval in the legal field urgently needs to shift from "semantic similarity" to "elemental similarity." The core of this direction lies in constructing a knowledge representation system capable of depicting the inherent logic of legal facts and supporting structured analysis of case descriptions in users' natural language. While existing technologies attempt to enhance retrieval relevance by introducing keyword extraction or simple entity recognition, they lack the ability to model the topological relationships between legal elements. They cannot effectively express complex causal chains such as "what actions the infringer committed caused what harm the victim suffered," and they struggle to handle linguistic variability in real-world scenarios, such as missing elements, ambiguous expressions, or inverted word order.

[0005] Existing technologies still have several limitations in the understanding of legal semantics: First, they fail to establish a unified ontological framework for legal case elements, resulting in the inability to align and compare elements between different cases; second, the natural language parsing process processes words or phrases in isolation, ignoring the dependencies and constraints between elements, leading to misjudgments or omissions of key legal facts; third, the retrieval mechanism is limited to vector matching at the full-text or paragraph level, lacking the ability to perform subgraph isomorphism or graph reasoning in a structured knowledge space, making it difficult to achieve accurate matching of legal element combination patterns.

[0006] The aforementioned problems are particularly prominent in complex cases involving multiple parties, intertwined behaviors, or cross-legal fields, severely restricting the accuracy of similar case recommendations and their judicial reference value. Therefore, there is an urgent need for a structured semantic search method based on legal knowledge graphs to achieve automatic mapping and high-precision matching from unstructured case descriptions to standardized legal element graphs. Summary of the Invention

[0007] To address the technical problem in existing technologies where overall semantic matching fails to accurately capture key legal elements in users' natural language queries, resulting in insufficient accuracy in case retrieval, this invention provides a semantic search method based on legal knowledge graphs.

[0008] The core technical solution of the present invention lies in that, instead of performing overall vectorization processing on the natural language legal query text input by the user, it precisely decomposes the unstructured query text into a set of predefined, structured legal core elements through a multi-stage legal semantic deconstruction process. The legal core elements include the parties involved, legal acts, facts of damage, litigation claims, and subjective state.

[0009] Correspondingly, this invention pre-constructs a large-scale legal knowledge graph, which deconstructs a massive amount of existing legal documents into graph-structured data with core legal elements as nodes and logical relationships between elements as edges. During retrieval, this invention performs an alignment and matching process between the query element subgraph formed after deconstructing the query text and the massive case subgraph in the legal knowledge graph, based on dual constraints of structural topology and node semantics.

[0010] The matching process does not calculate a single similarity score. Instead, it calculates the semantic similarity in the vector space of each pair of aligned core legal element nodes. Based on a preset legal logic weight matrix, the similarity scores of each element are weighted and aggregated to generate a comprehensive relevance measure that reflects the degree of matching of the core legal disputes of the case. Finally, the search results are ranked based on this measure, thereby significantly improving the substantive relevance between the returned cases and the queried cases at the level of legal elements.

[0011] According to an aspect of the present invention, a semantic search method based on a legal knowledge graph is provided, comprising: receiving a natural language legal query text input by a user; deconstructing the natural language legal query text into legal semantic elements, and extracting a query element subgraph containing multiple core legal element nodes.

[0012] In a pre-constructed legal knowledge graph containing a massive number of case subgraphs, a structured alignment retrieval with the query element subgraph is performed. The structured alignment retrieval includes candidate case filtering based on node semantic similarity and precise matching based on graph structural isomorphism.

[0013] For each candidate case subgraph obtained through precise matching, a multi-dimensional element matching score is calculated between it and the query element subgraph. Based on a preset legal element weight model, the multi-dimensional element matching scores are aggregated into a single comprehensive relevance measure. All candidate cases are sorted in descending order based on the comprehensive relevance measure, and the sorting result is returned as the final case retrieval list.

[0014] As one embodiment of the present invention, the process of pre-constructing the legal knowledge graph specifically includes: collecting a multi-source heterogeneous legal text corpus containing judgments, rulings, laws and regulations, and judicial interpretations; defining an ontology model of the legal knowledge graph, wherein the ontology model pre-defines a set of types of nodes of core legal elements and a set of types of relationships between elements, wherein the set of node types includes parties, legal acts, time, place, subject matter, damage results, litigation claims, and legal basis, and the set of relationship types includes acting subjects, acting objects, causal relationships, subordinate relationships, and citation relationships.

[0015] A joint learning model is employed to automatically extract information from the legal text corpus to populate the legal knowledge graph. The joint learning model integrates a bidirectional long short-term memory network layer for entity recognition and a graph convolutional network layer for relation extraction. Both layers share the underlying text encoding representation, which is generated by a bidirectional encoder representation model based on a transformer architecture that has been incrementally pre-trained on legal domain text. The extracted entities and relations are instantiated as nodes and edges in the graph and stored in a graph database that supports an attribute graph model. The graph database uses an adjacency list as its underlying data structure for efficient graph traversal and subgraph matching operations.

[0016] Furthermore, the deconstruction of legal semantic elements in natural language legal query text specifically includes: using the same joint learning model as in the construction of the legal knowledge graph, performing named entity recognition on the input natural language legal query text, and labeling text fragments that refer to different core legal elements; based on the identified entities, applying the graph convolutional network layer in the joint learning model to predict and extract the legal logical relationships between entities, wherein the establishment of the relationships is based on the model's attention weight distribution of entities to the context text.

[0017] The identified entities are used as nodes, and the extracted relationships are used as directed edges connecting the nodes to construct the query element subgraph, where each node is accompanied by its original text fragment and a semantic vector generated by the bidirectional encoder representation model of the transformer architecture.

[0018] As one embodiment of the present invention, the structured alignment retrieval performed in the legal knowledge graph specifically includes: First, selecting core legal behavior nodes from the query element subgraph and using their semantic vectors as query vectors; using an approximate nearest neighbor search index based on a multi-layer navigable small-world graph, quickly retrieving several candidate behavior nodes whose cosine similarity to the query vector is higher than a first preset threshold from all legal behavior type nodes in the legal knowledge graph; and using each candidate behavior node as the center, performing a breadth-first traversal with a limited depth in the legal knowledge graph to generate several initial candidate case subgraphs.

[0019] Then, for each initial candidate case subgraph, a subgraph isomorphism determination algorithm is executed to check whether its topological structure matches the topological structure of the query element subgraph. The subgraph isomorphism determination algorithm is a backtracking search-based algorithm that requires that the node types be strictly consistent when matching nodes. All initial candidate case subgraphs that are isomorphic to the structure of the query element subgraph are selected as precise matching candidate case subgraphs for the subsequent scoring stage.

[0020] Furthermore, the process of calculating multi-dimensional element matching scores and aggregating them into a comprehensive relevance measure specifically includes: for the precise matching candidate case subgraph, pairing it node by node with the query element subgraph to form several legal core element pairs; for each legal core element pair, extracting its respective semantic vector, and calculating the cosine similarity between these two vectors to obtain the matching score of that element dimension, thereby forming a multi-dimensional score vector that includes party matching score, legal behavior matching score, and damage result matching score.

[0021] From the pre-constructed legal element weight model, based on the case type involved in the current query, the corresponding weight vector is retrieved and obtained. Each dimension of the weight vector corresponds to the importance weight of the core legal element. The weight model is constructed by performing topic model analysis on the text of judges' arguments in a large number of historical cases, and statistically analyzing the frequency and length of each legal element discussed under different case types. The multi-dimensional score vector and the weight vector are multiplied element by element and then summed, i.e., a weighted summation operation is performed. The result is the comprehensive relevance measure between the candidate case subgraph and the query element subgraph.

[0022] As one embodiment of the present invention, after sorting all candidate cases in descending order according to the comprehensive relevance measure, the method further includes the step of generating an explanatory summary. This step specifically involves: for several candidate cases with high ranking, tracing back their node matching relationship with the query element subgraph; for each matched legal core element pair, if its semantic similarity is higher than a second preset threshold, then the matching relationship is marked as "highly relevant".

[0023] The system automatically generates a summary text that clearly indicates which specific core legal elements of the retrieved cases are highly relevant to the user's query, and displays the original text fragments corresponding to these elements side by side, thus providing the user with interpretable evidence for the search results.

[0024] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. This invention deconstructs user queries and legal documents by deeply analyzing their legal semantic elements, transforming the retrieval process from fuzzy semantic matching of unstructured text to precise alignment of structured legal elements. This fundamentally solves the problem that traditional methods cannot identify and utilize the internal legal logic structure of cases, greatly improving the accuracy of retrieval.

[0025] 2. This invention introduces a comprehensive relevance measurement method based on a legal element weight model. This method simulates the thinking pattern of legal professionals when judging the similarity of cases, that is, giving different degrees of attention to different legal elements, making the ranking results more in line with legal logic and practical needs, and significantly improving the reference value of the returned cases.

[0026] 3. The legal knowledge graph constructed in this invention not only serves retrieval but is itself a structured legal knowledge base that can support more complex legal intelligent applications. At the same time, the explanatory summaries generated during the retrieval process enhance the system's transparency and user trust, realizing a transformation from "black box" retrieval to "white box" auxiliary analysis.

[0027] 4. The structured alignment retrieval strategy of this invention, by combining semantic pre-screening of core nodes with subsequent graph isomorphism testing, effectively controls computational complexity while ensuring matching accuracy, thus ensuring retrieval efficiency on large-scale legal knowledge graphs and making it feasible for practical application. Attached Figure Description

[0028] Figure 1 This is a schematic diagram of the overall technical solution architecture of the semantic search method based on legal knowledge graph proposed in this invention; Figure 2 This is a schematic diagram illustrating the core principle framework of the deconstruction and structured alignment matching of legal semantic elements in this invention; Figure 3 This is a flowchart illustrating the logical process of deconstructing the legal semantic elements of natural language legal query text in this invention. Figure 4 This is a logical flowchart of the legal knowledge graph construction and the structured filling of multi-source heterogeneous legal texts in this invention; Figure 5This is a schematic diagram of the multi-level interaction relationships and data flow of structured alignment retrieval in this invention. Detailed Implementation

[0029] Please refer to Figures 1 to 5 This invention provides a semantic search method based on a legal knowledge graph. Its core lies in deconstructing the user-input natural language legal query text into a structured subgraph of core legal elements, and performing alignment retrieval based on the dual constraints of graph structure and node semantics within a pre-constructed large-scale legal knowledge graph. Finally, a comprehensive relevance measure is generated through weighted aggregation of multi-dimensional element matching scores, achieving high-precision case retrieval. The following detailed description of this embodiment, in conjunction with each S-step in the method flow, further illustrates this embodiment.

[0030] This system receives natural language legal query text input by the user. This text, submitted by the user through a graphical user interface or application programming interface (API), is an unstructured natural language statement describing a specific legal dispute or case fact, such as, "Company A used Company B's registered trademark on its product packaging without Company B's permission, causing consumer confusion. Company B suffered economic losses as a result and filed a lawsuit." This text does not contain predefined formats, tags, or structured fields; it relies entirely on subsequent processing modules for semantic parsing and element extraction.

[0031] The natural language legal query text is deconstructed into legal semantic elements, extracting a query element subgraph containing multiple core legal element nodes. This process first calls a bidirectional encoder representation model with a transformer architecture that has been incrementally pre-trained on legal domain text to perform context-aware lexical embedding encoding on the input text, generating a dense vector representation for each lexical element.

[0032] Subsequently, the encoded result is input into a joint learning model, which consists of a bidirectional long short-term memory network layer for named entity recognition and a graph convolutional network layer for relation extraction, both sharing the underlying encoding representation. The bidirectional long short-term memory network layer performs sequence labeling on the word sequence in the text based on a preset set of legal core element types, identifying entity fragments belonging to types such as parties, legal acts, damage results, litigation claims, and subjective states.

[0033] For example, in the aforementioned example, "Company A" is labeled as a party entity, "use of registered trademark" is labeled as a legal act entity, "consumer confusion" and "economic loss" are labeled as damage result entities, and "filing a lawsuit" is labeled as a lawsuit claim entity. All identified entities retain their original text fragments, and the bidirectional encoder representation model of the transformer architecture performs pooling operations on them to generate corresponding semantic vectors.

[0034] Next, the graph convolutional network layer uses the identified entities as initial nodes to construct a temporary adjacency matrix. By modeling the distribution of attention weights within the context window between entity pairs, it predicts whether there are predefined relationship types between entities, such as subject, object, or causal relationship. If the attention weights between two entities exceed a preset threshold, a directed edge is established between them, and the type of the edge is determined by the classification head output.

[0035] Ultimately, all entity nodes and their relationships together form a query feature subgraph, which is stored in memory as an attribute graph. Each node contains three attributes: node type, original text fragment, and semantic vector, and each edge contains a relationship type attribute.

[0036] In a pre-constructed legal knowledge graph containing a massive number of case subgraphs, a structured alignment retrieval with the query element subgraphs is performed. The construction process of this legal knowledge graph includes: collecting multi-source heterogeneous legal text corpora from the Supreme People's Court Judgments Online website, the public judgment databases of local courts at all levels, the national legal database, and compilations of judicial interpretations; defining the legal knowledge graph ontology model, which explicitly stipulates that the node type set includes eight categories: parties, legal acts, time, place, subject matter, damage result, litigation claim, and legal basis; and the relationship type set includes five categories: acting subject, acting object, causal relationship, subordinate relationship, and citation relationship.

[0037] Employing the same joint learning model as the query deconstruction phase, automated information extraction is performed on each legal document in the corpus. The extracted entities and relationships are instantiated as graph nodes and edges, and persistently stored in a graph database supporting an attribute graph model. This graph database organizes its adjacency list structure using memory-mapped files, supporting efficient graph traversal and subgraph matching operations. During structured alignment retrieval, legal behavior nodes are first selected as core anchor points from the query element subgraph, due to their central role in most civil and criminal cases.

[0038] The semantic vector of the node is used as the query vector and input into an approximate nearest neighbor search index constructed based on a multi-layered navigable small-world graph. This index pre-indexes and organizes the semantic vectors of all legal behavior type nodes in the legal knowledge graph, and can return several candidate behavior nodes with a cosine similarity to the query vector higher than a first preset threshold (e.g., 0.75) in sublinear time. Centered on each candidate behavior node, a breadth-first traversal with a depth of no more than 3 hops is performed in the graph database to collect all connected nodes and edges in its neighborhood, forming an initial candidate case subgraph. Subsequently, for each initial candidate case subgraph, a subgraph isomorphism determination algorithm based on backtracking search is run.

[0039] The algorithm uses the query feature subgraph as the pattern graph and the initial candidate case subgraph as the target graph, attempting to establish node mappings layer by layer. During the mapping process, each node in the pattern graph must map to a node of the exact same type in the target graph, and the relationship types of all edges must also strictly correspond. If a complete injective mapping exists that satisfies these conditions, the initial candidate case subgraph is determined to be a structurally isomorphic exact matching candidate case subgraph and added to the subsequent scoring queue.

[0040] For each candidate case subgraph obtained through exact matching, a multi-dimensional element matching score is calculated between it and the query element subgraph. Based on a preset legal element weighting model, these multi-dimensional element matching scores are aggregated into a single comprehensive relevance measure. Specifically, for the exact-matched candidate case subgraph, based on the node mapping relationship established during the subgraph isomorphism determination process, each node in the query element subgraph is paired with its corresponding node in the candidate case subgraph, forming several legal core element pairs. For each element pair, its associated semantic vector is extracted, and the cosine similarity between them is calculated using the following formula: ; in, Indicates the first The matching score of each core legal element. To query the first element in the feature subgraph The semantic vector of each node, This represents the semantic vector of the corresponding node in the candidate case subgraph. This leads to the multi-dimensional score vector. Its dimension number is equal to the total number of nodes in the query element subgraph. Simultaneously, based on the case type identified in the query text (e.g., trademark infringement, breach of contract, personal injury compensation), the system retrieves the corresponding weight vector from the pre-built legal element weight model. The construction process of this weighting model involves: conducting a thematic model analysis on the judges' arguments in over 100,000 publicly available historical judgments; statistically analyzing the frequency and average length of various core legal elements in the arguments across different case types; and then normalizing the data to determine the importance weights of each element. For example, in trademark infringement cases, legal acts and damage results have higher weights, while time and place have lower weights. Finally, a comprehensive relevance measurement is performed. The formula is obtained through weighted summation as follows: ; This metric reflects the degree to which the candidate case substantially matches the query case in terms of the legal elements.

[0041] All candidate cases are sorted in descending order based on the comprehensive relevance metric, and the sorting results are returned as the final case retrieval list. The sorted list is arranged from highest to lowest $R$ value, and each entry includes the case number, the court of trial, the date of judgment, and a brief cause of action. Furthermore, the method includes a step of generating an explanatory summary. For the top five candidate cases, the system backtracks their node matching relationships with the query element subgraph. For each pair of legal core elements, if their semantic similarity $s_i$ is higher than a second preset threshold (e.g., 0.85), the element pair is marked as "highly relevant".

[0042] Subsequently, a structured summary text is automatically generated, which clearly states: "This case highly matches the case you queried in terms of the following legal elements: parties involved—'Company A' and 'Company C'; legal act—'unauthorized use of a registered trademark'; damages—'causing consumer confusion and economic losses'." Simultaneously, the query text and corresponding text fragments from the candidate cases are displayed side-by-side, for example, the left side shows "Company A without Company B's permission…", and the right side shows "Company C used Company D's trademark without authorization…". This summary is directly embedded in the search results page, providing users with transparent and traceable matching evidence and enhancing the credibility of the system's decision-making.

[0043] Throughout the methodology, the data flow remains structured and traceable. All semantic vectors are represented using 32-bit floating-point arrays with a fixed dimension of 768, consistent with the output dimension of the bidirectional encoder representation model in the underlying transformer architecture. The adjacency list in the graph database is organized in key-value pairs, where the key is a unique node identifier and the value is a list of associated edges, with each edge recording the target node identifier and relation type.

[0044] The subgraph isomorphism determination algorithm employs a recursive backtracking strategy, setting a maximum recursion depth of 10 levels to prevent getting stuck in infinite loops in complex graph structures. The construction parameters for the approximate nearest neighbor search index include: 16 neighbors per level and a dynamic pruning factor of 200, ensuring a retrieval latency of less than 500 milliseconds even with millions of nodes. The legal element weight model is stored in a hash table, with the case type string as the key and floating-point weight arrays as the values, loaded into memory for real-time querying.

[0045] An exception handling mechanism is implemented throughout the entire process. If the length of the natural language legal query text exceeds a preset limit (e.g., 2000 characters), the system truncates the excess portion and logs it. If the joint learning model fails to identify any legal action nodes, the subsequent search is terminated and an error message "No valid legal action detected, please describe the case again" is returned. If no structurally isomorphic candidate case subgraphs are found during the structured alignment search stage, a fallback search strategy based on full-text keywords is implemented, and the results page is marked "No structurally matching cases found; the following are keyword-related results." All intermediate data structures are released from memory immediately after a single query to ensure the long-term stability of the system.

[0046] This embodiment tightly couples four stages—legal semantic deconstruction, knowledge graph alignment, element weighted scoring, and interpretability generation—to achieve a complete closed loop from unstructured queries to structured case recommendations. This method not only significantly improves retrieval accuracy but also, through explicit legal logic modeling, makes the system output professionally interpretable, meeting the stringent requirements of legal professionals for the reliability and transparency of search results.

Claims

1. A semantic search method based on a legal knowledge graph, characterized in that, Comprise: Receiving a natural language legal query text input by a user; Carrying out legal semantic element disintegration on the natural language legal query text, extracting a query element subgraph containing multiple legal core element nodes; In a pre-constructed legal knowledge graph storing a large number of case subgraphs, performing a structured alignment retrieval with the query element subgraph, which includes candidate case screening based on node semantic similarity and accurate matching based on graph structure isomorphism; For each candidate case subgraph obtained through accurate matching, calculating the multi-dimensional element matching score between it and the query element subgraph, and aggregating the multi-dimensional element matching score into a single comprehensive relevance measure according to a pre-set legal element weight model; According to the comprehensive relevance measure, all candidate cases are sorted in descending order, and the sorting result is returned as the final case retrieval list. 2.The method of claim 1, wherein, The process of the pre-constructed legal knowledge graph comprises: Collecting a multi-source heterogeneous legal text corpus containing judgment, ruling, laws and regulations, and judicial interpretation; Defining the ontology model of the legal knowledge graph, which pre-sets the type set of legal core element nodes and the type set of element relationships, the node type set contains parties, legal behavior, time, place, subject matter, damage result, litigation request, legal basis, and the relationship type set contains behavior subject, behavior object, causal relationship, subordinate relationship, and reference relationship; An integrated learning model is used to automatically extract information from the legal text corpus to fill the legal knowledge graph, which integrates a bidirectional long short-term memory network layer for entity recognition and a graph convolutional network layer for relationship extraction, both of which share a bottom text encoding representation generated by a transformer architecture bidirectional encoder representation model pre-trained on legal domain text; The extracted entities and relationships are instantiated as nodes and edges in the graph and stored in a graph database supporting the attribute graph model, which uses an adjacency list as the underlying data structure for efficient graph traversal and subgraph matching operations. 3.The method of claim 2, wherein, The legal semantic element disintegration on the natural language legal query text comprises: Using the same integrated learning model as in the legal knowledge graph construction process, performing named entity recognition on the input natural language legal query text to label the text segments referring to different legal core elements in the text; Based on the identified entities, applying the graph convolutional network layer in the integrated learning model to predict and extract the legal logical relationships between the entities, the establishment of the relationships is based on the attention weight distribution of the model on the context text of the entity pair; The identified entities are used as nodes, and the extracted relationships are used as directed edges connecting the nodes to construct the query element subgraph, wherein each node is attached with its original text segment and a semantic vector generated by the transformer architecture bidirectional encoder representation model. 4.The method of claim 3, wherein, The structured alignment retrieval performed in the legal knowledge graph comprises: selecting a core legal action node from the query element subgraph, taking the semantic vector of the core legal action node as a query vector; using an approximate nearest neighbor search index based on a multi-layer navigable small world graph, searching for several candidate action nodes from all legal action type nodes in the legal knowledge graph, which have a cosine similarity higher than a first preset threshold value with the query vector; performing a breadth-first traversal in the legal knowledge graph with each candidate action node as a center, and generating several initial candidate case subgraphs with a limited depth; performing a subgraph isomorphism determination algorithm on each initial candidate case subgraph to determine whether the topological structure of the initial candidate case subgraph matches the topological structure of the query element subgraph, the subgraph isomorphism determination algorithm being a backtracking search-based algorithm that requires strict consistency of node types when matching nodes; screening all initial candidate case subgraphs that are structurally isomorphic to the query element subgraph as accurate matching candidate case subgraphs for a subsequent scoring stage. 5.The method of claim 4, wherein, The process of calculating multi-dimensional element matching scores and aggregating them into a comprehensive relevance measure includes: pairing each node of the accurate matching candidate case subgraph with a node of the query element subgraph to form several pairs of legal core elements; extracting semantic vectors attached to each pair of legal core elements, calculating the cosine similarity between the two vectors to obtain a matching score for the element dimension, and forming a multi-dimensional score vector including a party matching score, a legal action matching score, and a damage result matching score; from a pre-constructed legal element weight model, querying and obtaining a corresponding weight vector according to the case type involved in the current query, each dimension of the weight vector corresponding to the importance weight of a legal core element, the weight model being constructed by performing topic modeling analysis on texts in judge's discussion sections in a large number of historical cases to obtain the frequency and length proportion of each legal element discussed in different case types; performing an element-by-element multiplication of the multi-dimensional score vector and the weight vector and then summing the results to obtain a comprehensive relevance measure between the candidate case subgraph and the query element subgraph. 6.The method of claim 5, wherein, The first preset threshold value is 0.

75. 7.The method of claim 5, wherein, The depth of the breadth-first traversal is not more than 3 hops. 8.The method of claim 5, wherein, The subgraph isomorphism determination algorithm sets a maximum recursion depth of 10 layers. 9.The method of claim 5, wherein, After sorting all candidate cases in descending order according to the comprehensive relevance measure, the method further includes a step of generating an explanatory summary, which includes: for several candidate cases ranked at the top, tracing back the node matching relationship with the query element subgraph; for each matched pair of legal core elements, if the semantic similarity is higher than a second preset threshold value, marking the matching relationship as "highly relevant"; automatically generating a summary text that clearly indicates which specific legal core elements the retrieved cases are highly relevant to the user's query, and displaying the original text segments corresponding to these elements, thereby providing an interpretable basis for the user to understand the search results. 10.The method of claim 9, wherein, The second preset threshold value is 0.85.

Citation Information

Cited By

  • Method and device for querying laws and regulations based on coal mine laws and regulations knowledge graph

    CN121935368A

  • Regulation retrieval processing method and device of large language model

    CN122153134A