Law enforcement document element extraction and statute matching system based on search enhancement generation
By using a retrieval-enhanced system for extracting elements from law enforcement documents and matching legal provisions, the problem of relying on manual processing in the creation of law enforcement documents in existing technologies has been solved. This system achieves automated conversion of law enforcement documents and semantic consistency in legal provision recommendations, thereby improving the efficiency and quality of document generation.
Patent Information
- Application Number
- CN202610446533.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-07
- Publication Date
- 2026-07-24
AI Technical Summary
In the current technology, the preparation of administrative law enforcement documents relies on manual processing, resulting in incomplete extraction of factual elements, inaccurate application of legal provisions, low review efficiency, and difficulty in standardizing document quality.
Design a system for extracting elements and matching legal provisions from law enforcement documents based on retrieval enhancement, including a document access module, a text parsing module, an element modeling module, a legal knowledge organization and joint indexing module, a retrieval enhancement module, a legal provision matching module, a risk identification module, and a result generation module. Through hierarchical processing and multidimensional retrieval, it realizes the automatic conversion of law enforcement documents, the semantic consistency of legal provision recommendations, and risk identification.
It significantly improves the completeness and accuracy of factual element extraction, reduces the probability of legal provisions being omitted, enhances the accuracy of legal provisions application and document generation efficiency, strengthens the transparency and credibility of the law enforcement process, and realizes intelligent assistance in document processing.
Smart Images

Figure CN122451072A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent auxiliary technology for administrative law enforcement, and in particular to a system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval. Background Technology
[0002] With the increasing quantity and complexity of administrative law enforcement activities in my country, administrative organs generate a large number of documents during the enforcement process, including administrative penalty decisions, on-site inspection records, interrogation transcripts, orders to rectify, and administrative enforcement documents. These enforcement documents not only record the facts and procedures of cases but also directly relate to the application of law and administrative discretion, playing a crucial role in the fairness, legality, and standardization of law enforcement. Therefore, the accuracy and standardization of administrative law enforcement document preparation have become an important foundation for internal management, supervision, and judicial review within administrative organs. Simultaneously, with the development of digital and information technologies, administrative organs urgently need to improve the efficiency of law enforcement document preparation and review, achieving document standardization, normalization, and intelligentization to adapt to the increasing number of cases, stricter timeliness requirements, and greater complexity in the application of law.
[0003] Among related technologies, some administrative document processing systems and intelligent auxiliary tools have been applied to the document creation and review processes. For example, some systems use text templates and rule matching to perform structured annotation on documents, or use keyword retrieval, regular expressions, and shallow natural language processing techniques to parse document content, thereby generating partially structured data or providing document proofreading prompts. Meanwhile, some research has attempted to apply machine learning models to document classification, factual element identification, or legal provision recommendation. For instance, statistical language models are used to extract basic information such as case subjects, behavioral descriptions, time and location, or legal provision recommendations are achieved through vector-based case database matching. These technologies have improved document processing efficiency to some extent, especially in large-scale document archiving, preliminary review, and information retrieval.
[0004] However, existing technologies still have significant shortcomings. First, traditional document processing systems often rely on fixed templates or keyword matching, lacking a deep understanding of complex semantics and context. This leads to incomplete and inaccurate extraction of factual elements when describing vague, non-standard, or semantically complex case facts. Second, existing systems typically only support the application of law at a simple matching stage, failing to achieve semantic fusion and intelligent sorting of candidate legal provisions and case facts. This easily results in omissions of legal provisions, errors in application, or inconsistencies in the basis for discretionary decisions. Furthermore, some machine learning methods require large amounts of labeled data for training and lack universality across different document types, making it difficult to adapt to the diverse structures and semantic differences of various law enforcement documents. Simultaneously, existing methods have limited capabilities in risk warnings, modification suggestions, and auditability, failing to meet the requirements of standardized, normalized, and intelligent management of administrative law enforcement.
[0005] To address the aforementioned issues, a system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval is designed. Summary of the Invention
[0006] This application provides a system for extracting elements and matching legal provisions in law enforcement documents based on enhanced retrieval, in order to solve the problems in the prior art, such as reliance on manual processing in the creation of administrative law enforcement documents, incomplete extraction of factual elements, inaccurate application of legal provisions, low review efficiency, and difficulty in standardizing document quality.
[0007] Firstly, a system for extracting elements from law enforcement documents and matching legal provisions based on retrieval enhancement is provided, including:
[0008] The server, and the processor, storage, document access module, text parsing module, element modeling module, legal knowledge organization and joint indexing module, retrieval enhancement module, legal provision matching module, risk identification module, result generation module and audit record module deployed in the server;
[0009] The document access module is used to receive PDF, OFD, Word, scanned and transcribed text and form export data, and complete format unification, encoding standardization, window segmentation and initial text preprocessing.
[0010] Text parsing module: used to perform layout restoration, logical segmentation, block classification, reference alignment and offset positioning on the input text, forming block table, sentence table, reference table and offset table;
[0011] Element modeling module: used to map the analysis results into a structured case fact model, including case subjects, illegal acts, time and place, evidence materials, procedural nodes and penalty results;
[0012] The Legal Knowledge Organization and Federation Index module is used to perform clause splitting, relational organization, inverted index construction, vector index construction, and version management of laws, regulations, discretionary standards, and cases.
[0013] The retrieval enhancement module is used to generate query vectors and retrieval keys based on the facts of the case, and to perform keyword recall, semantic recall, graph association recall, re-ranking, and context enhancement processing.
[0014] Legal provision matching module: This module is used to align the facts of a case with the constituent elements, procedural requirements, and penalty ranges of candidate legal provisions item by item, and generate legal provision matching results and explanations of the basis for the matching.
[0015] Risk identification module: used to identify risk items and their level labels based on matching results, such as omissions in legal provisions, insufficient evidence, missing procedures, abnormal penalties, and insufficient discretionary explanations;
[0016] Results generation module: used to aggregate case facts, legal provisions matching and risk identification results, and generate element list, matching list, risk warning and modification suggestion text according to preset templates;
[0017] Audit Log Module: Used to record the inputs and outputs, model versions, rule versions, result snapshots, hash digests, and chain traceability information of each processing stage, forming a complete audit log.
[0018] In some embodiments, the text parsing module divides the law enforcement document into a document header block, a fact description block, an evidence listing block, a procedural description block, a decision result block, and a delivery and execution block, and establishes a structure containing... , , , and A fragment of the record.
[0019] In some embodiments, the element modeling module establishes a case element table, which includes at least... , , , , , , , , , , , Field.
[0020] In some embodiments, the regulatory knowledge organization and federated index module uses a "node-relationship" structure to store regulatory clauses, where nodes include clause nodes, element nodes, procedure nodes, and penalty nodes, and relationship edges include citation relationships, procedure association relationships, and penalty association relationships, and establishes the following index structure:
[0021] (1) Inverted index: A term-item mapping table is built based on keywords;
[0022] (2) Vector indexing: Encode clause fragments into semantic vectors and construct a vector retrieval space;
[0023] And calculate the overall weight of the clauses: ;in, Indicates the first The overall weight of each clause, This indicates the keyword hit score. Indicates semantic similarity score, This indicates the score for timeliness and authority.
[0024] In some embodiments, the regulatory knowledge organization and joint indexing module is a core innovative module, including a clause splitting unit, a node construction unit, a relationship modeling unit, and a dual-index construction unit. Specifically, the clause splitting unit performs hierarchical splitting of legal texts into chapters, sections, articles, clauses, and items according to the regulatory hierarchy; the node construction unit establishes clause nodes, element nodes, procedural nodes, and penalty nodes; the relationship modeling unit constructs the citation relationships, procedural association relationships, and penalty association relationships between nodes; and the dual-index construction unit establishes an inverted index structure based on keywords and a vector index structure based on semantic vectors, respectively, and achieves the association mapping between the two types of indexes through a unified identifier.
[0025] In some embodiments, the retrieval enhancement module calculates the comprehensive score of candidate legal provisions according to the following formula: ;in, To score the keyword matching score Score semantic similarity. For program correlation scoring, To determine the score for related factors, , , For the preset weights, and satisfying + + + =1, and sort and output the candidate legal provisions based on the score.
[0026] In some embodiments, the retrieval enhancement module is a core innovative module, including a query construction unit, a multi-source recall unit, a result fusion unit, and a context enhancement unit. The query construction unit generates behavioral query items, procedural query items, and penalty query items based on a case element model. The multi-source recall unit calls the inverted index structure and vector index structure respectively to obtain a set of candidate legal provisions. The result fusion unit performs unified sorting processing on candidate results from different sources and forms a candidate sequence. The context enhancement unit adds associated procedural clauses, discretionary benchmark information, and regulatory hierarchy information to the candidate legal provisions, forming a structured candidate legal provision data block.
[0027] In some embodiments, the legal provision matching module calculates the matching confidence between factual elements and candidate legal provisions according to the following formula: ;in, Indicates semantic similarity. Indicates the coverage of constituent elements. Indicates the degree of consistency of rules. , , To predetermine the weights, the main applicable legal provisions and auxiliary legal provisions are determined through the above calculations.
[0028] In some embodiments, the legal provision matching module is a core innovative module, including an element expansion unit, a fact alignment unit, a consistency verification unit, and a result finalization unit. The element expansion unit breaks down candidate legal provisions into a set of elements consisting of the subject of the action, the manner of the action, the applicable conditions, the procedural requirements, and the penalty range. The fact alignment unit maps each field in the case element model to the corresponding element position to form an alignment structure. The consistency verification unit verifies the procedural order, penalty range, and element completeness item by item and forms verification marks. The result finalization unit generates structured result data of the main applicable legal provision and auxiliary legal provisions based on the alignment structure and verification marks.
[0029] In some embodiments, the system further includes a graph path reasoning and legal provision chain matching mechanism, comprising a path generation unit, a path expansion unit, a path filtering unit, and a chain matching unit. The path generation unit constructs an initial path set based on clause nodes, element nodes, procedural nodes, and penalty nodes in the legal knowledge graph. The path expansion unit performs multi-hop expansion of the initial path along citation relationships, procedural relationships, and penalty relationships to form a multi-level path structure. The path filtering unit performs consistency screening on the node sequences in the path based on a case element model, retaining valid paths that satisfy behavioral requirements, procedural constraints, and penalty range constraints. The chain matching unit maps the filtered path sequences into a continuous legal provision combination structure and generates chain matching result data containing the main legal provision, procedural legal provisions, and discretionary basis.
[0030] The beneficial effects of the technical solution provided in this application include:
[0031] 1. This application constructs a hierarchical processing system for document access, text parsing, and element modeling, which enables the automatic conversion of law enforcement documents from unstructured text to structured case facts, significantly improving the completeness and consistency of fact element extraction. Compared with traditional keyword methods, the extraction accuracy can be increased from about 70% to over 85%.
[0032] 2. By structurally breaking down legal provisions and constructing a combined indexing mechanism of inverted index and vector index, the legal retrieval is transformed from single keyword matching to multi-dimensional retrieval of "keyword + semantics + relationship", effectively reducing the probability of missing legal provisions and improving retrieval recall and accuracy.
[0033] 3. This application introduces a search-enhanced generation mechanism to integrate case facts with legal provisions at the contextual level, avoiding the problem of "separation between search results and text generation" in traditional systems, and achieving semantic consistency and improved interpretability of legal provision recommendation results.
[0034] 4. By constructing a comprehensive scoring model that includes keyword scores, semantic similarity, procedural relevance, and discretionary relevance, the candidate legal provisions can be refined and ranked, making the matching results more consistent with actual law enforcement logic and improving the accuracy of the application of the legal provisions.
[0035] 5. By constructing a three-dimensional matching model of "semantic similarity - element coverage - rule consistency", the facts of the case and the constituent elements of the legal provisions are aligned item by item, thereby improving the standardization and verifiability of the application of the legal provisions and reducing the risk of misuse of the legal provisions.
[0036] 6. By introducing a risk identification module, omissions in legal provisions, insufficient evidence, procedural deficiencies, and abnormal penalties are automatically identified and quantitatively scored, thereby achieving automated risk assessment of law enforcement documents and improving the systematicness and foresight of law enforcement review.
[0037] 7. Through a unified template-driven result generation mechanism, structured case facts, legal provision matching results, and risk information are automatically integrated and output, significantly improving document generation efficiency, reducing manual editing workload, and enhancing document standardization.
[0038] 8. By establishing a full-process audit record and chain traceability mechanism, the entire process of law enforcement document processing is left traceable, ensuring that the results are traceable, verifiable and tamper-proof, thereby improving the transparency and credibility of the law enforcement process.
[0039] 9. Through modular system architecture design, the decoupling and collaboration of document processing, legal retrieval, legal provision matching and risk identification are realized, thereby improving the system's scalability and adaptability to different law enforcement scenarios, and reducing system deployment and maintenance costs.
[0040] 10. This application integrates multi-source data analysis, knowledge organization and intelligent reasoning technologies to form a closed-loop processing flow of "fact extraction - legal retrieval - legal provision matching - risk identification", realizing intelligent assistance for law enforcement documents from generation to review, and improving the overall processing efficiency by more than 30%. Attached Figure Description
[0041] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 The overall system processing flowchart provided in the embodiments of this application;
[0043] Figure 2 This is a flowchart of document access and preprocessing provided for an embodiment of this application;
[0044] Figure 3 A flowchart of text parsing and element extraction provided for embodiments of this application;
[0045] Figure 4 A flowchart illustrating the process of enhancing the legal term and recalling candidate legal provisions is provided for embodiments of this application.
[0046] Figure 5 A flowchart for legal provision matching and risk output provided for embodiments of this application;
[0047] Figure 6 This is a schematic diagram of the system deployment architecture provided in the embodiments of this application;
[0048] Figure 7 A comprehensive scoring data chart of candidate legal provisions provided for embodiments of this application;
[0049] Figure 8 A schematic diagram of the regulatory knowledge graph provided for embodiments of this application;
[0050] Figure 9 The document access quality and field confidence distribution diagram provided for the embodiments of this application;
[0051] Figure 10 A comparison chart of text parsing block classification accuracy provided for embodiments of this application;
[0052] Figure 11 A statistical chart of the completeness of case element extraction provided for embodiments of this application;
[0053] Figure 12 A comprehensive weight distribution diagram of regulatory provisions provided for embodiments of this application;
[0054] Figure 13 A comparison chart of multi-channel retrieval recall and precision provided for embodiments of this application;
[0055] Figure 14 A comprehensive score ranking curve of candidate legal provisions provided for embodiments of this application;
[0056] Figure 15 A diagram showing the relationship between legal provision matching confidence and requirement coverage provided for embodiments of this application. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0058] This application provides a system for extracting elements and matching legal provisions in law enforcement documents based on enhanced retrieval, which can solve the problems in related technologies and existing technologies, such as reliance on manual processing in the production of administrative law enforcement documents, incomplete extraction of factual elements, inaccurate application of legal provisions, low review efficiency, and difficulty in standardizing document quality.
[0059] Please see Figures 1-10 A system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval, comprising:
[0060] The document access module receives and processes original enforcement documents, attachments, and supplementary materials in a unified manner; the text parsing module segments, numbers, and locates documents to form document fragment results; the element modeling module maps document content to a case element table; the legal knowledge organization and joint indexing module organizes and indexes regulations, discretionary benchmarks, and cases in a structured manner; the retrieval enhancement module generates retrieval requests and retrieves candidate legal provisions, procedural rules, and discretionary bases; the legal provision matching module aligns and matches case facts with candidate legal provisions; the risk identification module identifies risk issues in legal provisions, procedures, evidence, and penalties; the result generation module outputs an element list, matching results, risk warnings, and modification suggestions; and the audit record module records the version, results, and revision information of each processing stage.
[0061] I. Document Access Module
[0062] This module resides on the input side of the entire system, deployed in the server's access service layer. It is directly connected to the processor, memory, file cache, and task queue, receiving PDFs, OFDs, Word documents, image-to-text transcriptions, and form-exported text, while simultaneously receiving attachments and supplementary instructions. Internally, the module employs a five-level structure: file adapter, metadata parser, text normalization engine, sliding window, and deduplication checker. The file adapter sorts data by file extension and MIME type; PDFs and OFDs retain page numbers and layout coordinates; Word documents extract paragraph levels and styles; image-to-text transcriptions retain OCR bounding boxes and confidence scores; and form text retains key-value pair structures. The text normalization engine unifies character encoding to UTF-8 and performs full-width / half-width character encoding consistency, whitespace compression, and standardization of amount and date formats, ensuring consistency in subsequent input parsing.
[0063] To avoid context drift caused by long documents being directly entered into subsequent modules, this module segments the text using sliding windows. The window length is set to 800 to 1200 Chinese characters, with adjacent windows overlapping by 80 to 150 Chinese characters. In a typical administrative penalty decision sample, the main text is approximately 4200 characters. Using a window length of 1024 and an overlap length of 128, five consecutive text segments are obtained, preserving the context of factual paragraphs while controlling the length of each calculation. After entering the window segmentation, the module first calculates the block relevance to filter out headers, footers, and duplicate explanatory paragraphs. The relevance is expressed as: ;in, Indicates the first Relevance of each text block Indicates keyword hit rate. Represents the density of the substance. This indicates the layout matching score. When... When the relevance is ≥0.60, the block proceeds to subsequent analysis. For example, if a segment contains prompts such as "the party concerned," "after investigation," and "the decision is as follows," and also includes a date, amount, and organization name, the relevance usually exceeds 0.70.
[0064] For text blocks entering the processing chain, this module continues to output field-level confidence scores, which helps subsequent modules decide whether to directly store them in the database or mark them for verification. The field confidence score is calculated as follows: ;in, Representation field The overall confidence level, Indicates the probability of segment recognition. This indicates the field type consistency score. This represents the rule validation score. If "November 3, 2025" and "fine of RMB 50,000" are validated using time and amount rules, their confidence levels can reach 0.93 and 0.89 respectively. Finally, the deduplication checker compares the overlap of duplicate segments in adjacent windows; if the overlap coefficient is not less than 0.80, they are merged into the same input record and retained. , , , The source file identifier provides a stable, continuous, and traceable raw input for the text parsing module.
[0065] II. Text Parsing Module
[0066] This module, located after the document access module and before the feature modeling module, is deployed in the server's parsing service layer. It is directly connected to the document cache, page coordinate buffer, and intermediate result tables, employing a pipelined architecture of "page restoration—logical segmentation—block classification—reference alignment—structure output." The module's inputs are the unified encoded text, page number information, coordinate information, and source file identifier output from the document access module. Its outputs are a document fragment table, sentence / segment table, reference table, and offset table. During processing, the reading order of the PDF, OFD, Word, and OCR texts is restored first, preserving... , , , , , , The document is then logically segmented based on field names, line spacing variations, heading patterns, and sentence closure features. This results in a stable document structure consisting of a header block, a factual description block, an evidence listing block, a procedural explanation block, a decision / result block, and a delivery / execution block. Each block is then assigned a specific function. , , and source page number.
[0067] The logical segmentation stage employs a boundary discrimination algorithm, with the boundary score defined as follows: ;in, Indicates the first The scores of each candidate boundary, This represents the normalized line spacing jump variable. This indicates the score for matching the title pattern. Indicates the closing comma of a sentence. When When the score is ≥0.65, a new block is created at that position. For example, in an administrative penalty decision, if the line spacing before and after "Case Facts" increases from 1.0 to 1.7 times, the title matching score reaches 0.90. If the previous sentence ends with a period, the boundary score is approximately 0.79, which can be reliably identified as the starting point of a new block. This threshold is derived from empirical calibration of 300 law enforcement document samples and can balance title recognition and text continuity.
[0068] After segmentation, the module continues to classify the text blocks, using a combination of rule-based features and a lightweight classification model. The classification score is written as: ;in, Indicates the first The text block belongs to the category The score, This indicates the trigger phrase matching score. Indicates the contextual semantic score, This indicates the prior score for page layout. Taking "The above facts are corroborated by on-site inspection records, interrogation records, and photographs" as an example, the evidence-related trigger phrase is obvious and located after the fact block and before the decision block; the system usually categorizes it into the evidence listing block. Finally, the citation alignment unit associates the evidence names, legal citations, and procedural nodes in the text with the appendix list, regulation names, and clause numbers to generate... Synchronous output of the structure output unit , and This module transforms the original continuous text into a well-structured, location-traceable, and field-transferable parsing result, providing a stable input for subsequent case element modeling.
[0069] III. Element Modeling Module
[0070] This module is located after the text parsing module and before the regulatory knowledge organization and federated indexing module, deployed in the server's modeling service layer, and... , , and Direct connections are used, employing a layered architecture of "schema definition—field mapping—entity normalization—event assembly—consistency verification—structure storage." The module pre-builds a model of law enforcement document elements, and the case element table includes at least... , , , , , , , , , , , The field mapping stage, constrained by block category, keyword pattern, and contextual relationship, maps candidate fragments from the fact description block, evidence listing block, procedure description block, and decision result block to corresponding fields. The mapping score is written as: ;in, Representing fragments For fields The mapping score, This represents the text pattern matching score. Indicates the block type adaptation score. This indicates the contextual semantic score. For example, "Party A: A Certain Construction Engineering Company" is located in the header block and accompanied by the subject prompt, which is mapped to... The score is usually higher than 0.85.
[0071] The entity unification phase employs a hybrid algorithm combining a rule base and a lightweight unification model to standardize entity names, times, amounts, addresses, and legal citations. For example, "fifty thousand yuan," "50,000 yuan," and "a fine of fifty thousand yuan" are unified as the numerical field 50,000, and abbreviations and full names in different documents are unified to the same entity identifier. Subsequently, the event assembly unit generates case events based on "who, when, where, what illegal act was committed, what evidence was used, what procedures were followed, and what treatment was given," and calculates the event completeness. ;in, Indicates the first The completeness of each case and event Indicates the first The extraction status of each key field is represented by 1 for success and 0 for missing fields. This indicates the field weight. In a typical sample, the subject, behavior, evidence, and penalty result have been extracted, but the location is missing or the procedure is incomplete. The completeness can still reach 0.78, allowing it to proceed to the next retrieval process. Finally, the consistency verification unit checks the logical relationships such as time sequence, consistency of subjects, compatibility of penalty type and amount, and locatability of evidence items, and is generated by the structure storage unit. , , and This provides a unified, calculable, and traceable input of case facts for subsequent recall of legal provisions and matching of legal provisions.
[0072] IV. Legal Knowledge Organization and Union Index Module
[0073] This module, located after the element modeling module and before the retrieval enhancement module, is deployed in the server's knowledge service layer. It directly connects to the relational database, graph storage engine, inverted index engine, and vector retrieval engine, employing a five-level architecture: "regulatory parsing—knowledge organization—inverted index building—vector encoding—version control." The module's input includes current laws and regulations, departmental rules, local norms, discretionary standards, procedural rules, and historical enforcement case texts. The output includes a structured legal clause library, a keyword inverted index table, a semantic vector index table, and a relational edge table. Clause nodes must include at least the regulatory identifier, regulatory level, chapter, section, article, clause, item, applicable behavior, statutory procedure, penalty type, penalty range, preconditions, effective date, and expiration date. Relational edges must include at least citation relationships, superior basis relationships, procedural relationships, and penalty relationships. After this processing, the regulatory text is no longer stored as a complete document but is broken down into searchable, associative, and sortable fine-grained nodes.
[0074] The regulation analysis phase first breaks down the regulation into layers: "Regulation Name—Chapter—Section—Article—Paragraph—Item," and then extracts behavioral tags, procedural tags, and penalty tags. In the knowledge organization phase, the breakdown results are written into the clause table, element table, and relationship table, and a unique identifier is assigned to each clause. To reduce the overhead of subsequent full-database retrieval, the module first performs initial node screening based on the case element model. The initial screening decision function is written as follows: ;in, Indicates the nodes of the legal provisions. Indicates the object of the case inquiry. Indicate the initial relevance between the terms and the facts of the case. This represents the filtering threshold. In a typical sample, if the case behavior is "operating without a license," and the combined match rate of the behavior label, procedural label, and penalty label of a certain clause reaches 0.76, while the threshold is set to 0.60, then that node enters the candidate regulation subset; if the match rate is only 0.42, it is retained in the entire database but does not participate in this round of recall. This threshold is derived from empirical calibration of common law enforcement document samples, which can balance the sufficiency of recall and the efficiency of indexing.
[0075] The inverted index building stage adopts a three-element structure of "term - clause identifier - position offset," writing the law name, clause number, keywords of illegal behavior, keywords of procedural nodes, and keywords of penalties into the inverted index table to support precise searching and phrase matching. The vector encoding stage uses a legal domain text embedding model to encode the main text of the legal provisions, discretionary benchmark fragments, procedural rule fragments, and case summaries into fixed-length vectors, which are then written into the vector index library for semantic nearest neighbor search. To uniformly manage the two types of index results, the module further calculates the comprehensive index weight of the clauses: ;in, Indicates the first The overall weight of each clause, This indicates the keyword hit score. Indicates semantic similarity score, This indicates the timeliness and authority scores. For example, if a currently valid superior legal provision has a keyword hit rate of 0.90, a semantic similarity score of 0.82, and a timeliness and authority score of 1.00, its overall weight is 0.887, and it will usually be prioritized for the top candidate list. During the version control phase, the update date of the regulations, replaced clauses, and invalidation markers are recorded simultaneously to prevent older clauses from continuing to participate in the ranking. After this module, the system forms a unified legal knowledge organization result and a joint index result, providing high-quality, computable, and traceable legal basis input for the search enhancement module.
[0076] V. Search Enhancement Module
[0077] This module, located after the legal knowledge organization and composite index module and before the legal provision matching module, is deployed in the server's retrieval and orchestration service layer. It is directly connected to the case element table, legal knowledge base, inverted index, and vector index, employing a five-level architecture: query construction, candidate recall, composite sorting, context assembly, and result caching. The module's input is from the case element table. , , , , , , , The data includes fields such as candidate legal provisions, candidate procedural rules, and candidate discretionary grounds. The sorting results are then written to the database. In the query construction stage, the facts of the case are first broken down into behavioral query items, procedural query items, and penalty query items. Then, extended search terms are generated through a terminology dictionary, a synonym expression table, and a lightweight semantic expansion model. For example, "operating without a license" can be expanded to expressions such as "operating without a license" and "engaging in business activities without obtaining a license in accordance with the law," thereby reducing missed detections caused by differences in expression.
[0078] The candidate recall phase utilizes both the inverted index and the vector index in parallel. The inverted index is responsible for locating the law name, clause number, keywords related to illegal acts, and keywords related to procedural nodes, suitable for exact matching. The vector index is responsible for searching the semantic space for legal provisions, discretionary benchmark fragments, and historical case fragments that are close to the facts of the case, suitable for recalling evidence with inconsistent wording but similar legal meaning. Subsequently, the joint ranking phase calculates a comprehensive score for each candidate legal provision, using the following formula: ;in, For the first Keyword matching score of each candidate legal provision Score semantic similarity. For program correlation scoring, To determine the score for related factors, , , For the preset weights, and satisfying + + + =1. In a typical sample, if a candidate legal provision has a keyword score of 0.92, a semantic score of 0.86, a procedural relevance score of 0.70, and a discretionary relevance score of 0.80, with weights of 0.35, 0.30, 0.20, and 0.15 respectively, its overall score is approximately 0.834, which would place it among the top candidates. This weighting method originates from the linear fusion strategy commonly used in hybrid retrieval, facilitating a balance between precise legal recall and semantic recall.
[0079] The context assembly stage automatically appends adjacent procedural clauses, a summary of discretionary criteria, regulatory level, and effective status to the leading candidate clauses, forming an enhanced basis block that can be directly submitted to the legal provision matching module, instead of simply outputting isolated clauses. To control length, the system sets a maximum character limit for the appended content; for example, the context of a single candidate clause is controlled between 800 and 1200 characters, prioritizing the retention of core legal provisions, procedural requirements, and discretionary ranges. The results caching stage writes the candidate object number, sorting number, comprehensive score, source channel, context text, and version tag to the results. This allows subsequent legal provision matching to run on a fixed-size, highly relevant candidate set, reducing the overhead of traversing the entire database and improving matching stability.
[0080] VI. Legal Provision Matching Module
[0081] This module, located after the retrieval enhancement module and before the risk identification module, is deployed in the rule-based reasoning service layer of the server. It is directly connected to the case element table, candidate legal provision set, candidate procedural rule set, and candidate discretionary basis set, employing a five-level architecture of "element expansion—fact alignment—consistency verification—matching scoring—finalization of results." The module input is... , and The output is a table of legal provision matching results. The element development stage first breaks down candidate legal provisions into atomic elements such as the object of the act, the manner of the act, the applicable scenario, procedural requirements, the type of punishment, the range of punishment, and the preconditions; the fact alignment stage then further aligns the elements of the case. , , , , , ,and Mapping to the corresponding slots forms an alignment matrix of "factual elements - legal provisions". To improve the stability of the comparison, the module adopts a hybrid algorithm of "rule matching + semantic similarity + program chain verification", which not only determines whether the keywords overlap, but also whether the factual statements and the constituent elements of the legal provisions are consistent at the semantic level.
[0082] In the matching scoring stage, a matching confidence score is generated based on the coverage of factual elements and the constituent elements of legal provisions. The calculation formula is as follows: ;in, Indicates the first The first factual element and the second Matching confidence among candidate legal provisions Indicates semantic similarity. Indicates the coverage of constituent elements. Indicates the degree of consistency of rules. , , The weights are preset. In a typical sample, if the semantic similarity between the illegal act "operating without a license" and the candidate clause is 0.88, the coverage of the constituent elements is 0.80, and the rule consistency is 0.90, and the weights are 0.35, 0.40, and 0.25, the matching confidence is approximately 0.852. This linear fusion form is derived from the interpretable scoring model, which facilitates maintaining a balance between substantive facts, procedural requirements, and rule constraints.
[0083] The consistency verification phase focuses on checking the order of procedural nodes, the suitability of penalty ranges, and the hierarchical relationship of legal provisions. For example, when the penalty amount exceeds the allowable range of the candidate legal provisions and the discretionary benchmark, or when there is no evidence citing the key elements in the factual block, the system will reduce the rule consistency and retain the conflict label. In the finalization phase, the system prioritizes the output of the main applicable legal provisions, auxiliary procedural basis, and discretionary basis, and includes alternative clauses in the output, sorting them from highest to lowest matching confidence level, and also including alternative clauses. The table includes at least [number of items]. , , , , , , , and After this module, the candidate legal provisions set is compressed into a small number of high-confidence matching results, providing a direct, structured, and interpretable basis for judgment in the subsequent risk identification module.
[0084] VII. Risk Identification Module
[0085] This module is located after the legal provision matching module and before the result generation module, deployed in the risk analysis service layer of the server. , , , , and The system is directly connected and employs a five-level architecture: rule loading, gap calculation, risk scoring, risk classification, and revision suggestion generation. The module takes into account the case fact model, legal provision matching results, procedural records, evidence association records, and penalty results. The output includes a risk label set, risk score, risk level, and revision suggestions, which are then written to the system. During the rule loading phase, rules regarding missing legal provisions, procedural conflicts, missing evidence, insufficient discretionary explanations, and mismatched penalty bases are pre-maintained. Each rule must contain at least [number missing]. , , , and This facilitates unified verification of different case types.
[0086] The gap calculation stage first extracts the completeness of constituent elements from the legal provision matching results, then counts the number of sequential conflicts and missing nodes in the procedure table, and finally identifies situations where "facts have been written but lack supporting evidence" or "evidence exists but is not linked to facts" from the evidence association table. The comprehensive risk score is calculated using the following formula: ;in, Indicates the completeness of the constituent elements. Indicates a program error indicator. This indicates that the evidence supports the gap indicator. , , The weights are preset. In a typical sample, if the completeness of the constituent elements is 0.85, the procedural error index is 0.30, and the evidence gap index is 0.20, and the weights are 0.40, 0.35, and 0.25 respectively, then the comprehensive risk score is 0.225. This formula is derived from the weighted risk assessment model, which facilitates mapping the entity gap, procedural gap, and evidence gap to the same score space.
[0087] The risk classification stage sets threshold ranges based on risk scores; for example, scores below 0.20 are considered low risk, 0.20 to 0.50 are medium risk, and scores above 0.50 are high risk. The trigger source and impact fields are also retained. If a case has situations such as "the penalty amount has been determined but the discretionary explanation is missing" or "the decision has been made but the statement and defense node does not appear in the procedural explanation block," the system will add a conflict label. The revision suggestion generation stage is based on... The module automatically generates suggested text, such as "supplementary procedural node time," "supplementary evidence number," "supplementary explanation of discretionary standards," or "review of the main applicable legal provisions." Ultimately, the module will... , , , , , and Write This provides the results generation module with a risk list that can be directly summarized and a basis for revision.
[0088] VIII. Result Generation Module
[0089] This module is located after the risk identification module and before the audit logging module, deployed in the server's output service layer, and is related to... , , , It connects directly to the template library, employing a five-level architecture of "result aggregation—template mapping—text generation—consistency verification—structure output." The module takes case fact models, legal provision matching results, and risk identification results as inputs, and outputs a list of enforcement document elements, a legal provision matching list, a risk warning list, and suggested modification text, and writes the results to... The result aggregation phase is first processed according to... The system associates the case subject, illegal acts, evidence materials, procedural nodes, penalty results, main applicable legal provisions, auxiliary procedural basis, and risk labels to form a unified output object. In the template mapping stage, the system selects an element list template, legal provision comparison template, risk warning template, or revision suggestion template according to the output type, and establishes a one-to-one correspondence between fields and template slots.
[0090] The text generation stage employs a hybrid algorithm of "slot filling + rule fragment concatenation" to transcribe structured fields into readable text. For example, the main applicable legal provisions and penalty ranges are combined into a legal provision comparison section, and risk tags and revision templates are combined into a modification suggestion section. To quantify the completeness of the output content, the module defines output coverage: ;in, Indicates output coverage. This indicates the number of template slots that have been successfully filled. This indicates the total number of slots in the template. In a typical sample, the legal provision matching template has 20 slots, and 18 have been filled, resulting in an output coverage rate of 0.90, allowing direct generation of the result text. If the coverage rate is below 0.75, the system adds a "Pending Manual Completion" marker to the output. This metric is derived from the slot completion rate statistics in the template generation task, directly reflecting the usability of the results.
[0091] The consistency verification phase further compares whether there are conflicts between fact fields, legal provisions, and risk recommendations. For example, if the case facts state "a fine of 50,000 yuan," but the template-generated text mistakenly states "a fine of more than 50,000 yuan," a numerical conflict verification will be triggered. If a risk recommendation requires the addition of a certain procedure node, but that node has already been marked as complete in the legal provision comparison results, a recommendation conflict verification will be triggered. The final stage of the structure output phase involves writing... The fields must include at least , , , , and It supports exporting to three formats: JSON, tables, and document fragments. After passing through this module, the structured facts, legal provision matching results, and risk analysis results obtained from the previous modules are uniformly converted into standard output content that is readable, verifiable, and transferable.
[0092] IX. Audit Record Module
[0093] This module, located after the results generation module, is deployed in the server's log and traceability service layer. It directly connects to the processor, storage, results database, object storage, and timestamp service, employing a five-level architecture: "event collection—version encapsulation—summary calculation—chain association—traceability query." The module's inputs are the intermediate and final results generated at each stage: document access, text parsing, element modeling, regulatory retrieval, legal provision matching, risk identification, and results generation. Its outputs are audit logs, version snapshots, hash summaries, and traceability records. Each module call generates a standard event object, with fields including at least... , , , , , , , and This process ensures that the system not only saves the final conclusion, but also the input sources, model version, and rule version that led to the conclusion, facilitating subsequent review.
[0094] During the version encapsulation stage, using the case number and processing round as the primary key, a unified snapshot encapsulation is performed on the original document, document fragment table, case element table, candidate legal provision sorting table, matching result table, risk result table, and output result table, and a version is generated. To prevent records from being silently altered in subsequent revisions, the module... Version data processed next time Calculate the summary value: ;in, This represents the current version's summary. In a typical sample, if a case processing snapshot is 3.1MB, then changing even a single legal provision number or a single monetary character will result in a recalculated summary value. This summary can use SHA-256 or a similar one-way hash algorithm, which requires minimal computation and is suitable for batch processing on government servers.
[0095] The chain association phase concatenates the previous version digest, the current version digest, and the timestamp, and then recalculates the chain digest to form a continuous version chain: ;in, This indicates a summary of the previous version. This indicates a summary of the current version. Represents the current timestamp, symbol This indicates concatenation. If law enforcement officers add evidence numbers in version 2 and adjust the main applicable legal provisions in version 3, both versions 2 and 3 will retain independent snapshots and chained associations, without overwriting previous records. The retrospective query stage supports searching by case number, module name, operator, time interval, and version number, and returns the corresponding search source, candidate ranking, matching score, risk label, and manually revised content. Finally, the module is generated. , and This enables traceability, verifiability, and reviewability of the entire process from document input to result output.
[0096] The above description is merely a specific embodiment of this application, enabling those skilled in the art to understand or implement this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval generation, characterized in that, Includes the following modules; Document input module: Used to receive PDF, OFD, Word, scanned transcribed text and form exported data, and complete format unification, encoding standardization, window segmentation and initial text preprocessing; Text parsing module: used to perform layout restoration, logical segmentation, block classification, reference alignment and offset positioning on the input text, forming block table, sentence table, reference table and offset table; Element modeling module: used to map the analysis results into a structured case fact model, including case subjects, illegal acts, time and place, evidence materials, procedural nodes and penalty results; The Legal Knowledge Organization and Federation Index module is used to perform clause splitting, relational organization, inverted index construction, vector index construction, and version management of laws, regulations, discretionary standards, and cases. The retrieval enhancement module is used to generate query vectors and retrieval keys based on the facts of the case, and to perform keyword recall, semantic recall, graph association recall, re-ranking, and context enhancement processing. Legal provision matching module: This module is used to align the facts of a case with the constituent elements, procedural requirements, and penalty ranges of candidate legal provisions item by item, and generate legal provision matching results and explanations of the basis for the matching. Risk identification module: used to identify risk items and their level labels based on matching results, such as omissions in legal provisions, insufficient evidence, missing procedures, abnormal penalties, and insufficient discretionary explanations; Results generation module: used to aggregate case facts, legal provisions matching and risk identification results, and generate element list, matching list, risk warning and modification suggestion text according to preset templates; Audit Log Module: Used to record the inputs and outputs, model versions, rule versions, result snapshots, hash digests, and chain traceability information of each processing stage, forming a complete audit log.
2. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The text parsing module divides law enforcement documents into a header block, a fact description block, an evidence listing block, a procedural description block, a decision result block, and a delivery and execution block, and establishes a structure containing information for each text block. , , , and A fragment of the record.
3. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The element modeling module establishes a case element table, which includes at least the following: , , , , , , , , , , , Field.
4. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The regulatory knowledge organization and composite index module uses a "node-relationship" structure to store regulatory clauses. Nodes include clause nodes, element nodes, procedural nodes, and penalty nodes. Relationships include citation relationships, procedural association relationships, and penalty association relationships. The following index structure is established: (1) Inverted index: A term-item mapping table is built based on keywords; (2) Vector indexing: Encode clause fragments into semantic vectors and construct a vector retrieval space; And calculate the overall weight of the clauses: ;in, Indicates the first The overall weight of each clause, This indicates the keyword hit score. Indicates semantic similarity score, This indicates the score for timeliness and authority.
5. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The regulatory knowledge organization and joint indexing module is the core innovative module, which includes a clause splitting unit, a node construction unit, a relationship modeling unit, and a dual-index construction unit. Among them, the clause splitting unit splits the legal text into chapters, sections, articles, clauses, and items according to the hierarchical structure of regulations; the node construction unit establishes clause nodes, element nodes, procedural nodes, and penalty nodes; the relationship modeling unit constructs the reference relationships, procedural association relationships, and penalty association relationships between nodes; the dual-index construction unit establishes an inverted index structure based on keywords and a vector index structure based on semantic vectors, respectively, and realizes the association mapping of the two types of indexes through a unified identifier.
6. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The retrieval enhancement module calculates the comprehensive score of candidate legal provisions according to the following formula: ;in, To score the keyword matching score Score semantic similarity. For program correlation scoring, To determine the score for related factors, , , For the preset weights, and satisfying + + + =1, and sort and output the candidate legal provisions based on the score.
7. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The retrieval enhancement module is a core innovative module, comprising a query construction unit, a multi-source recall unit, a result fusion unit, and a context enhancement unit. The query construction unit generates behavioral, procedural, and penalty query items based on a case element model. The multi-source recall unit retrieves candidate legal provisions by calling both an inverted index structure and a vector index structure. The result fusion unit performs unified sorting on candidate results from different sources and forms a candidate sequence. The context enhancement unit adds associated procedural clauses, discretionary benchmark information, and regulatory hierarchy information to the candidate legal provisions, forming a structured candidate legal provision data block.
8. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The legal provision matching module calculates the matching confidence between factual elements and candidate legal provisions according to the following formula: ;in, Indicates semantic similarity. Indicates the coverage of constituent elements. Indicates the degree of consistency of rules. , , To predetermine the weights, the main applicable legal provisions and auxiliary legal provisions are determined through the above calculations.
9. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The legal provision matching module is a core innovative module, including an element expansion unit, a fact alignment unit, a consistency verification unit, and a result finalization unit. The element expansion unit breaks down candidate legal provisions into a set of elements consisting of the subject of the act, the manner of the act, the applicable conditions, the procedural requirements, and the penalty range. The fact alignment unit maps each field in the case element model to the corresponding element position to form an alignment structure. The consistency verification unit verifies the procedural order, penalty range, and element completeness item by item and forms verification marks. The result finalization unit generates structured result data of the main applicable legal provisions and auxiliary legal provisions based on the alignment structure and verification marks.
10. The system for extracting elements from law enforcement documents and matching legal provisions based on enhanced retrieval as described in claim 1, characterized in that: The system as described in claims 4-9 further includes a graph path reasoning and legal provision chain matching mechanism, comprising a path generation unit, a path expansion unit, a path filtering unit, and a chain matching unit; wherein, the path generation unit constructs an initial path set based on clause nodes, element nodes, procedural nodes, and penalty nodes in the legal knowledge graph; the path expansion unit performs multi-hop expansion of the initial path along citation relationships, procedural relationships, and penalty relationships to form a multi-level path structure; the path filtering unit performs consistency filtering on the node sequence in the path based on the case element model, retaining valid paths that meet the behavioral elements, procedural constraints, and penalty interval constraints; the chain matching unit maps the filtered path sequence into a continuous legal provision combination structure and generates chain matching result data containing the main legal provision, procedural legal provisions, and discretionary basis.