A semantic-based legislation conflict detection method and system
By using a method based on BERT+BILSTM+CRF and a regulatory knowledge graph, the problem of deep semantic analysis in legislative conflict review is solved, enabling intelligent decomposition of regulations and intelligent extraction of legal elements, and accurate detection of regulatory conflicts.
Patent Information
- Application Number
- CN202211629925.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-19
- Publication Date
- 2026-02-10
- Estimated Expiration
- 2042-12-19
AI Technical Summary
Existing technologies can only resolve some explicit conflicts in legislative conflict review, and cannot capture the actual semantic information after text changes, lacking flexibility and deep semantic analysis capabilities.
The method based on BERT+BILSTM+CRF is used to digitize the regulatory information, extract the elements of the legal provisions, and conduct deep semantic analysis by constructing a regulatory knowledge graph. Conflict review is carried out in combination with the spirit and elements of the legal provisions.
It enables intelligent decomposition and deep semantic analysis of regulations, and can intelligently recommend the spirit of legal provisions and extract legal elements, and accurately detect conflicts between regulations.
Smart Images

Figure CN115906870B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of legislative conflict review technology, and more specifically to a semantic-based legislative conflict detection method and system. Background Technology
[0002] BERT (Bidirectional Encoder Representations from Transformers) is an unsupervised model, essentially an autoencoder model; its structure is the same as the encoder part of a transformer. Compared to traditional pre-trained models, a major innovation of BERT is that it can simultaneously see the information before and after each word, greatly enhancing the model's expressive power. BERT has two main tasks in the pre-training stage: Mask Language Model (MLM) and Next Sentence Prediction (NSP). MLM can be understood as a cloze test, masking 15% of the words in each sentence and then using its context for prediction. NSP selects sentence pairs A and B, where 50% of data B is the next sentence after A, and the remaining 50% of data B is randomly selected from the corpus, learning the relevance between them to increase the model's ability to learn and generalize sentence pair features.
[0003] BiLSTM (Bi-directional Long Short-Term Memory) is composed of a forward LSTM and a backward LSTM. It can be regarded as a two-layer neural network. The first layer takes the left side as the starting input of the sequence, which can be understood as the input from the beginning of the sentence in text processing. The second layer takes the right side as the starting input of the sequence, which can be understood as the input from the last word of the sentence in text processing. It performs the same processing as the first layer in reverse. Finally, the two results are processed.
[0004] Conditional random fields (CRFs) combine the features of maximum entropy models and hidden Markov models. They are undirected graphical models and are the most suitable discriminative models for prediction tasks. They can use adjacent contextual information or states to influence the current prediction. When applied to natural language processing, they can greatly improve the model's ability to acquire semantic information.
[0005] In the legislative process, newly drafted regulations need to undergo conflict review with their superior laws. Simple conflicts can be reviewed using rules, such as a superior law prohibiting a certain behavior, but the new legislation allows it. Currently, existing technical solutions use certain specific rules to conduct conflict review between the legal provisions in the regulations and their superior laws. Although this can solve some conflict issues, it has the following drawbacks: (1) It can only solve some conflict reviews where the rules are very clear; (2) The rules are relatively rigid. In actual processing, once the text changes slightly, it cannot be detected, and the actual semantic information cannot be captured. It is not flexible enough.
[0006] Only a small portion of conflicts can be examined through simple rules; most conflicts lie in deeper semantics. Therefore, how to combine the deeper semantics of legal provisions to conduct conflict review is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0007] In view of this, the present invention provides a semantic-based method and system for detecting legislative conflicts, which can realize intelligent decomposition of legal information, intelligent recommendation of legal provisions, and intelligent extraction of legal elements, and conduct in-depth semantic analysis of legal conflicts.
[0008] To achieve the above objectives, the present invention provides the following technical solution:
[0009] A semantic-based method for detecting legislative conflicts includes the following steps:
[0010] Collect regulatory information from different sources and deconstruct the structure of the regulations to obtain structured information from various sources of regulations;
[0011] The algorithm for generating the spirit of a legal provision and the algorithm for extracting legal elements are used to intelligently extract structured information from the content of legal provisions in regulations, thereby obtaining the spirit of the legal provisions and legal elements.
[0012] Based on the structured information of regulations, as well as the spirit and elements of the legal provisions, a legal knowledge graph is constructed.
[0013] Review whether the newly drafted regulations conflict with higher-level laws and obtain the results of the conflict review.
[0014] The technical effect achieved by the above technical solution is that, through the decomposition of regulations, generation of legal provisions, and extraction of legal elements, legal conflicts can be analyzed at a deeper semantic level.
[0015] Optional, regulatory information includes: the Constitution, the Civil Code, the Criminal Code, and publicly available local regulations.
[0016] Optionally, the structure of the regulations can be broken down, specifically including the following steps:
[0017] The structured information, including the name, text, publication date, and level of legal force, is extracted from the content of the regulations, and the hierarchical relationship between the regulations is defined by the level of legal force.
[0018] The content of the legal provisions is broken down into a hierarchical structure of sections, chapters, subsections, articles, clauses, items, and purposes.
[0019] The technical effects achieved by the above technical solution are as follows: it analyzes the structure of various source regulations, which facilitates the subsequent processing of different parts of the regulations; it decomposes the regulations to obtain a hierarchical structure, which facilitates the subsequent generation of clauses and extraction of legal elements.
[0020] Optionally, the legal provisions can be obtained using the mT5 model.
[0021] Optional elements of a legal provision include: assumption, subject, compulsory rights, optional rights, permissible obligations, inviolable obligations, object, and liability for consequences.
[0022] Optionally, the acquisition of legal elements adopts the BERT+BILSTM+CRF method, which specifically includes the following steps:
[0023] The input text is processed into characters, transforming the sentence into a single arrangement of characters to obtain character information;
[0024] The processed character information is fed into BERT for feature processing to obtain the character vectors in the input text, denoted as sequences. ;
[0025] Get n The dimensional vector is passed through a BILSTM as input to each time step to obtain the hidden state sequence of the BILSTM layer. This hidden state sequence includes the forward vector... and backward ;
[0026] Towards With backward After all processing is complete, the hidden state sequences are concatenated according to their positions to obtain the complete hidden state sequence, denoted as . ;
[0027] The complete hidden state sequence is mapped to s dimensions through a linear output layer, and the extracted sentence features, i.e., the sequence after all mappings, are denoted as a matrix. , Each dimension Corresponding to its characters Each corresponding category label The score;
[0028] Predicted sequence based on the output of the BERT+BILSTM model Using CRF Modeling, and outputting the final result, namely the legal elements.
[0029] Optionally, review whether the newly drafted regulations conflict with higher-level laws, specifically including the following steps:
[0030] Select the newly compiled regulations and their corresponding superior laws;
[0031] Determine whether the newly drafted regulations are identical to the provisions of its superior law. If the provisions are not identical, no further review will be conducted. If the provisions are identical, obtain the corresponding legal element information for each provision.
[0032] The legal elements of the two laws are compared one by one to examine whether the legal elements of the newly compiled law are within the scope of the legal elements of the corresponding legal elements of its superior law. If they are all included, it indicates that the newly compiled law is consistent with its superior law; otherwise, it indicates that there is a conflict between the two.
[0033] This invention also discloses a semantic-based legislative conflict detection system, comprising: a data acquisition module, a data disassembly module, an information extraction module, a data construction module, and a review module, with each structure connected in sequence.
[0034] The data collection module is used to collect regulatory information from different sources;
[0035] The decomposition module is used to decompose the structure of legal documents and obtain structured information from various sources of regulations;
[0036] The information extraction module uses algorithms for generating legal provisions and extracting legal elements to intelligently extract structured information from the legal provisions in regulations, thereby obtaining the legal provisions' meanings and elements.
[0037] The module constructs a legal knowledge graph based on the structured information of the regulations, as well as the spirit and elements of the legal provisions.
[0038] The review module is used to examine whether there is a conflict between the newly drafted regulations and the superior laws, and to obtain the results of the conflict review.
[0039] Optional, regulatory information includes: the Constitution, the Civil Code, the Criminal Code, and publicly available local regulations.
[0040] Optional elements of a legal provision include: assumption, subject, compulsory rights, optional rights, permissible obligations, inviolable obligations, object, and liability for consequences.
[0041] As can be seen from the above technical solution, compared with the prior art, the present invention discloses a semantic-based legislative conflict detection method and system, which can realize intelligent decomposition of legal information, intelligent recommendation of legal provisions, and intelligent extraction of legal elements. It can combine the deep semantics of the legal content to conduct conflict review of newly compiled regulations and their superior laws. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0043] Figure 1 This is a flowchart of a semantic-based legislative conflict detection method.
[0044] Figure 2 This is a schematic diagram of the structured information processing flow for regulations;
[0045] Figure 3 This is a structural diagram of a semantic-based legislative conflict detection system. Detailed Implementation
[0046] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0047] This invention discloses a semantic-based method for detecting legislative conflicts, such as... Figure 1 As shown, it includes the following steps:
[0048] Collect regulatory information from different sources and deconstruct the structure of the regulations to obtain structured information from various sources of regulations;
[0049] The algorithm for generating the spirit of a legal provision and the algorithm for extracting legal elements are used to intelligently extract structured information from the content of legal provisions in regulations, thereby obtaining the spirit of the legal provisions and legal elements.
[0050] Based on the structured information of regulations, as well as the spirit and elements of the legal provisions, a legal knowledge graph is constructed.
[0051] Review whether the newly drafted regulations conflict with higher-level laws and obtain the results of the conflict review.
[0052] Next, for Figure 1 The specific process of the semantic-based legislative conflict detection method shown will be further elaborated.
[0053] 1. Collection of legal information, mainly including publicly available laws at the national level (Constitution, Civil Law, Criminal Law, etc.) and some publicly available local regulations.
[0054] 2. Deconstructing the structure of regulations: The goal is to analyze the structure of regulations from various sources to facilitate subsequent processing of different parts of the regulations. This includes the following steps:
[0055] The structured information such as the name, text, publication date, and level of legal force of the regulations is extracted from the content of the regulations, and the hierarchical relationship between the regulations is defined by the level of legal force.
[0056] During the decomposition of regulations, the content of legal provisions is broken down into a hierarchical structure of sections, chapters, subsections, articles, clauses, items, and purposes, which facilitates the subsequent generation of the provisions' purpose and the extraction of legal elements.
[0057] 3. Intelligent extraction of structured information from legal provisions in regulations, mainly involving algorithms for generating legal provisions and algorithms for extracting legal provisions elements.
[0058] The summary of a legal provision, or the gist of a legal provision, serves to facilitate understanding and review of the provision and provides legislative guidance. From a legislative perspective, the summary of a legal provision must be non-repetitive, non-overlapping, unambiguous, and non-redundant; therefore, it plays a crucial role in resolving conflicts between regulations. The summary primarily reflects the semantic characteristics of the legal provision and has a strong generalization; therefore, to better generate the summary of a legal provision, this embodiment uses mT5 to generate the summary.
[0059] The T5 (Text-to-Text Transfer Transformer) model transforms tasks such as translation, classification, regression, and summarization into text-to-text tasks, allowing these tasks to use the same objective function during training (pre-training and fine-training) and the same decoding process during testing. The T5 model adopts the encoder-decoder structure of the Transformer and has been specifically fine-tuned to improve its performance, especially in the field of text generation, where it has achieved remarkable results in tasks such as summarization and translation.
[0060] mT5 is a fine-tuned and upgraded version of T5, and a multilingual variant of T5. Its pre-trained dataset covers 101 languages and includes 300 million to 13 billion parameters. Compared to T5, mT5 mainly uses gated linear units to enhance its performance. The detailed extraction steps of legal provisions are as follows: First, the input legal provisions are text-encoded. During text encoding, the input legal provisions are first segmented using jieba, a custom dictionary, and a stop dictionary. Next, the segmented data is encoded according to the mT5's built-in dictionary. When a word is not in the mT5 dictionary, it is encoded using mT5's built-in sentencepiece. Second, the encoded vector is fed into the mT5 encoder. Finally, the encoder result is fed into the mT5 decoder for text output.
[0061] Although the spirit of a legal provision embodies the overall semantic information of the provision, it is not possible to determine whether two legal provisions conflict solely based on the spirit. Therefore, a single legal provision is broken down into multiple elements, and conflicts are determined by comparing these elements. The legal provisions are broken down into eight major elements: assumption, subject, compulsory rights, optional rights, permissible obligations, incapable obligations, object, and consequential liability. To better extract these eight elements from the semantic level, this embodiment uses BERT+BILSTM+CRF, specifically including the following steps:
[0062] The input text is processed into characters, transforming the sentence into a single arrangement of characters to obtain character information;
[0063] The processed character information is fed into BERT for feature processing to obtain the character vectors in the input text, denoted as sequences. The obtained word vectors can effectively extract features from the text by utilizing the relationships between words.
[0064] Get n The dimensional vector is passed through a BILSTM as input to each time step to obtain the hidden state sequence of the BILSTM layer. This hidden state sequence includes the forward vector... and backward ;
[0065] Towards With backward After all processing is complete, the hidden state sequences are concatenated according to their positions to obtain the complete hidden state sequence, denoted as . ;
[0066] The complete hidden state sequence is mapped to an s-dimensional array (where s is the number of label categories in the annotation set) through a linear output layer. The extracted sentence features, i.e., the sequence after all mappings, are denoted as a matrix. , Each dimension Corresponding to its characters Each corresponding category label The score;
[0067] Predicted sequence based on the output of the BERT+BILSTM model Using CRF Modeling, and outputting the final result, namely the legal elements.
[0068] 4. Combine the relevant information extracted in the second and third steps to construct a legal knowledge graph.
[0069] like Figure 2 The diagram illustrates the processing flow of structured information in regulations. Newly drafted regulations and their superior laws are processed into legal provisions, which involves two parts: first, breaking down legal provisions into individual modules (articles, clauses, items, and sub-items); and second, merging the articles, clauses, items, and sub-items under each legal provision into a single content. Next, for the merged content, the mT5 model is used to generate the legal provision's essence. For the individual modules (articles, clauses, items, and sub-items) under each legal provision, the data is fed into a BERT+BILSTM+CRF element extraction module to extract legal provisions' elements. Finally, the legal provisions' essence and elements are integrated and stored in a database to construct a knowledge graph.
[0070] 5. Review whether the newly drafted regulations conflict with higher-level laws. To avoid comparing each article individually, the articles are first screened using their general principles. Only articles with the same general principles are subject to conflict review. The review mainly focuses on whether there are conflicts in the eight key elements of the articles, specifically including the following steps:
[0071] Select the newly compiled regulations and their corresponding superior laws;
[0072] Determine whether the newly compiled regulations are identical to the provisions of its superior law. If the provisions are not identical, then these two provisions do not meet the initial conditions for review and no further review will be conducted. If the provisions are identical, obtain the corresponding legal element information for each provision.
[0073] The legal elements of the two laws are compared one by one to examine whether the legal elements of the newly compiled law are within the scope of the legal elements of the corresponding legal elements of its superior law. If they are all included, it indicates that the newly compiled law is consistent with its superior law; otherwise, it indicates that there is a conflict between the two.
[0074] and Figure 1 Corresponding to the method described above, this embodiment of the invention also provides a semantic-based legislative conflict detection system for detecting... Figure 1The specific implementation of the method, as provided in this embodiment of the invention, is a semantic-based legislative conflict detection system that can be applied to computer terminals or various mobile devices. Its structural diagram is shown below. Figure 3 As shown, it specifically includes: a data acquisition module, a data disassembly module, an information extraction module, a data construction module, and a review module, with each structure connected in sequence.
[0075] The data collection module is used to collect regulatory information from different sources;
[0076] The decomposition module is used to decompose the structure of legal documents and obtain structured information from various sources of regulations;
[0077] The information extraction module uses algorithms for generating legal provisions and extracting legal elements to intelligently extract structured information from the legal provisions in regulations, thereby obtaining the legal provisions' meanings and elements.
[0078] The module constructs a legal knowledge graph based on the structured information of the regulations, as well as the spirit and elements of the legal provisions.
[0079] The review module is used to examine whether there is a conflict between the newly drafted regulations and the superior laws, and to obtain the results of the conflict review.
[0080] Furthermore, the regulatory information includes: the Constitution, the Civil Code, the Criminal Code, and publicly available local regulations.
[0081] Furthermore, the elements of a legal provision include: assumption, subject, compulsory rights, optional rights, permissible obligations, inviolable obligations, object, and consequential liability.
[0082] This embodiment can intelligently decompose legal information, intelligently recommend legal provisions and their contents, and intelligently extract legal elements. It can combine the deep semantics of the legal content to conduct conflict review on newly compiled regulations and their superior laws, thus solving the problems existing in the prior art.
[0083] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0084] The above description of the disclosed embodiments enables those skilled in the art to make or use the invention. 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 the invention. Therefore, the invention 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 disclosed herein.
Claims
1. A semantic-based method for detecting legislative conflicts, characterized in that, Includes the following steps: Collect regulatory information from different sources and deconstruct the structure of the regulations to obtain structured information from various sources of regulations; The algorithm for generating the spirit of a legal provision and the algorithm for extracting legal elements are used to intelligently extract structured information from the content of legal provisions in regulations, thereby obtaining the spirit of the legal provisions and legal elements. Based on the structured information of regulations, as well as the spirit and elements of the legal provisions, a legal knowledge graph is constructed. Review whether the newly drafted regulations conflict with higher-level laws, and obtain the results of the conflict review; The legal provisions and their contents were obtained using the mT5 model. The acquisition of legal elements adopts the BERT+BILSTM+CRF method, which specifically includes the following steps: The input text is processed into characters, transforming the sentence into a single arrangement of characters to obtain character information; The processed character information is fed into BERT for feature processing to obtain the character vectors in the input text, denoted as sequences. ; Get n The dimensional vector is passed through a BILSTM as input to each time step to obtain the hidden state sequence of the BILSTM layer. This hidden state sequence includes the forward vector... and backward ; Towards and backward After all processing is complete, the hidden state sequences are concatenated according to their positions to obtain the complete hidden state sequence, denoted as . ; The complete hidden state sequence is mapped to a linear output layer. s The extracted sentence features, i.e., the sequence after all mappings, are denoted as a matrix. , Each dimension Corresponding to its characters Each corresponding category label Predicted sequence based on the output of the BERT+BILSTM model Using CRF Modeling, and outputting the final result, namely the legal elements; The review of whether newly drafted regulations conflict with higher-level laws includes the following steps: Select the newly compiled regulations and their corresponding superior laws; Determine whether the newly drafted regulations are identical to the provisions of its superior law. If the provisions are not identical, no further review will be conducted. If the provisions are identical, obtain the corresponding legal element information for each provision. The legal elements of the two laws are compared one by one to examine whether the legal elements of the newly compiled law are within the scope of the legal elements of the corresponding legal elements of its superior law. If they are all included, it indicates that the newly compiled law is consistent with its superior law; otherwise, it indicates that there is a conflict between the two.
2. The semantic-based legislative conflict detection method according to claim 1, characterized in that, The legal information includes: the Constitution, the Civil Code, the Criminal Code, and publicly available local regulations.
3. The semantic-based legislative conflict detection method according to claim 1, characterized in that, Deconstructing the structure of regulations involves the following steps: The structured information, including the name, text, publication date, and level of legal force, is extracted from the content of the regulations, and the hierarchical relationship between the regulations is defined by the level of legal force. The content of the legal provisions is broken down into a hierarchical structure of sections, chapters, subsections, articles, clauses, items, and purposes.
4. The semantic-based legislative conflict detection method according to claim 1, characterized in that, The elements of a legal provision include: assumption, subject, compulsory rights, optional rights, permissible obligations, inviolable obligations, object, and liability for consequences.
5. A semantic-based legislative conflict detection system, used to implement the semantic-based legislative conflict detection method as described in claim 1, characterized in that, include: The system consists of a data acquisition module, a data disassembly module, an information extraction module, a data construction module, and a review module, with each module connected sequentially. The data collection module is used to collect regulatory information from different sources; The decomposition module is used to decompose the structure of legal documents and obtain structured information from various sources of regulations; The information extraction module uses algorithms for generating legal provisions and extracting legal elements to intelligently extract structured information from the legal provisions in regulations, thereby obtaining the legal provisions' meanings and elements. The module constructs a legal knowledge graph based on the structured information of the regulations, as well as the spirit and elements of the legal provisions. The review module is used to examine whether there is a conflict between the newly drafted regulations and the superior laws, and to obtain the results of the conflict review.
6. The semantic-based legislative conflict detection system according to claim 5, characterized in that, The legal information includes: the Constitution, the Civil Code, the Criminal Code, and publicly available local regulations.
7. A semantic-based legislative conflict detection system according to claim 5, characterized in that, The elements of a legal provision include: assumption, subject, compulsory rights, optional rights, permissible obligations, inviolable obligations, object, and liability for consequences.
Citation Information
Patent Citations
Article generation method based on mT5
CN115983259A