Method and system for identifying charges by fusing a rules engine and a knowledge graph
By integrating rule engines and knowledge graphs, a trigger word matcher and a legal knowledge graph are constructed, solving the problems of interpretability and accuracy in crime identification in existing technologies, and realizing an efficient and transparent crime identification and legal reasoning process.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI KANBAO TECH CO LTD
- Filing Date
- 2026-01-27
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies for crime identification suffer from poor interpretability, reliance on large amounts of labeled data, information gaps, and ambiguous matching, making it difficult to effectively extract legal interpretation information and thus limiting the accuracy and practicality of identification.
The method of integrating rule engines and knowledge graphs constructs a crime recognition rule engine that combines trigger word matchers, regular expression patterns, and logical judgment functions. It then uses a legal knowledge graph to perform multi-level hybrid retrieval, generating an interpretable legal reasoning process.
It improves the accuracy and transparency of crime identification, supports adaptive system updates, has strong scalability, can handle complex and novel cases, and enhances generalization ability and interpretability.
Smart Images

Figure CN121615637B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of legal data processing technology, specifically to a method and system for crime identification that integrates rule engines and knowledge graphs. Background Technology
[0002] With the rapid development of artificial intelligence technology, its application in the judicial field is constantly deepening, especially in processing and understanding legal texts, where it has shown significant potential. Criminal judgments, as official records of cases heard by judicial organs, not only document the facts, evidence, and judgment results, but also embody rich legal expertise and judicial logic, making them an important resource for legal analysis and knowledge mining. Against this backdrop, accurately identifying criminal charges and effectively retrieving key information related to those charges based on judgments has become a core component of intelligent legal consultation and decision support, holding significant practical importance for improving judicial efficiency, unifying judgment standards, and promoting judicial transparency.
[0003] However, the current mainstream technical approaches applied to crime identification all have limitations. For example, pure machine learning methods often lack interpretability and rely heavily on a large amount of labeled data, making it difficult to incorporate professional knowledge in the legal field. Rule-based methods are limited by information gaps and ambiguous matching, making them prone to misjudgments and lacking transparency in interpretation. Knowledge graph methods also face many challenges in ontology construction, information extraction, and retrieval accuracy, especially in effectively extracting legal interpretation information from documents, which limits their practicality.
[0004] For example, patent CN113065005A discloses a method for recommending legal provisions based on knowledge graphs and text classification models. The steps include: constructing a legal knowledge graph, preprocessing training text data, training a multi-label classification model, identifying legal crime elements, and recommending legal provisions. This invention uses a knowledge graph to store legal knowledge, which can display the relationships between crimes at various levels in detail, while also quickly responding to query results and facilitating knowledge expansion and updates. It employs TextCNN for multi-label text classification, using crimes as classification labels, thus solving the problem of a non-one-to-one correspondence between crimes and legal provisions. To address the diverse combinations of legal crime information, the corpus can be continuously supplemented for iteration, expanding the breadth of legal provision recommendations. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to address the shortcomings of the existing technology by providing a method and system for crime identification that integrates rule engine and knowledge graph.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0007] The crime identification method that integrates rule engines and knowledge graphs includes the following steps:
[0008] Step S1: Extract the facts of the case and the charges from the criminal judgment documents, and format the extracted results into structured data containing the fields of facts of the case and charges;
[0009] Step S2: Construct a crime recognition rule engine based on trigger word matcher, regular expression pattern and logical judgment function;
[0010] Step S3: Construct a legal knowledge graph containing a structured representation of the elements of a crime, and construct a thesaurus of synonyms and near-synonyms, wherein the elements of a crime include a logical representation of the object of the crime, the subject of the crime, the subjective aspect of the crime, and the objective aspect of the crime;
[0011] Step S4: The crime identification rule engine is used to preliminarily determine the crime from the input case fact text and extract the target entity;
[0012] Step S5: Perform multi-level hybrid retrieval on the legal knowledge graph based on the target entity, wherein the hybrid retrieval includes vector similarity retrieval, graph structure retrieval and relevance filtering;
[0013] Step S6: Integrate the output of the crime identification rule engine and the retrieval results of the legal knowledge graph to generate the final crime identification result and an interpretable legal reasoning process.
[0014] Furthermore, in step S2, the trigger word matcher constructs a multi-level trigger word library for specific crimes, including criminal behavior verbs, result state words, subjective intent words, and legal element keywords, and uses a matching degree calculation based on word frequency-inverse document frequency weighting; the regular expression pattern library designs multi-level regular expression patterns for each crime, including basic behavior patterns, specific scenario patterns, and behavior result combination patterns; the logical judgment function is based on the criminal law crime constitution theory, and designs an if-else logical judgment function for each crime, simulating the syllogistic reasoning process of legal experts, including element check, exclusion situation judgment, and comprehensive decision.
[0015] Furthermore, in step S3, constructing a legal knowledge graph containing a structured representation of the elements constituting a crime specifically includes the following steps:
[0016] The elements of a crime are transformed into structured logical knowledge nodes. The object of the crime uses truth value identifiers to dynamically organize the relationship of infringement of legal interests. The subject of the crime is distinguished between crimes committed by natural persons and crimes committed by entities. The subjective aspect of the crime is distinguished between intentional crimes and negligent crimes. The objective aspect of the crime is described using a two-layer logic tree structure.
[0017] The large language model is used to extract entities, entity types, entity explanations, and relationships between entities from the text, with a preset priority for extracting core entities;
[0018] A graph structure is constructed by merging entities and relationships, and a vector representation is generated and stored in a vector database.
[0019] Further, in step S3, constructing the synonym / near-synonym list includes:
[0020] Based on entity vector representation, a clustering algorithm is used to divide entities with similar meanings into synonym groups;
[0021] The clustering results are manually verified and calibrated to create a mapping table of standard terms and synonyms.
[0022] Furthermore, in step S4, the preliminary determination of the crime through the crime recognition rule engine specifically includes the following steps:
[0023] The input case fact text is matched with the crime rules in the rule base;
[0024] The confidence score of each candidate crime is calculated based on the matching results. The calculation of the confidence score takes into account the matching degree of the trigger word, the matching degree of the regular expression, and the satisfaction degree of the logical rule.
[0025] Charges with a confidence level higher than the threshold and their corresponding core legal elements are identified as preliminary charges and target entities.
[0026] Furthermore, in step S5, the vector similarity retrieval converts the target entity and its context into vectors, and retrieves semantically similar entities and text fragments in the vector space of the knowledge graph, outputting vector retrieval results;
[0027] The graph structure retrieval starts with the target entity and uses a graph traversal algorithm in the legal knowledge graph to discover related entities, relationships and paths, and outputs graph structure retrieval results.
[0028] The relevance filtering utilizes a natural language processing model to determine and filter the retrieved candidate information based on its relevance to the current case, and outputs the filtered relevant legal knowledge information.
[0029] Step S6.1: Perform weighted fusion of the preliminary charges output by the rule engine and the legal interpretations and related case information retrieved from the knowledge graph, and output the fused scores for each charge;
[0030] Step S6.2: Based on the fused information, calculate the confidence level of the final crime and output the final crime and its confidence level;
[0031] Step S6.3: Generate a text containing the conclusion of the crime determination and the legal reasoning process based on the analysis of the elements of the crime, according to the confidence level of the final charge.
[0032] Furthermore, the objective aspect of the crime adopts a two-layer logic tree structure, specifically including: the root node represents the overall conditions for the establishment of the objective aspect of the crime; the first-layer nodes represent different types of behavior, connected by logical operators; the second-layer nodes represent specific behavioral characteristics and constraints; wherein each node contains a unique identifier, description, logical constraints, and original text.
[0033] A crime recognition system integrating rule engines and knowledge graphs, used to implement any of the crime recognition methods integrating rule engines and knowledge graphs, including:
[0034] The data preprocessing and storage module is used to extract structured data from the raw data source;
[0035] The rules engine building block is used to create and maintain a rule base for crime recognition.
[0036] The knowledge graph construction module is used to construct legal knowledge graphs from judgment documents, including structured representations of the elements constituting a crime;
[0037] The thesaurus building module is used to create a mapping of thesaurus terms for legal terms;
[0038] The hybrid retrieval module is used to perform multi-level information retrieval, including vector similarity retrieval, graph structure retrieval, and relevance filtering;
[0039] The results fusion module is used to integrate the output of the rule engine and the retrieval results of the knowledge graph to generate the final crime identification result;
[0040] The explanation generation module is used to generate detailed explanations of crime identification, including legal reasoning processes.
[0041] Furthermore, the knowledge graph construction module includes:
[0042] The text preprocessing unit is used to clean and segment judgment documents;
[0043] The entity-relationship extraction unit uses a large language model to extract entities and relationships, and prioritizes the extraction of core entities.
[0044] Graph construction units are used to construct graph structures and vector representations;
[0045] Logical knowledge node construction unit, used to transform the constituent elements of a crime into a structured representation.
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows:
[0047] 1. This invention combines rule-based reasoning with semantic association-based retrieval. The rule engine can accurately match legal requirements, while the knowledge graph can understand complex semantics and contextual relationships. After the two are integrated, the rule engine's initial screening ensures the accuracy of the baseline, while the case and explanation support provided by the knowledge graph can effectively handle complex and novel cases that are not covered by the rules or are ambiguous, overcoming the limitations of a single method.
[0048] 2. This invention not only outputs the crime result, but also automatically generates a legal reasoning process based on the elements of a crime. This reasoning process clearly demonstrates the specific evidence of rule matching and the legal support provided by the knowledge graph, making the model's decision-making transparent.
[0049] 3. This invention constructs a structured legal knowledge graph, transforming the elements of a crime in criminal law theory into machine-understandable and computational knowledge nodes. The logical judgment function in the rule engine directly simulates the syllogistic reasoning of legal experts, enabling the system to identify and connect the logical elements required for conviction from the facts of the case.
[0050] 4. The system architecture of this invention supports modular updates. As new judicial interpretations are issued or new criminal precedents accumulate, only the knowledge graph and the thesaurus need to be updated. There is no need to train a complex model from scratch. At the same time, the rule weight parameters can be optimized and adjusted through historical data, so that the system can adapt to the judgment focus of different types of crimes and has good scalability.
[0051] 5. By constructing and applying a thesaurus of synonyms and near-synonyms, this invention can automatically map diverse colloquial and variant expressions in the description of case facts to standard legal concepts, ensuring the recall rate of rule matching and semantic retrieval; at the same time, combined with vector similarity retrieval, it can capture information that is different in wording but highly related in meaning, effectively solving the problem of expression complexity that is common in legal texts and improving the system's generalization ability in practical applications. Attached Figure Description
[0052] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings:
[0053] Figure 1 This is a flowchart illustrating an embodiment of the present invention;
[0054] Figure 2 This is a system schematic diagram according to an embodiment of the present invention;
[0055] Figure 3 This is a data processing flowchart of an embodiment of the present invention;
[0056] Figure 4 This is a flowchart illustrating the knowledge graph construction process in an embodiment of the present invention. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] like Figure 1 As shown, the crime identification method that integrates rule engines and knowledge graphs includes the following steps:
[0059] Step S1: Extract the facts of the case and the charges from the criminal judgment documents, and format the extracted results into structured data containing the fields of facts of the case and charges;
[0060] Step S2: Construct a crime recognition rule engine based on trigger word matcher, regular expression pattern and logical judgment function;
[0061] Step S3: Construct a legal knowledge graph containing a structured representation of the elements of a crime, and construct a thesaurus of synonyms and near-synonyms, wherein the elements of a crime include a logical representation of the object of the crime, the subject of the crime, the subjective aspect of the crime, and the objective aspect of the crime;
[0062] Step S4: The crime identification rule engine is used to preliminarily determine the crime from the input case fact text and extract the target entity;
[0063] Step S5: Perform multi-level hybrid retrieval on the legal knowledge graph based on the target entity, wherein the hybrid retrieval includes vector similarity retrieval, graph structure retrieval and relevance filtering;
[0064] Step S6: Integrate the output of the crime identification rule engine and the retrieval results of the legal knowledge graph to generate the final crime identification result and an interpretable legal reasoning process.
[0065] The target entities are extracted from the case fact text using named entity recognition technology. The extracted entity types include people, objects, locations, times, and behaviors. These entities are then associated with key elements in the crime-related rules matched by the rule engine, such as:
[0066] Actual perpetrators: criminal suspects, accomplices;
[0067] Actual behavior: specific acts such as theft, robbery, and assault;
[0068] Objects include: property, person, documents, etc.
[0069] Tool entities: cutting tools, vehicles, computers, etc.;
[0070] Physical locations: public places, residences, banks, etc.;
[0071] Time-related entities: time of the incident, duration, etc.
[0072] In step S2, the trigger word matcher constructs a multi-level trigger word library for specific crimes, including criminal behavior verbs, result state words, subjective intent words, and legal element keywords, and uses a matching degree calculation based on word frequency-inverse document frequency weighting; the regular expression pattern library designs multi-level regular expression patterns for each crime, including basic behavior patterns, specific scenario patterns, and behavior result combination patterns; the logical judgment function is based on the criminal law crime constitution theory, and designs an if-else logical judgment function for each crime, simulating the syllogistic reasoning process of legal experts, including element check, exclusion situation judgment, and comprehensive decision.
[0073] The formula for calculating the trigger word match degree by the trigger word matcher is as follows:
[0074]
[0075] in, This indicates the degree of match between the trigger words and the charge c. This represents a multi-level trigger word list for crime c. Indicates the trigger term, This indicates the input text containing the facts of the case. Indicates terms In the text TF-IDF weights in Indicates an indicator function, when The value is 1 if it is true, and 0 otherwise. This represents the coverage adjustment parameter, with a value ranging from 1.0 to 2.0. This indicates the number of trigger words matched by crime 'c'. Indicates the total number of words in the trigger word list;
[0076] In this context, the TF-IDF weight is the product of the term frequency and the inverse document frequency, i.e., the term weight. The product of the number of times the term appears in the case fact text D divided by the total number of words in D and log((total number of documents N) / (number of documents containing term wt + 1));
[0077] The trigger term library is composed of high-frequency and distinctive terms extracted from a large number of factual descriptions in documents labeled with a certain crime. Taking "theft" as an example, it specifically includes:
[0078] Verbs for criminal acts: steal, burglary, pickpocketing, burglary;
[0079] Result status terms: lost, damaged, stolen, robbed;
[0080] Subjective intent: illegal possession, appropriation;
[0081] Key legal elements: public or private property, substantial amount, repeated theft.
[0082] The specific formula for calculating the regular expression matching degree using the regular expression pattern library is as follows:
[0083]
[0084] in, The degree of regular expression matching for crime 'c'. The set of regular expression patterns representing crime c. Represents a single regular expression pattern. This represents the weight of pattern p, which is set according to the importance of the pattern. For example, the weight of a basic behavior pattern is 1.0, the weight of a specific scenario pattern is 1.5, and the weight of a behavior-result combination pattern is 2.0. This indicates the degree of matching of pattern p in text D. This represents the consistency penalty coefficient, typically set between 0.5 and 1. This represents the average matching score across all patterns. The number of patterns in the set of regular expression patterns for crime c;
[0085] The formula for calculating the matching degree of pattern p in text D is:
[0086]
[0087] in, This indicates the length of the matched text. Indicates the length of the original text. Indicates the number of matches;
[0088] The specific formula for calculating the logical rule satisfaction degree of a logical judgment function is as follows:
[0089]
[0090] in, This indicates the degree to which the logical rules for crime c are satisfied. The number of logical rules representing crime c. This represents the r-th logical rule. The importance weight of rule r is determined through expert experience. For example, 3-5 criminal law experts are invited to score the importance of each logical rule for each crime (such as "whether the perpetrator has criminal responsibility" and "whether there is an intent to illegally possess"). Then, the scores from all experts are averaged and normalized. This indicates the degree to which rule r is satisfied in text D. This indicates that the rule meets the threshold, which is usually set to 0.7. This represents the radix adjustment parameter, which is usually set to 0.05 to avoid the denominator being zero. This indicates an indicator function, which is 1 when the rule satisfaction is greater than the threshold, and 0 otherwise.
[0091] Among them, satisfaction It is a value between 0 and 1. Rule r may consist of several sub-conditions, such as "intent to illegally possess" which may include keywords such as "squandering", "absconding", and "inability to repay". That is, the proportion of these sub-conditions that are satisfied in text D.
[0092] In step S3, constructing a legal knowledge graph containing a structured representation of the elements constituting a crime specifically includes the following steps:
[0093] The elements of a crime are transformed into structured logical knowledge nodes. The object of the crime uses truth value identifiers to dynamically organize the relationship of infringement of legal interests. The subject of the crime is distinguished between crimes committed by natural persons and crimes committed by entities. The subjective aspect of the crime is distinguished between intentional crimes and negligent crimes. The objective aspect of the crime is described using a two-layer logic tree structure.
[0094] The large language model is used to extract entities, entity types, entity explanations, and relationships between entities from the text, with a preset priority for extracting core entities;
[0095] A graph structure is constructed by merging entities and relationships, and a vector representation is generated and stored in a vector database.
[0096] The knowledge graph comprises two parts: a structured representation of the elements of a crime, manually constructed from legal provisions, and an entity relationship graph extracted from judgment documents. The two are connected through crime-related nodes and element-related nodes. For example, the theft node connects to the various nodes representing its elements, and the theft node also connects to specific case entities.
[0097] In step S3, constructing the synonym / near-synonym list includes:
[0098] Based on entity vector representation, a clustering algorithm is used to group entities with similar meanings into synonym groups. This clustering algorithm uses a comprehensive similarity metric based on semantic and structural similarity, with the specific formula as follows:
[0099]
[0100] in, Representing entities and The overall similarity score has a range of [0, 1], with larger values indicating greater similarity. entity and The vector representation of , Represents the square of the Euclidean distance. This represents the semantic bandwidth parameter, which is typically taken as 1 / 2 to 1 / 3 of the median distance between all entity pairs. and Representing entities and In a knowledge graph, a set of relationships are associated, such as the entity "theft" being associated with relationships like "behavior: stealing" and "object: property". This represents a smoothing parameter to prevent the denominator from being zero; it is usually taken as a very small positive number, such as 0.01. This represents the structural weight parameter, which controls the influence of structural similarity on overall similarity. Setting it to greater than 1 enhances the weight of structural information; setting it to less than 1 weakens it.
[0101] The clustering results are manually verified and calibrated to create a mapping table of standard terms and synonyms.
[0102] When the trigger word "steal" is actually matched, it will also match synonyms such as "steal", "rob", and "borrow".
[0103] Clustering algorithms are used to group entities with similar meanings into synonym groups. The specific steps include:
[0104] 1. Treat each entity as an independent cluster;
[0105] 2. Calculate the overall similarity between all cluster pairs, find the pair with the highest overall similarity, and merge them into a new cluster if their overall similarity is greater than a preset threshold;
[0106] 3. Clustering stops when the overall similarity between no cluster pairs is greater than the threshold of 0.8.
[0107] After clustering is completed, experts will check whether entities within the same cluster actually belong to the same legal concept, such as "theft," "stealing," or "borrowing." They will remove entities that have been mistakenly included and merge entities that have been incorrectly segmented, ultimately forming a mapping table of "standard terms - synonyms."
[0108] In step S4, the preliminary determination of the crime through the crime recognition rule engine specifically includes the following steps:
[0109] The input case fact text is matched with the crime rules in the rule base;
[0110] The confidence score for each candidate crime is calculated based on the matching results. The calculation of the confidence score comprehensively considers the trigger word matching degree, the regular expression matching degree, and the logical rule satisfaction degree. The specific formula is as follows:
[0111]
[0112] in, This indicates the crime given by the rules engine. Preliminary confidence score, , and These represent the trigger word matching degree, the regular expression matching degree, and the logical rule satisfaction degree, respectively. , and These represent the power-weight parameters for the three components, used to non-linearly adjust the importance of each component. If the trigger word matching degree is considered more important, these parameters can be set... =1.2, =1.0, =1.0, This represents the consistency penalty coefficient, typically set to 0.3 to 0.5, used to control the severity of the penalty. The standard deviation of the three components is expressed by the following formula:
[0113]
[0114] in, This represents the arithmetic mean of the three matching degrees;
[0115] Charges with a confidence level higher than the threshold and their corresponding core legal elements are identified as preliminary charges and target entities.
[0116] In step S5, the vector similarity retrieval converts the target entity and its context into vectors, and retrieves semantically similar entities and text fragments in the vector space of the knowledge graph. The specific formula is as follows:
[0117]
[0118] in, This represents the vector similarity score between query Q and document D. and These represent the number of terms in query Q and document D, respectively. Attention weights represent the degree of attention paid to document term y by query term x, and the specific formula is as follows:
[0119]
[0120] in, This represents the vector representation of the x-th word in query Q. Let y be the vector representation of the y-th word in document D. This represents the temperature parameter, used to control the sharpness of attention distribution. As a hyperparameter, it is tuned in retrieval quality assessment, and its initial value can be set to 1.
[0121] When searching for "robbery", the search term will be expanded to "robbery OR snatching OR hijacking".
[0122] The graph structure retrieval starts with the target entity and discovers related entities, relationships and paths in the legal knowledge graph through graph traversal algorithms. The graph structure retrieval can use breadth-first search or depth-first search algorithms, set a certain search depth, such as 3 layers, start with the target entity, traverse adjacent nodes and edges in the knowledge graph, and collect relevant information.
[0123] The relevance filtering utilizes a natural language processing model to determine and filter the relevance of retrieved candidate information to the current case. The pre-trained language model BERT is used to calculate the semantic relevance between the retrieved candidate information and the facts of the current case, and information with a relevance lower than a threshold, such as 0.6, is filtered out.
[0124] First, using vector similarity retrieval, entities and text fragments that are semantically similar to the target entity and its context are retrieved from the vector database of the knowledge graph as preliminary results;
[0125] Then, starting with the entities in these preliminary results, we traverse the graph structure to expand the related entities and relational paths.
[0126] Finally, the expanded results are filtered using the BERT model to retain information that is highly relevant to the current case.
[0127] Step S6 specifically includes the following steps:
[0128] Step S6.1: The preliminary charges output by the rule engine are weighted and fused with the legal interpretations and related case information retrieved from the knowledge graph. The fused score for each charge is then output using the following formula:
[0129]
[0130] in, This represents the combined score of crime c. This indicates the crime given by the rules engine. The initial confidence score, i.e. , This represents the support level of the knowledge graph for crime c. and This represents a parameter indicating the reliability of the evidence source. If the rule engine has an accuracy rate of 90% on historical data and the knowledge graph has an accuracy rate of 85%, then... Set it to 0.9. Set it to 0.85. This represents the conflict adjustment parameter, which is typically set to 0.2 to 0.4.
[0131] The calculation of the support of the knowledge graph for crime c specifically includes the following steps:
[0132] A set of relevant information is obtained by retrieving the target entity from the knowledge graph;
[0133] For each piece of information, calculate its relevance score to the current case, as well as the semantic relevance of the information to charge c;
[0134] Finally, the support level is calculated using a weighted average formula.
[0135] The specific formula for the support degree of the knowledge graph for crime c is as follows:
[0136]
[0137] in, This represents the relevance score between the i-th search result and the case. Indicates the number of search results. This represents the semantic similarity between the entity in the k-th result and the crime c;
[0138] Step S6.2: Based on the fused information, calculate the confidence level of the final charge and output the final charge and its confidence level. The specific formula is as follows:
[0139]
[0140] in, This indicates the confidence level of the final conviction for charge c. Indicates by The ranking from highest to lowest, i.e., number 1 is 1. This represents the total number of candidate crimes, where n represents the nth crime. This indicates the ranking reward weight, controlling the adjustment range of ranking information, and is usually set to 0.1 to 0.3. This represents the scaling parameter, which controls the degree of difference in scores; it is usually set to 1.0.
[0141] Step S6.3: Generate a legal reasoning process text containing the conclusion of the crime determination and the analysis of the elements of the crime based on the confidence level of the final crime, including: filling the case facts, matching rules, retrieved knowledge and other information into a preset template to form a reasoning process; at the same time, the text can also be generated by using a large language model based on structured reasoning elements.
[0142] The objective aspects of the crime adopt a two-level logical tree structure, specifically including: the root node represents the overall conditions for the establishment of the objective aspects of the crime; the first-level nodes represent different types of behavior, connected by logical operators; the second-level nodes represent specific behavioral characteristics and constraints; each node contains a unique identifier, description, logical constraints, and original text.
[0143] For example, the root node could be "the objective aspect of theft", the first-level nodes include "secret theft" and "transfer of property", and the second-level nodes are a further refinement of the first-level nodes.
[0144] like Figure 2 As shown, a crime recognition system integrating a rule engine and a knowledge graph is used to implement any of the crime recognition methods integrating a rule engine and a knowledge graph, including:
[0145] The data preprocessing and storage module is used to extract structured data from the raw data source;
[0146] The rules engine building block is used to create and maintain a rule base for crime recognition.
[0147] The knowledge graph construction module is used to construct legal knowledge graphs from judgment documents, including structured representations of the elements constituting a crime;
[0148] The thesaurus building module is used to create a mapping of thesaurus terms for legal terms;
[0149] The hybrid retrieval module is used to perform multi-level information retrieval, including vector similarity retrieval, graph structure retrieval, and relevance filtering;
[0150] The results fusion module is used to integrate the output of the rule engine and the retrieval results of the knowledge graph to generate the final crime identification result;
[0151] The explanation generation module is used to generate detailed explanations of crime identification, including legal reasoning processes.
[0152] The knowledge graph construction module includes:
[0153] The text preprocessing unit is used to clean and segment judgment documents;
[0154] The entity-relationship extraction unit uses a large language model to extract entities and relationships, and prioritizes the extraction of core entities.
[0155] Graph construction units are used to construct graph structures and vector representations;
[0156] Logical knowledge node construction unit, used to transform the constituent elements of a crime into a structured representation.
[0157] The entire system's workflow consists of two phases: offline building and online inference. The offline building phase specifically includes:
[0158] The data preprocessing and storage module extracts structured data from the original data source and stores it in the database;
[0159] The rules engine building module uses this structured data to build and optimize the rule base, either manually or automatically.
[0160] The knowledge graph construction module also utilizes structured data, extracts entities and relationships through a large language model, constructs a legal knowledge graph, and generates vector representations stored in a vector database;
[0161] The synonym and near-synonym list construction module constructs a synonym and near-synonym list based on entity vectors in the knowledge graph through clustering and manual calibration.
[0162] The online reasoning phase, i.e., the crime identification process, specifically includes:
[0163] Users input the case facts and access the system through the user interface;
[0164] The rule matching execution unit in the rule engine building module performs rule matching on the input text, calculates the trigger word matching degree, regular expression matching degree, and logical rule satisfaction degree, and then calculates the preliminary confidence score for each crime and extracts the target entity. The preliminary crime and target entity are then passed to the hybrid retrieval module.
[0165] The hybrid retrieval module starts with the target entity and performs multi-level hybrid retrieval (vector similarity retrieval, graph structure retrieval) in the knowledge graph. Then, it obtains knowledge fragments related to the case through relevance filtering and passes the retrieval results to the result fusion module.
[0166] The result fusion module receives the preliminary crime confidence scores from the rule engine and the knowledge graph retrieval results, calculates the support of the knowledge graph for each crime, performs weighted fusion to obtain the fused score for each crime, calculates the final confidence score, and then passes the final crime and confidence score to the interpretation generation module.
[0167] The explanation generation module generates an interpretable legal reasoning process text based on the matching details of the rule engine, the retrieval results of the knowledge graph, and the final charge, and displays it to the user through the user interface module.
[0168] like Figure 3As shown, the complete data processing flow of the system from input to final output is described: the input stage includes the input of case fact text; the parallel processing stage includes: the rule engine module performs rule matching on the text, generates preliminary charges and extracts target entities; the hybrid retrieval module performs multi-level retrieval in the knowledge graph based on the target entities; the fusion decision stage includes the result fusion module integrating the rule engine output and the knowledge graph retrieval results; and the output stage includes the interpretation generation module generating the final charge identification result and an interpretable legal reasoning process.
[0169] like Figure 4 The diagram illustrates the process of constructing a knowledge graph from raw data into structured knowledge, specifically including:
[0170] Data preparation: Starting with textual data such as judgment documents, text preprocessing is performed;
[0171] Information extraction: Entities and relationships are extracted using a large language model;
[0172] Graph construction: Constructing graph structures and generating vector representations;
[0173] Knowledge organization: Transforming the elements of a crime into a structured representation;
[0174] Optimization and improvement: Construct a list of synonyms and near-synonyms to form a complete legal knowledge graph.
[0175] As shown in Table 1, the number of dataset entries containing the following labels in the test is:
[0176] Table 1:
[0177]
[0178] Table 2 shows the error rates corresponding to each crime procedure and tag obtained through the rule engine:
[0179] Table 2:
[0180]
[0181] It can be seen that, under the influence of the rule engine, within a given corpus, if a label for a certain crime is present, then the corresponding rule engine can definitely identify it. The rule engine may identify a wider range of crimes, but this can be further addressed using knowledge graphs.
[0182] Taking the crime of dangerous driving as an example, the specific pseudocode is as follows:
[0183] If "equal responsibility" is used in the text:
[0184] if any(exclude keywords in text for exclude keywords in ["full responsibility", "main responsibility", ...]):
[0185] pass
[0186] else:
[0187] If the number of deaths is greater than or equal to 3:
[0188] return True
[0189] else:
[0190] return False
[0191] else:
[0192] pass
[0193] List of driving-related vocabulary words = ['driving', 'driving a car', 'driving', 'driving', ...]
[0194] For vocabulary related to driving: List of related vocabulary words:
[0195] if vocabulary in text:
[0196] Driving-related = True
[0197] break
[0198] If not, whether driving is involved:
[0199] return False
[0200] else:
[0201] Dangerous driving keyword list = [...]
[0202] For keywords in the list of keywords related to dangerous driving:
[0203] if keywords in text:
[0204] Dangerous driving determination = True
[0205] break
[0206] If not, dangerous driving assessment:
[0207] Concentration list = alcohol concentration matching function (normalized text)
[0208] if concentration list:
[0209] Maximum concentration = Convert to standard units (max(concentration list))
[0210] If the maximum concentration is >= 80: # mg / 100ml
[0211] Dangerous driving determination = True
[0212] If not, dangerous driving assessment:
[0213] Core Load, Actual Load = Matches the core load actual load function (text)
[0214] If the load is not None and the actual load is not None:
[0215] If the actual load > the maximum load:
[0216] Dangerous driving determination = True
[0217] else:
[0218] if "severely overloaded" in text: # Add other overload descriptions
[0219] Dangerous driving determination = True
[0220] else:
[0221] List of people = Extract People Function (text)
[0222] for number of people in the list of people:
[0223] If 8 <= number of passengers <= 100 and in the context of passenger transport (number of passengers, text):
[0224] Dangerous driving determination = True
[0225] break
[0226] If dangerous driving is determined:
[0227] return True
[0228] else:
[0229] return False.
[0230] The examples described herein are merely preferred embodiments of the invention and are not intended to limit the concept and scope of the invention. Any modifications and improvements made by those skilled in the art to the technical solutions of the invention without departing from the design concept of the invention should fall within the protection scope of the invention.
Claims
1. A crime identification method integrating rule engine and knowledge graph, characterized in that, Includes the following steps: Step S1: Extract the facts of the case and the charges from the criminal judgment documents, and format the extracted results into structured data containing the fields of facts of the case and charges; Step S2: Construct a crime recognition rule engine based on trigger word matcher, regular expression pattern and logical judgment function; Step S3: Construct a legal knowledge graph containing a structured representation of the elements of a crime, and construct a thesaurus of synonyms and near-synonyms, wherein the elements of a crime include a logical representation of the object of the crime, the subject of the crime, the subjective aspect of the crime, and the objective aspect of the crime; Step S4: The crime identification rule engine is used to preliminarily determine the crime from the input case fact text and extract the target entity; Step S5: Perform multi-level hybrid retrieval on the legal knowledge graph based on the target entity, wherein the hybrid retrieval includes vector similarity retrieval, graph structure retrieval and relevance filtering; Step S6: Integrate the output of the crime identification rule engine and the retrieval results of the legal knowledge graph to generate the final crime identification result and an interpretable legal reasoning process; In step S2, the trigger word matcher constructs a multi-level trigger word library for specific crimes, including verbs of criminal behavior, words of result state, words of subjective intent, and keywords of legal elements, and calculates the matching degree based on word frequency-inverse document frequency weighting; the regular expression pattern library designs multi-level regular expression patterns for each crime, including basic behavior patterns, specific scenario patterns, and behavior result combination patterns; the logical judgment function is based on the criminal law crime constitution theory, and designs if-else logical judgment functions for each crime, simulating the syllogistic reasoning process of legal experts, including element check, exclusion situation judgment, and comprehensive decision-making; The formula for calculating the trigger word match degree by the trigger word matcher is as follows: in, This indicates the degree of match between the trigger words and the charge c. This represents a multi-level trigger word list for crime c. Indicates the trigger term, This indicates the input text containing the facts of the case. Indicates terms In the text TF-IDF weights in Indicates an indicator function, when The value is 1 if it is true, and 0 otherwise. This indicates the coverage adjustment parameter. This indicates the number of trigger words matched by crime 'c'. Indicates the total number of words in the trigger word list; The specific formula for calculating the regular expression matching degree using the regular expression pattern library is as follows: in, The degree of regular expression matching for crime 'c'. The set of regular expression patterns representing crime c. Represents a single regular expression pattern. Indicates the weight of pattern p. This indicates the degree of matching of pattern p in text D. This represents the consistency penalty coefficient. This represents the average matching score across all patterns. The number of patterns in the set of regular expression patterns for crime c; The specific formula for calculating the logical rule satisfaction degree of a logical judgment function is as follows: in, This indicates the degree to which the logical rules for crime c are satisfied. The number of logical rules representing crime c. This represents the r-th logical rule. The importance weight of rule r is determined through expert experience. This indicates the degree to which rule r is satisfied in text D. This indicates that the rule meets the threshold. Indicates the base adjustment parameter. This indicates an indicator function, which is 1 when the rule satisfaction is greater than the threshold, and 0 otherwise. In step S4, the preliminary determination of the crime through the crime recognition rule engine specifically includes the following steps: The input case fact text is matched with the crime rules in the rule base; The confidence score of each candidate crime is calculated based on the matching results. The calculation of the confidence score takes into account the matching degree of the trigger word, the matching degree of the regular expression, and the satisfaction degree of the logical rule. Crimes with a confidence level higher than the threshold and their corresponding core legal elements are identified as preliminary crimes and target entities; The confidence score is calculated using the following formula: in, This indicates the crime given by the rules engine. The initial confidence score, , and These represent the trigger word matching degree, the regular expression matching degree, and the logical rule satisfaction degree, respectively. , and These represent the power-weight parameters of the three components. This represents the consistency penalty coefficient. This represents the standard deviation of the three components; Step S6 specifically includes the following steps: Step S6.1: The preliminary charges output by the rule engine are weighted and fused with the legal interpretations and related case information retrieved from the knowledge graph. The fused score for each charge is then output using the following formula: in, This represents the combined score of crime c. This indicates the crime given by the rules engine. The initial confidence score, i.e. , This represents the support level of the knowledge graph for crime c. and Indicates parameters related to the reliability of evidence sources; Step S6.2: Based on the fused information, calculate the confidence level of the final charge and output the final charge and its confidence level. The specific formula is as follows: in, This indicates the confidence level of the final conviction for charge c. Indicates by Ranked from highest to lowest, This represents the total number of candidate crimes, where n represents the nth crime. Indicates the ranking reward weight. Indicates the scaling parameter; Step S6.3: Generate a text containing the conclusion of the crime determination and the legal reasoning process based on the analysis of the elements of the crime, according to the confidence level of the final crime.
2. The method according to claim 1, characterized in that, In step S3, constructing a legal knowledge graph containing a structured representation of the elements constituting a crime specifically includes the following steps: The elements of a crime are transformed into structured logical knowledge nodes. The object of the crime uses truth value identifiers to dynamically organize the relationship of infringement of legal interests. The subject of the crime is distinguished between crimes committed by natural persons and crimes committed by entities. The subjective aspect of the crime is distinguished between intentional crimes and negligent crimes. The objective aspect of the crime is described using a two-layer logic tree structure. The large language model is used to extract entities, entity types, entity explanations, and relationships between entities from the text, with a preset priority for extracting core entities; A graph structure is constructed by merging entities and relationships, and a vector representation is generated and stored in a vector database.
3. The method according to claim 2, characterized in that, In step S3, constructing the synonym / near-synonym list includes: Based on entity vector representation, a clustering algorithm is used to divide entities with similar meanings into synonym groups; The clustering results are manually verified and calibrated to create a mapping table of standard terms and synonyms.
4. The method according to claim 3, characterized in that, In step S5, the vector similarity retrieval converts the target entity and its context into vectors, and retrieves semantically similar entities and text fragments in the vector space of the knowledge graph, outputting vector retrieval results; The graph structure retrieval starts with the target entity and uses a graph traversal algorithm in the legal knowledge graph to discover related entities, relationships and paths, and outputs graph structure retrieval results. The relevance filtering utilizes a natural language processing model to determine and filter the retrieved candidate information based on its relevance to the current case, and outputs the filtered relevant legal knowledge information.
5. The method according to claim 4, characterized in that, The objective aspects of the crime adopt a two-level logical tree structure, specifically including: the root node represents the overall conditions for the establishment of the objective aspects of the crime; the first-level nodes represent different types of behavior, connected by logical operators; the second-level nodes represent specific behavioral characteristics and constraints; each node contains a unique identifier, description, logical constraints, and original text.
6. A crime recognition system integrating a rule engine and a knowledge graph, used to implement the crime recognition method integrating a rule engine and a knowledge graph as described in any one of claims 1-5, characterized in that, include: The data preprocessing and storage module is used to extract structured data from the raw data source; The rules engine building block is used to create and maintain a rule base for crime recognition. The knowledge graph construction module is used to construct legal knowledge graphs from judgment documents, including structured representations of the elements constituting a crime; The thesaurus building module is used to create a mapping of thesaurus terms for legal terms; The hybrid retrieval module is used to perform multi-level information retrieval, including vector similarity retrieval, graph structure retrieval, and relevance filtering; The results fusion module is used to integrate the output of the rule engine and the retrieval results of the knowledge graph to generate the final crime identification result; The explanation generation module is used to generate detailed explanations of crime identification, including legal reasoning processes.
7. The system according to claim 6, characterized in that, The knowledge graph construction module includes: The text preprocessing unit is used to clean and segment judgment documents; The entity-relationship extraction unit uses a large language model to extract entities and relationships, and prioritizes the extraction of core entities. Graph construction units are used to construct graph structures and vector representations; Logical knowledge node construction unit, used to transform the constituent elements of a crime into a structured representation.
Citation Information
Patent Citations
Legal provision recommendation method based on knowledge graph and text classification model
CN113065005A
Case information semantic retrieval method and device based on knowledge graph
CN111475623A
Criminal name prediction method based on hierarchical legal knowledge and double-graph joint representation learning
CN115048510A
Group type enterprise business opportunity conflict detection and cooperative processing system based on dynamic rule engine and semantic analysis
CN121146720A
Intelligent question and answer method and system for public rental housing and computer equipment
CN121387968A