A legal search matching method, system and storage medium
By constructing a case library and matching the hierarchical order of query intent paths, and combining it with a legal feature relational database for progressive filtering, the problems of high computational overhead and inconsistent results in existing technologies are solved, achieving efficient and accurate legal retrieval.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NANCHANG CAMPUS OF EAST CHINA UNIV OF TECH
- Filing Date
- 2026-01-15
- Publication Date
- 2026-04-17
AI Technical Summary
Existing legal retrieval methods incur high computational costs in large-scale knowledge graphs, resulting in slow response times. Furthermore, the lack of an effective progressive filtering mechanism leads to low retrieval efficiency and inconsistent results.
By constructing case fact paths and query intent paths in the case library, hierarchical order matching is performed using legal entities and semantic relationships. This is combined with a predefined legal feature relationship library for initial screening and layer-by-layer verification, terminating subsequent processing of mismatches and outputting structurally consistent search results.
While ensuring consistency of legal logic, it significantly improves search efficiency and accuracy, reduces the computational load of irrelevant cases, and enhances the applicability of precedents and search speed.
Smart Images

Figure CN121524329B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of legal search, and specifically relates to case search. It discloses a legal search matching method, system and storage medium. Background Technology
[0002] With the deepening of judicial informatization, the demand for case retrieval in legal practice and judicial decision support is becoming increasingly urgent. Currently, mainstream legal retrieval methods generally rely on constructing structured legal knowledge graphs to parse users' natural language queries into semantic representations and match them with semantic relationships in the graph to achieve intent-driven intelligent retrieval.
[0003] For example, the semantic search method, device and electronic device based on legal knowledge graph proposed in Chinese invention patent publication number CN112632226A preprocesses the legal question description input by the user, extracts entity-relationship-entity triples to construct a semantic search graph, then establishes category labels based on the types of laws and regulations, and finally performs subgraph matching between the semantic search graph and the legal knowledge graph.
[0004] While this method can understand user query intent to some extent, its overall subgraph matching approach suffers from significant efficiency issues. Because it requires complex similarity calculations across the entire subgraph structure, the computational cost increases dramatically when the knowledge graph is large, leading to a significant decrease in system response speed and making it difficult to meet the real-time retrieval requirements of practical applications.
[0005] For example, the semantic search method, device and medium based on legal knowledge graph proposed in Chinese invention patent publication number CN119311845B, gradually eliminates irrelevant query results by cross-matching the query elements with the query result sets corresponding to other query elements one by one.
[0006] This set theory-based matching method ignores the hierarchical relationship and logical structure between legal elements, which can easily lead to the problem that although the semantic elements are matched locally, the overall legal logic is inconsistent. This can introduce structural misalignment-type false detections, affecting the legal accuracy and case applicability of the search results.
[0007] Furthermore, existing technologies generally lack effective progressive filtering mechanisms. Both overall subgraph matching and cross-matching employ a one-off matching strategy, failing to quickly eliminate a large number of irrelevant cases in the early stages of matching. This forces the system to perform costly calculations on a large case database, severely limiting the improvement of retrieval efficiency. Summary of the Invention
[0008] Therefore, one objective of this application is to provide a legal search matching method, system, and storage medium that achieves an efficient and progressive case matching and retrieval mechanism while ensuring the consistency of legal logic, effectively solving the problems existing in the prior art.
[0009] The objective of this invention can be achieved through the following technical solution: The first aspect of this invention proposes a legal search matching method, which includes the following steps: performing legal entity identification and semantic relation extraction on case texts stored in the case database, and constructing a case fact path with entities as nodes and semantic relations as edges.
[0010] Extract legal entities and their syntactic dependencies from the user's query, and construct a query intent path with legal entities as nodes and semantic dependencies as edges.
[0011] The query intent path is classified into cases based on a predefined legal feature relation database. Each entry in the legal feature relation database defines a set of feature relations and a corresponding case category.
[0012] Based on the case category, similar cases are retrieved from the case database to form a preliminary candidate case set.
[0013] The case fact path of each case in the primary candidate case set is verified by a semantic similarity matching mechanism based on the node hierarchy. When the hierarchical matching is successful, the next level of matching is entered; when the hierarchical matching fails, the subsequent matching is terminated.
[0014] For all cases that match across all levels, sort and output them according to the degree of matching at each level node.
[0015] A second aspect of the present invention proposes a legal search matching system, comprising the following modules: a path construction module, used to identify legal entities and extract semantic relationships from case texts stored in a case database, construct a case fact path, and extract legal entities and grammatical dependencies between entities from natural language query statements input by users, constructing a query intent path.
[0016] The case screening module is used to classify the cases to which the query intent path belongs based on a predefined legal feature relationship database. According to the case classification, it retrieves cases of the same category from the case database to form a preliminary candidate case set. Each entry in the legal feature relationship database defines a feature relationship set and a corresponding case category.
[0017] The hierarchical matching module is used to perform hierarchical order matching verification for each case in the primary candidate case set. It includes a hierarchical numbering unit, a similarity calculation unit, and a matching control unit. The matching control unit immediately terminates the subsequent matching of the case if the matching fails at any level.
[0018] The results output module is used to sort and output all cases that have passed all levels of matching according to the degree of matching of the level nodes.
[0019] A third aspect of the present invention provides a storage medium on which a computer program is burned, which, when run in the memory of a server, implements the legal search and matching method described in the present invention.
[0020] Combining all the above technical solutions, the positive effects of this invention are as follows: 1. This invention extracts legal entities and semantic relationships from each case in the case library to construct a case fact path, extracts legal entities and syntactic dependencies between entities from the user's natural language query statement to construct a query intent path, explicitly represents the structured semantic logic of the case's legal facts and the user's search intent, and matches the legal rule library based on the relationships in the query path to achieve automatic case classification driven by legal elements, thereby limiting the search scope and filtering irrelevant cases in advance, and significantly improving search efficiency while ensuring the recall of relevant cases.
[0021] 2. After obtaining the initial candidate case set, this invention introduces a semantic similarity matching mechanism based on the node hierarchy order. It only proceeds to the next level of matching when the semantic similarity of the current level meets the standard; otherwise, it immediately terminates the subsequent verification of the case. This mechanism explicitly models the hierarchical dependency and logical sequence between legal elements, effectively avoiding structural mismatch matching, and can improve the consistency, accuracy, and applicability of the search results in terms of legal logic to a certain extent.
[0022] 3. After completing the hierarchical matching, this invention sorts and outputs all cases that have passed all levels of verification according to the degree of semantic matching between the nodes at each level, so that the search results ranked higher have higher semantic consistency in terms of legal fact structure and user query intent. Attached Figure Description
[0023] The present invention will be further described with reference to the accompanying drawings, but the embodiments in the drawings do not constitute any limitation on the present invention. For those skilled in the art, other drawings can be obtained based on the following drawings without creative effort.
[0024] Figure 1 This diagram illustrates the implementation steps of a legal search and matching method according to the present invention.
[0025] Figure 2 This is a flowchart illustrating the implementation of the semantic similarity matching mechanism based on the node hierarchy order for the case fact path of each case in the primary candidate case set in this invention.
[0026] Figure 3This is a module connection diagram of a legal search and matching system in this invention.
[0027] Figure 4 This is a diagram showing the unit configuration of the hierarchical matching module in this invention. Detailed Implementation
[0028] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0029] Example 1
[0030] See Figure 1 As shown, the present invention proposes a legal search matching method, which includes the following steps: S1, performing legal entity identification and semantic relationship extraction on the case texts stored in the case database, and constructing a case fact path with entities as nodes and semantic relationships as edges.
[0031] In general case texts, this mainly refers to judgments, which are essentially structured statements of legal facts. Their function is to identify the actors, legal acts, objects of the acts, legal consequences, and the logical relationships between these elements. This narrative process contains two types of semantic elements: legal entities and semantic relationships.
[0032] Among them, legal entities refer to objects that assume specific legal roles in legal facts, such as natural persons, legal persons, acts, rights, and results, which embody the basic constituent units of legal facts and the anchor points for the attribution of rights and obligations.
[0033] Semantic relations refer to predicate structures such as implementation, causation, violation, and prosecution that connect these entities and represent their interactions and legal logic. They embody the logical context and dependent relationships within legal facts.
[0034] Together, these two elements constitute the formal framework of the facts of a case: the legal entity establishes the factual elements of who did what, clarifying the participants in the legal relationship and their objects of action; the semantic relationship depicts the logical interdependence and legal causal structure among these elements, revealing the basis for attribution and normative connections between actions and consequences. Together, they provide the semantic foundation for constructing the path of the facts of the case.
[0035] In the preferred implementation of the above scheme, the process of constructing the case fact path is as follows: read the full text of each case from the case library, and use a legal domain named entity recognition model to identify the legal entities in the text. The legal entities include legal subjects, legal acts, legal objects, and legal results.
[0036] It should be noted that legal entities are not generic named entities in ordinary natural language text, such as personal names, place names, or organization names. Rather, they are semantic units with specific legal role attributes. Because legal entities in judicial texts bear the key functions of determining the attribution of rights and obligations, the fulfillment of requirements, and the logical deduction of judgments, their boundaries and categories cannot be accurately captured by generic named entity recognition. Therefore, this invention adopts a named entity recognition model oriented towards the legal field. This model is typically constructed based on the following implementation logic: First, based on the theory of legal fact formation, fine-grained entity types such as legal subjects, legal acts, legal objects, and legal results are defined, and a large-scale manually annotated legal text corpus is constructed.
[0037] In specific examples, legal subjects include natural persons and legal persons; legal acts include the conclusion of contracts and torts; legal objects include property, rights, and obligations; and legal results include damages and invalidity of contracts.
[0038] Then, based on the general language model, domain pre-training is carried out using legal corpora such as court judgments to improve the model's ability to generalize legal expression patterns.
[0039] Through the aforementioned mechanism, the model can distinguish entities in the legal context, laying the foundation for constructing the factual path of a case.
[0040] A legal semantic relationship extraction model is used to extract semantic relationships between legal entities, including litigation relationships, implementation relationships, and violation relationships.
[0041] Given that legal entities themselves only represent static components of factual elements, while legal relationships carry dynamic legal logic between entities, this invention further introduces a legal semantic relationship extraction model to extract the dependency structure between legal subjects. The construction logic of this model is as follows: First, based on the theory of legal elements, a set of discriminative semantic relationship types, such as prosecution relationship, implementation relationship, and violation relationship, are predefined to form judicial reasoning relationships.
[0042] Secondly, using a manually annotated dataset of legal text triples, specifically head entity – relation – tail entity, an end-to-end relation classifier is trained. Combining legal entity location tags and dependency syntax features, the classifier determines whether a target relation exists between two entities and its type.
[0043] This model not only identifies whether a relationship exists, but also emphasizes the legal functionality of the relationship and its relevance to adjudication, thereby ensuring that the extracted semantic relationships can truly reflect the attribution logic in the facts of the case.
[0044] Using the identified legal entities as nodes and the semantic relationships between them as directed edges, the case facts are connected in the logical order of the case facts to form a case fact path.
[0045] Assign a unique identifier to each case fact path and store it in association with the corresponding case.
[0046] S2. Extract legal entities and their syntactic dependencies from the user's query statement. Construct a query intent path with legal entities as nodes and semantic dependencies as edges.
[0047] Similarly, natural language queries entered by users usually express their legal claims in an unstructured form. Behind these queries lies a concern for legal subjects, behaviors, objects, and consequences, and contains a logical structure consistent with judicial facts, such as a subject performing a certain behavior, resulting in a certain outcome, or involving a specific legal relationship.
[0048] Specifically, the process of constructing the query intent path is as follows: receiving the natural language query statement input by the user and performing text preprocessing on it, including word segmentation, part-of-speech tagging, and dependency parsing.
[0049] Since user queries are typically colloquial, concise, and loosely grammatically structured, preprocessing of the user queries transforms the original text into a sequence of clearly structured and uniformly formatted language units.
[0050] Based on the results of dependency parsing, the core predicates in the statement and the argument structure they govern are identified, and semantic role classification of each argument is performed by combining semantic role annotation for the legal field.
[0051] Understandably, dependency parsing is the identification of grammatical dependencies between words in a sentence.
[0052] Specifically, the role of dependency parsing in constructing query intent paths includes: i) Identifying core predicates: Dependency parsing can locate the root node of a sentence. For example, in the sentence "The company has not paid its employees' wages", "payment" is identified as the core predicate, which is the starting point for legal judgment.
[0053] ii) Determine the argument structure: By analyzing the relationship between the predicate and its dependent components, such as subject, object, and adverbial, clarify the grammatical carriers of semantic roles such as "who did what, to whom, when and where".
[0054] This dependency parsing provides syntactic context constraints for subsequent semantic role labeling, avoiding ambiguity caused by relying solely on lexical matching.
[0055] In a specific example, a user queries: "The company has not paid its employees' wages, and the employees have applied for labor arbitration."
[0056] Dependency parsing results: Predicate 1: payment, whose dependent arguments include company (subject), employee (indirect object) and wages (direct object).
[0057] Predicate 2: Application, whose arguments include employees (subject) and labor arbitration (object).
[0058] Building on this, we introduce semantic role labeling for the legal field. This labeling mainly involves assigning a semantic role label to each argument associated with a predicate, such as agent, patient, object, result, etc.
[0059] Applying to the user query example above, in the argument structure dominated by predicate 1 payment: the semantic role of the company is labeled as the agent, representing the subject of the legal act.
[0060] The semantic role of the employee is labeled as the recipient, that is, the party who bears the consequences of legal acts.
[0061] Wages are labeled with the semantic role of "object," representing the specific rights or benefits or recipients of payment as indicated by the legal act.
[0062] In the argument structure dominated by predicate 2: the semantic role of the employee is labeled as agent.
[0063] Labor arbitration is tagged with the semantic role of legal procedure or remedy.
[0064] The semantic roles of the classification are treated as legal entities using a predicate-argument framework, and the extracted legal entities are used as path nodes.
[0065] By integrating the logical connection between dependency syntax relations and semantic roles, we deduce the semantic dependency relations between legal entities as path edges.
[0066] After semantic role classification, the roles do not exist in isolation, but rather form potential semantic connections through shared predicates and syntactic structures. Therefore, this invention further integrates dependency syntax relations with legal semantic role annotation results to deduce legally significant semantic dependencies between legal entities.
[0067] Specifically, the derivation process is based on the following logical rule: if two legal entities are respectively labeled as the agent and object of the same core predicate, and in the dependency syntax structure, the former is attached to the predicate in a subject-predicate relationship and the latter is attached to the predicate in a direct object relationship, then it can be inferred that the two constitute a legal behavior chain of subject-implementation-behavior-direction-object, thereby establishing specific semantic dependency relationships such as fulfilling payment obligations or committing tortious acts.
[0068] For example, if one entity is labeled as a cause and another entity is labeled as a result, and both are attached to the same resultative predicate through adverbial or complement structures, then a causal relationship can be inferred between them.
[0069] For example, when one legal entity is identified as the agent and another entity represents a legal procedure such as labor arbitration, filing a lawsuit, or applying for reconsideration, and the two entities constitute a dominant relationship syntactically through specific rights-protecting predicates such as application, filing, request, and claim, it can be inferred that there is a rights claim relationship between the two entities.
[0070] Continuing with the user query example above, "The company failed to pay its employees' wages, and the employees applied for labor arbitration."
[0071] In the semantic roles determined by predicate 1, the derived semantic dependency relationship is as follows: The semantic dependency relationship between the company and wages is: failure to fulfill the obligation to pay wages.
[0072] Basis: The company and the employee are marked as the agent and object of the same core predicate, and the former is attached to the predicate in a subject-verb relationship, while the latter is attached to the predicate in a direct object relationship.
[0073] The semantic dependency relationship between the company and its employees is: infringement of workers' compensation.
[0074] Basis: The agent acts upon the recipient, and the recipient's rights are harmed through inaction.
[0075] In the semantic roles determined by predicate 2, the derived semantic dependency relationship is as follows: The semantic dependency relationship between the employee and labor arbitration is: asserting rights.
[0076] Basis: The party initiated legal proceedings voluntarily.
[0077] Based on the semantic structure of the query statement, the extracted legal entities and semantic dependencies are combined to form a query intent path.
[0078] S3. Classify the case to which the query intent path belongs based on a predefined legal feature relation database. Each entry in the legal feature relation database defines a set of feature relations and the corresponding case category.
[0079] Considering that the semantic dependencies between nodes in the query intent path can effectively reflect the inherent structure of the legal facts involved, and that this structure is highly correlated with the case type, different types of cases often exhibit differentiated semantic dependencies, therefore, by matching the set of relationships in the query intent path with the characteristic relationship patterns of different case categories, automatic case classification of user queries can be achieved. Classification can narrow the search space of candidate cases in the early stages of case retrieval, limiting the matching scope to a subset of cases of the same type, thereby effectively improving retrieval efficiency and result relevance.
[0080] Therefore, it is necessary to construct a legal feature relationship database for different case categories.
[0081] Applying the above considerations, the legal feature relationship database is established as follows: legal experts define feature relationship sets corresponding to different case types based on legal knowledge and case precedent experience. Each feature relationship set contains the necessary relationship types that characterize the legal relationships in that type of case.
[0082] The feature relationship set is associated with the corresponding case category and stored to form a legal feature relationship database.
[0083] In the specific establishment of the legal characteristic relationship database, given the abstract and normative nature of legal relationships and their close coupling with substantive law provisions, its establishment requires legal experts with domain expertise to extract the necessary set of semantic relationships that can fully characterize the characteristics of each type of case based on the current legal and regulatory system. This set covers the legal relationships that must exist in the fact-finding of such cases.
[0084] In one example, the case categories include, but are not limited to, labor contract disputes, traffic accident liability disputes, and sales contract disputes.
[0085] The essential semantic relationships in labor contract disputes include employers failing to pay wages and employees applying for arbitration.
[0086] The essential semantic relationships in traffic accident liability disputes include the driver's act of causing a traffic accident and the personal / property damage caused by the act of causing the accident.
[0087] The essential semantic relationships in sales contract disputes include the buyer's failure to fulfill payment obligations and the seller's delivery not conforming to the agreement.
[0088] After establishing the legal feature relation database, the case classification of the query intent path is based on the predefined legal feature relation database as follows: extract all directed edges connecting adjacent nodes from the query intent path, and aggregate their semantic dependencies into a query relation set.
[0089] The query relationship set is matched with the case categories and feature relationship sets defined by each entry in the legal feature relationship database. When the query relationship set completely contains the feature relationship set of a certain case category, that is, the feature relationship set of that category is a subset of the query relationship set, it indicates that the legal facts represented by the user query meet the necessary semantic relationships of that type of case, and the query intent path is determined to belong to the case category of the corresponding entry.
[0090] It should be noted that the set of legal characteristic relationships represents the core legal relationships that a certain type of case must possess, that is, the minimum set of constitutive elements.
[0091] User queries may contain more details, and their set of relationships may be richer than the necessary features.
[0092] Therefore, as long as the query contains all the necessary relationships for that type of case, it should be classified as such, even if there is additional information.
[0093] S4. Based on the case category, retrieve similar cases from the case database to form a preliminary candidate case set.
[0094] Since the judgments in the case database have been clearly categorized in judicial practice and have case category tags, once the case category to which the user's query belongs is determined, cases of the same category can be retrieved from the case database accordingly.
[0095] S5. Verify the case fact path of each case in the primary candidate case set using a semantic similarity matching mechanism based on the node hierarchy. When a hierarchical match is successful, proceed to the next level of matching; when a hierarchical match fails, terminate the subsequent matching.
[0096] After matching case categories and selecting primary candidate cases based on the semantic dependencies in the query intent path, even though these cases belong to the same cause of action as the user query, the user query often contains specific elements such as subject identity, behavior mode or legal consequences, so the primary candidate set still needs to be refined semantically matched.
[0097] This fine-grained matching uses nodes, i.e. legal entities, in the query intent path as the basic comparison unit. The reason is that each node carries specific elements with substantial legal significance, such as the identity of the subject. If the legal entity in the candidate case is not semantically similar to the legal entity in the query, even if the two belong to the same case category, their factual basis may be different, resulting in the case being unsuitable and should be excluded.
[0098] See Figure 2 As shown, based on this, the specific process of the semantic similarity matching mechanism for node hierarchy order is as follows: according to the logical order of nodes in the semantic structure in the query intent path, each node is assigned a hierarchy number.
[0099] In one example, the logical order mentioned above could be subject-verb-object sequence, causal chain sequence, or the order in which legal elements are unfolded.
[0100] For each candidate case in the initial candidate case set, its corresponding case fact path is hierarchically divided according to the same logical principle.
[0101] It should be noted that when performing fine-grained node matching, the nodes in the query intent path and the case fact path are hierarchically numbered. The purpose is to ensure that semantic matching is carried out under the premise of structural alignment. Legal events are not simply a collection of entities, but an orderly process unfolding according to a specific logic. If this order is ignored, for example, by arbitrarily matching wages with companies or mismatching claims with accidents, it will lead to structural misjudgments. Even if all entities exist, the overall legal logic will be broken.
[0102] By hierarchically numbering nodes according to the logical order of semantic structure, such as first level: subject, second level: behavior, third level: object, and fourth level: result, it is equivalent to introducing structural constraints in the matching process, which can greatly avoid misjudgments caused by structural misalignment.
[0103] The system matches each node in the query intent path with nodes at the same level in the case fact path of each candidate case in the primary candidate case set, according to hierarchical order.
[0104] Calculate the semantic similarity between the current level node in the query intent path and the corresponding level node in the candidate case fact path.
[0105] In the above-mentioned scheme, the semantic similarity is calculated as follows: the node text in the query intent path and the node text at the corresponding level in the case fact path are judged to be literally consistent. If the two are literally consistent, the semantic similarity is assigned a value of 1.
[0106] If the two terms are not identical, then the two nodes are expanded with synonyms based on a legal thesaurus to generate their respective sets of synonyms.
[0107] The aforementioned legal terminology dictionaries are derived from judicial interpretations, national standards for legal terminology, or authoritative legal dictionaries.
[0108] Calculate the intersection and union of two sets of synonyms, and take the ratio of the intersection to the union as the semantic similarity.
[0109] This invention first performs a literal consistency check when calculating the semantic similarity of nodes at the same level. In the legal field, terms are highly standardized and unique. If the literal meanings are identical, it means the concepts are completely the same, and the semantic similarity should be the maximum value of 1. When the literal meanings are different, a legally-specific thesaurus is used for semantic expansion. In legal practice, there are legally equivalent expressions, and a general thesaurus may introduce incorrect equivalences in non-legal contexts. Then, the degree of semantic overlap is quantified using set operations after semantic expansion. The greater the number of synonyms shared in the set, the greater the semantic similarity.
[0110] When the semantic similarity reaches the preset matching threshold, the matching at that level is considered successful, and the matching proceeds to the next level.
[0111] Since semantic similarity is calculated based on the ratio of the intersection to the union of two sets of synonyms, and the value range is [0, 1], the matching threshold is usually set above the median of this range, for example, 0.7, which means that the two nodes are highly equivalent in the legal context.
[0112] When the semantic similarity does not reach the matching threshold, the matching at that level is deemed a failure, and subsequent matching of the candidate case is immediately terminated.
[0113] It is important to understand that in structured legal knowledge representation, nodes at each level usually constitute a logical progression or conditional dependency relationship. If the upper-level concepts no longer match, then no matter how similar the details at the lower level are, the overall legal characterization has undergone a fundamental divergence. Continuing to match subsequent levels is not only meaningless, but may also lead to erroneous analogies due to local similarities.
[0114] Record the matching progress of each candidate case, and only retain cases that pass all levels of matching as the final matching cases.
[0115] S6. For all cases that pass the full level matching, sort and output them according to the degree of matching of the level nodes.
[0116] The specific implementation process of the above steps is as follows: For the final matching case that passes all levels of matching, the overall matching score is obtained by calculating the average of the semantic similarity of the matching nodes at each level.
[0117] The overall matching score mentioned above quantifies the semantic fit between the case and the user query.
[0118] For each final matched case, the number of remaining nodes that were not matched after the matching was completed is counted, and the proportion of this number to the total number of nodes in the case's fact path is defined as the node coverage redundancy rate of that case.
[0119] The redundancy rate of the nodes mentioned above reflects whether the case contains additional factual elements that are beyond the scope of the query. The lower the value, the more the case facts correspond to the query intent; the higher the value, the more the case meets the query requirements, but contains a lot of irrelevant or redundant information.
[0120] Although the retained final matching cases achieve layer-by-layer semantic matching with the user's query intent in terms of hierarchical structure, the actual case paths often contain richer or more granular details, potentially including additional nodes beyond the query path. Failure to consider these nodes not covered by the query would lead to both scenarios being treated equally in the matching evaluation. Therefore, this invention introduces node coverage redundancy rate as an evaluation metric, effectively characterizing the degree of information redundancy of the cases relative to the query intent.
[0121] All final matching cases are sorted in descending order of overall matching score to obtain a semantic similarity priority ranking sequence. In this ranking, the smaller the number, the higher the degree of fit between the case and the user query in terms of intent and semantics.
[0122] All final matching cases are sorted in ascending order of node coverage redundancy rate to obtain a structural integrity priority sorting sequence. In this sorting, the smaller the number, the less redundant information the case has relative to the user query and the more concise and aligned the factual structure.
[0123] For the same final matching case, its index in the two sorting sequences above is added together to form a comprehensive ranking index. The smaller the comprehensive ranking index, the better the case performs in both semantic fit and structural alignment integrity.
[0124] All matching cases are sorted in ascending order according to the comprehensive ranking index, and the resulting sequence is used as the output result of the case query.
[0125] Example 2
[0126] See Figure 3 As shown, this invention proposes a legal search matching system, including the following modules: a path construction module, used to identify legal entities and extract semantic relationships from case texts stored in the case database, construct case fact paths, and extract legal entities and syntactic dependencies between entities from natural language query statements input by users, constructing query intent paths.
[0127] The case screening module, connected to the path construction module, is used to classify the query intent path into cases based on a predefined legal feature relationship database. According to the case classification, it retrieves cases of the same category from the case database to form a preliminary candidate case set. Each entry in the legal feature relationship database defines a feature relationship set and a corresponding case category.
[0128] The hierarchical matching module, connected to the case screening module, is used to perform hierarchical order matching verification on each case in the primary candidate case set. It includes a hierarchical numbering unit, a similarity calculation unit, and a matching control unit. The matching control unit immediately terminates the subsequent matching of the case if the matching fails at any level.
[0129] The unit structure of the aforementioned intermediate-level matching module is described in [reference needed]. Figure 4 As shown.
[0130] The results output module and the hierarchy matching module are used to sort and output all cases that have passed all hierarchy matching according to the degree of matching of hierarchy nodes.
[0131] Example 3
[0132] This invention proposes a storage medium on which a computer program is burned, which, when run in the memory of a server, implements the legal search and matching method described in this invention.
[0133] The above embodiments can be implemented, in whole or in part, by software, hardware, firmware, or any other combination thereof. When implemented using software, the above embodiments can be implemented, in whole or in part, in the form of a computer program product.
[0134] Those skilled in the art will recognize that the algorithmic steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.
[0135] In addition, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0136] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0137] Finally, the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A legal search and matching method, characterized in that, Includes the following steps: Legal entity identification and semantic relationship extraction are performed on the case texts stored in the case database. The case fact path is constructed with entities as nodes and semantic relationships as edges. Extract legal entities and their syntactic dependencies from the user's query, and construct a query intent path with legal entities as nodes and semantic dependencies as edges. Based on a predefined legal feature relation database, the query intent path is classified into cases to which it belongs. Each entry in the legal feature relation database defines a set of feature relations and a corresponding case category. Based on the case category, cases of the same type are retrieved from the case database to form a preliminary candidate case set; The case fact path of each case in the primary candidate case set is verified by a semantic similarity matching mechanism based on the node hierarchy. When the hierarchical matching is successful, the next level of matching is entered; when the hierarchical matching fails, the subsequent matching is terminated. For all cases that match across all levels, sort and output them according to the degree of matching at each level node; The output, arranged according to the matching degree of hierarchical nodes, is as follows: For the final matched case that passes all levels of matching, the overall matching score is obtained by averaging the semantic similarity of the matched nodes at each level. For each final matched case, the number of remaining nodes that were not matched after the matching was completed is counted, and the proportion of this number to the total number of nodes in the case fact path is defined as the node coverage redundancy rate of the case. All final matching cases are sorted in descending order of overall matching score to obtain a semantic similarity priority ranking sequence; Arrange all final matching cases in ascending order of node coverage redundancy rate to obtain a priority sequence for structural integrity. For the same final matching case, its index in the two sorting sequences above is added together to form a comprehensive ranking index; All matching cases are sorted in ascending order according to the comprehensive ranking index, and the resulting sequence is used as the output result of the case query. The specific implementation process of verifying the case fact path of each case in the primary candidate case set using a node-level semantic similarity matching mechanism is as follows: Based on the logical order of nodes in the semantic structure in the query intent path, each node is assigned a hierarchical number; For each candidate case in the initial candidate case set, its corresponding case fact path is hierarchically divided according to the same logical principle; The nodes in the query intent path are matched with the nodes at the same level in the case fact path of each candidate case in the primary candidate case set, according to the hierarchical order. Calculate the semantic similarity between the current level node in the query intent path and the corresponding level node in the candidate case fact path; When the semantic similarity reaches the preset matching threshold, the matching at this level is considered successful, and the matching proceeds to the next level. When the semantic similarity does not reach the matching threshold, the matching at that level is determined to be a failure, and the subsequent matching of the candidate case is immediately terminated. Record the matching progress of each candidate case, and only retain cases that pass all levels of matching as the final matching cases.
2. The legal search and matching method as described in claim 1, characterized in that: The process of constructing the factual path of the case is as follows: The full text of each case is read from the case database, and a legal domain named entity recognition model is used to identify legal entities in the text. The legal entities include legal subjects, legal acts, legal objects, and legal results. A legal semantic relation extraction model is used to extract semantic relations between legal entities, including procuratorial relations, implementation relations, violation relations, and causal relations. Using the identified legal entities as nodes and the semantic relationships between them as directed edges, the case facts are connected in the logical order of the case facts to form a case fact path; Assign a unique identifier to each case fact path and store it in association with the corresponding case.
3. The legal search and matching method as described in claim 1, characterized in that: The process of constructing the query intent path is as follows: It receives natural language query statements input by users and performs text preprocessing on them, including word segmentation, part-of-speech tagging, and dependency parsing. Based on the results of dependency parsing, the core predicates in the statement and the argument structure they govern are identified, and semantic role classification of each argument is performed in combination with semantic role annotation for the legal field. The semantic roles of the classification are treated as legal entities using a predicate-argument framework, and the extracted legal entities are used as path nodes. By integrating the logical connection between dependency syntax relations and semantic roles, the semantic dependency relations between legal entities are deduced as path edges; Based on the semantic structure of the query statement, the extracted legal entities and semantic dependencies are combined to form a query intent path.
4. The legal search and matching method as described in claim 1, characterized in that: The legal feature relation database is established as follows: Legal experts define sets of characteristic relationships corresponding to different types of cases based on legal knowledge and case precedent experience. Each set of characteristic relationships contains the necessary relationship types that characterize the legal relationships in that type of case. The feature relationship set is associated with the corresponding case category and stored to form a legal feature relationship database.
5. The legal search and matching method as described in claim 1, characterized in that: The case classification based on the predefined legal feature relational database for the query intent path is as follows: Extract all directed edges connecting adjacent nodes from the query intent path, and aggregate their semantic dependencies into a query relation set; The query relationship set is matched with the case categories and feature relationship sets defined by each entry in the legal feature relationship database to determine subset matching. When the query relationship set completely contains the feature relationship set of a certain case category, it is determined that the query intent path belongs to the case category of the corresponding entry.
6. The legal search and matching method as described in claim 1, characterized in that: The semantic similarity calculation process is as follows: The semantic similarity is determined by comparing the literal similarity of the node text in the query intent path with the corresponding level of the node text in the case fact path. If the two are literally identical, the semantic similarity is assigned a value of 1. If the two terms are not identical, then based on a legal thesaurus, the two nodes' texts are extended with synonyms to generate their respective sets of synonyms. Calculate the intersection and union of two sets of synonyms, and take the ratio of the intersection to the union as the semantic similarity.
7. A legal search matching system for performing the steps of the legal search matching method as described in any one of claims 1-6, characterized in that, Includes the following modules: The path construction module is used to identify legal entities and extract semantic relationships from the case texts stored in the case library, construct the case fact path, and extract legal entities and syntactic dependencies between entities from the natural language query statements entered by users, and construct the query intent path. The case screening module is used to classify the case to which the query intent path belongs based on a predefined legal feature relationship database. According to the case to which the case belongs, it retrieves cases of the same category from the case database to form a preliminary candidate case set. Each entry in the legal feature relationship database defines a feature relationship set and a corresponding case category. The hierarchical matching module is used to perform hierarchical order matching verification for each case in the primary candidate case set. It includes a hierarchical numbering unit, a similarity calculation unit, and a matching control unit. The matching control unit immediately terminates the subsequent matching of the case if the matching fails at any level. The results output module is used to sort and output all cases that have passed all levels of matching according to the degree of matching of the level nodes.
8. A storage medium, characterized in that: The storage medium is programmed with a computer program, which, when run in the server's memory, implements the method described in any one of claims 1-6.
Citation Information
Patent Citations
Semantic search method and device based on legal knowledge graph and electronic equipment
CN112632226A
Semantic search method, device and medium based on legal knowledge graph
CN119311845B
Building electromechanical BIM model information rapid retrieval method and system
CN120372035A
Consultation method and system based on natural language processing and legal knowledge graph
CN121117239A