Legal text conflict detection method and system based on information extraction

By constructing an enhanced pre-trained model and a semantic vector large model, combined with information extraction technology, the problems of low efficiency and high resource consumption in legal text conflict detection are solved, efficient and accurate identification of upper and lower-level conflicts is achieved, and the accuracy and efficiency of legal judgments are improved.

CN120449871APending Publication Date: 2025-08-08SHANDONG UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510347633.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

The existing legal text conflict detection methods are inefficient in dealing with complex legal texts, inadequate semantic understanding, and high cost of training large models and high computing resources, making it difficult to efficiently and accurately identify conflicts between upper and lower methods.

Method used

Using an information extraction method, an enhanced pre-trained model (such as ERNIE3.0), combined with sequence labeling and a dual-pointer network for entity positioning, a unified information extraction model is used to extract key information, and conflict judgment is made through a semantic vector large model (such as BGE), reorganize and clean text events to achieve efficient upper and lower-level conflict detection.

Benefits of technology

It improves the accuracy and efficiency of conflict detection in legal texts, reduces the demand for data sets and computing resources, can more accurately identify conflict points in legal texts, and enhances the pertinence and authority of legal judgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120449871A_ABST
    Figure CN120449871A_ABST
Patent Text Reader

Abstract

The invention relates to a legal text conflict detection method and system based on information extraction. The method comprises the following steps: constructing a legal data set, and classifying and positioning the legal data set; performing structured processing to obtain a structured text; constructing an enhanced pre-training model; inputting the structured text into an enhanced pre-training model for training to obtain a unified information extraction model; performing information extraction on legal data to be subjected to conflict detection by using a unified information extraction model; the entities and the relations obtained through information extraction are recombined to form a new event; carrying out cleaning work on the recombined new events; and carrying out conflict judgment on the cleaned new events. According to the conflict detection method, input texts with different granularities are efficiently supported, more specific conflict points are provided for understanding of text semantics, and the practicability and effectiveness of conflict detection are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a legal text conflict detection method and system based on information extraction, belonging to the field of natural language processing applied to law. Background Art

[0002] The key to adjudicating cases lies in accurately determining whether a current legal provision conflicts with its superior law, thereby mitigating the risks arising from such conflicts. Legal conflicts vary in effectiveness and hierarchy, and are not defined by the same or different perspectives. Due to the varying laws, regulations, and local documents enacted by various local departments, courts cannot quickly and efficiently identify conflicting rules between superior and inferior laws when resolving judicial issues. This can significantly impact and lead to errors in case adjudication and judgment. Legal conflicts are generally understood as conflicts between legal norms. The core goal of legal conflict detection is to quickly locate, identify, and quantify key points and conflicting points in legal provisions, thereby helping examiners conduct more impartial and objective case adjudications, improving the accuracy of legal decisions, and ensuring the stable operation of the legal field. However, due to the complex and obscure nature of different legal expressions, determining conflicts between superior and inferior laws requires significant manpower and resources, presenting a significant challenge to the judicial field. The practical application of conflict resolution rules by courts remains a question that requires further investigation.

[0003] Currently, conflicts between texts are primarily addressed through automated conflict detection technology, which can identify discrepancies between text data. Traditional conflict detection methods primarily rely on text entailment algorithms, which determine the relative relationships between sentences by calculating the similarity between conditions and hypotheses. Machine learning-based text detection algorithms are relatively common, primarily including Naive Bayes and Support Vector Machines. These methods are simple and efficient, and offer excellent performance when dealing with high-dimensional text feature spaces.

[0004] Conflict detection is primarily based on syntactic and lexical features in the data, using either segmentation or classification models to calculate sentence similarity. The SGNN model uses a long short-term memory network to extract linguistic features from text, and then uses a classification model to detect three types of conflicts: negation, antonym, and number mismatch. Deep learning-based text entailment algorithms, such as convolutional neural networks and recurrent neural networks, have also made significant progress. Convolutional neural networks extract text features through convolutional and pooling layers, enabling precise text location. Recurrent neural networks, on the other hand, exhibit excellent performance when processing text of arbitrary shapes and orientations. These algorithms improve the efficiency and accuracy of text processing and have high application value for complex text. In recent years, large models have become increasingly popular, and text conflict detection based on these models holds great promise. However, these models require significant resources and manpower, and are complex to maintain.

[0005] With the rapid development of today's big data era, the interconnectedness of massive amounts of data is becoming increasingly close, and the amount of data to be processed is constantly increasing. Therefore, conflict detection is a pressing issue, especially when it comes to conflicts between superior and subordinate laws. Conflicts between laws primarily arise from factors such as semantic understanding, the expression of parts of speech, and the establishment of negations. These factors interact with each other, significantly impacting the determination of conflicts and, consequently, the outcome of cases.

[0006] Among conflict detection methods, similarity-based text detection is a popular approach. This method is intuitive and can determine the relationship between two texts by calculating similarity. First, the text is segmented, and each word is weighted by its frequency of occurrence. The agreement coefficient and word-meaning dictionary similarity are then calculated. The premise and hypothesis are then combined to determine the edit distance between the two texts, ultimately integrating all feature variables. Although similarity-based algorithms are simple and easy to implement, they still have significant flaws and shortcomings. First, this method ignores the semantics and logical relationships between sentences and overemphasizes the presence of identical or similar words in the two texts, resulting in significant errors in the determination of entailment relationships. Second, when a word appears too frequently in the text, the results are significantly affected, resulting in poor error tolerance and robustness. Furthermore, because this method relies too heavily on rule matching, it exhibits poor accuracy for expressions such as numbers, dates, and quantifiers, resulting in a low recall rate. Therefore, a more semantically responsive approach is needed to help users efficiently determine conflict relationships between two legal texts.

[0007] With the development of deep learning, contrastive learning-based text conflict detection algorithms have gradually gained attention. This approach is generally based on unsupervised or semi-supervised learning. Its core idea is to construct positive and negative sample pairs, learn the similarities or differences between samples, and embed data into a semantic space. This allows similar texts to be drawn closer together, while dissimilar or contradictory samples are separated. This approach can be used to build a model that can distinguish text conflicts and thus detect contradictions in text. This method has the ability to capture hidden contradictions and is applicable to a variety of scenarios, fully extracting complex semantic information from text. Although contrastive learning-based methods have performed well in certain scenarios, they do have some drawbacks. First, contrastive learning training is complex and requires careful construction of positive and negative sample pairs. The model is highly sample-dependent, the selection of difficult negative samples directly determines the model's performance, and the model has high dataset requirements. Second, contrastive learning has weak generalization capabilities and may not effectively capture the semantic features of new domains in cross-domain learning. Furthermore, contrastive learning typically involves the computation of a large number of sample pairs, resulting in low computational efficiency and slow computation speed.

[0008] In recent years, with the rise of large models, large-model-based text conflict detection methods have also been proposed. These methods leverage the deep semantic features and context modeling capabilities learned by pre-trained models on large corpora. Through fine-tuning, task adaptation, and semantic comparison, they detect semantic contradictions in text. The core advantages of large models lie in their versatility and powerful language understanding capabilities, enabling them to capture complex semantic information in text. Furthermore, large models can simultaneously perform tasks such as conflict detection, information extraction, and sentiment analysis within a multi-task learning framework, improving resource utilization. While large models currently offer promising results, they are not without challenges. First, they consume excessive amounts of data and computing power, with the number of parameters reaching trillions. The scale of training data and computing power is proportional to the number of parameters, resulting in high training costs. Second, large models suffer from catastrophic forgetting, where training on new tasks impairs performance on previously trained tasks and prevents them from remembering previously trained data or scenarios. Furthermore, quantitative evaluations of large models often show weak generalization capabilities, requiring additional fine-tuning and adaptation, and potentially exposing some risk of overfitting. Summary of the Invention

[0009] In response to the shortcomings of the existing technology, the present invention provides a legal text conflict detection method based on information extraction. This method is based on small sample learning in a large model, introduces and improves an enhanced pre-trained language model, obtains key semantic elements in a sentence through entity recognition, extracts the main elements for reorganization and alignment, and thus removes irrelevant words. This effectively addresses scenarios with long texts and excessive redundant words that traditional methods cannot solve, and greatly improves the accuracy of conflict judgment. At the same time, compared to traditional large model methods, this method has low semantic requirements for data sets and corpora, which can save a lot of manpower and material resources. In terms of conflict judgment, the present invention designs a conflict detection algorithm that efficiently supports input texts of different granularities, provides more specific conflict points for understanding text semantics, and solves the problems of incomplete semantic understanding and high application scenario requirements in convolutional neural network methods, thereby improving the practicality and effectiveness of conflict detection.

[0010] Explanation of terms:

[0011] 1. Superior law: A law or regulation with a higher level of effectiveness in the legal system. It serves as the basis and standard for the formulation of lower-level laws. It is usually formulated by national legislative bodies and the content involved is usually the basic principles of the legal system.

[0012] 2. Subordinate laws: Laws or regulations with a lower level of effectiveness in the legal system are subject to superior laws and have a more limited scope of management. They are a refinement or supplement to superior laws. Subordinate laws need to be implemented within the framework of superior laws.

[0013] 3. Conflict detection technology: Automated conflict detection can discover contradictions between texts. It is a process of targeted text interpretation and an important basis for achieving text understanding. Its core is to identify and judge the semantically conflicting parts of the text and provide the ability to improve information quality and decision-making.

[0014] 4. Information extraction technology: A key task in natural language processing, it aims to automatically extract structured information from semi-structured or unstructured text. It mainly includes named entity recognition, relationship extraction, and event extraction. By extracting key information from text, data can be quickly filtered and summarized.

[0015] 5. Semantic Vector Big Model: This technology captures the semantic relationships between words, phrases, sentences, or documents through a vector space representation method. Semantically similar text units have smaller distances or higher similarity in the vector space. Compared to traditional sparse vector representations, the Semantic Vector Big Model, as a dense representation, can more effectively capture the semantic relationships between word units.

[0016] 6. Xmind: A comprehensive mind mapping and information visualization tool, widely used in areas such as thought organization, knowledge management, goal planning, and creative design. Its core advantage lies in its ability to clearly present complex concepts, information, and their inherent interconnected structures through mind mapping, enabling efficient organization, analysis, and understanding of multi-dimensional thought processes.

[0017] 7. xmindparser: This is a Python library for parsing Xmind files. It converts .xmind files into Python structured JSON, facilitating the extraction of key information and subsequent data processing or storage. This library can be used to extract information from Xmind files, automate mind mapping, or integrate into other data analysis and visualization processes. It is suitable for scenarios such as automated data processing, knowledge management, and data analysis.

[0018] The technical solutions of the present invention are as follows:

[0019] The first aspect of the present invention provides a legal text conflict detection method based on information extraction, comprising:

[0020] Step 1: Construct a legal dataset; classify and locate the legal dataset to meet the needs of scenarios with overlapping entities and non-overlapping entities;

[0021] Step 2: Structural processing is performed on the classified and located legal dataset to obtain structured text;

[0022] Step 3: Build an enhanced pre-training model; input the structured text obtained in step 2 into the enhanced pre-training model for training to obtain a unified information extraction model;

[0023] Step 4: Use the unified information extraction model to extract information from the legal data to be used for conflict detection;

[0024] Step 5: Recombine the entities and relationships obtained from information extraction to form new events, and clean the recombined new events;

[0025] Step 6: Conduct conflict judgment on the new events after cleaning.

[0026] According to a preferred embodiment of the present invention, a legal data set is constructed, comprising:

[0027] Organize the legal items in existing laws, including the legal liability sections in the laws. The legal scope covers various fields such as transportation, administration, environmental protection, and electricity. Each legal item contains the name of the law, the type of law, the location of the legal item, and the corresponding superior law. This information can help the model better understand the relationship between the various legal items.

[0028] A dataset was constructed based on the aforementioned legal entry data to ensure its professionalism and accuracy. This included organizing the legal entry data in the form of a mind map using the Xmind tool, making the data display more intuitive and clear. The mind map was saved in the .xmind format, and the xmindparser library was used to convert the .xmind format into a JSON file. The JSON file was then processed using a recursive traversal algorithm and a conditional filtering algorithm. The filtering conditions were set by traversing all nodes in the tree structure to extract data, and a tag dictionary was constructed based on the provided path and hierarchy.

[0029] A regular matching method is used to match and extract the content related to fines in the legal liability chapter. The Chinese legal dataset, i.e., the legal dataset, contains all chapters. The matching extraction method can be used to extract only the chapters related to fines.

[0030] The extracted penalty items, i.e., the content involving penalty, are divided into two parts: illegal behavior and penalty measures. Illegal behavior includes the subject, predicate, object, and adjective of the behavior; penalty measures include the target of penalty, scope of penalty, and management unit. In addition, since laws include multiple types such as transportation, administration, environmental protection, and electricity, different types of laws have different professional terms. Therefore, the legal type is introduced as a trigger word according to the different types of penalty items to determine whether the behaviors described by the upper and lower laws belong to the same legal type. The content of the penalty items is well labeled with relationships and types to lay a good foundation for subsequent model training and result judgment, and to construct a generated legal dataset.

[0031] Further preferably, the legal dataset is classified and located to meet the needs of scenarios with overlapping entities and non-overlapping entities; including:

[0032] To accurately locate the word units to be extracted, a combination of sequence labeling and a dual-pointer network is used to classify and locate the word units (i.e., the preprocessed dataset). This determines the positions of the start and end vectors, adapting to different scenarios with overlapping and non-overlapping entities.

[0033] The entity overlapping scenario refers to the intersection of multiple entities, i.e., the entity information to be extracted, and the entity non-overlapping scenario refers to the intersection of multiple entities, i.e., the positions of ...

[0034] In scenarios where entities do not overlap, a sequence labeling method is used, including the use of the BIO tagging system to locate entities. The BIO tagging system includes [B-], [I-], and [-O], where [B-] represents the starting word of the entity, [I-] means the word at that position is in the middle of the entity, and [-O] indicates that the word does not belong to a specific entity. In this way, each word can be labeled as the starting, internal, and non-entity position of the entity. This method can quickly define the entity range, which is efficient and concise.

[0035] In the case of overlapping entities, using a dual-pointer network, sequence labeling cannot effectively represent the cross-relationships between multiple entities. Therefore, a dual-pointer network is introduced. The start and end vector positions of the entities are marked respectively by a start pointer and an end pointer. This method can construct multi-head tasks and construct multiple entities simultaneously, effectively solving the problem of entity overlap. The formula for locating the start and end pointers of the pointer network is:

[0036]

[0037] Among them, i represents the word at the i-th position, s start represents the score corresponding to the starting position of the entity, j represents the word at the jth position, s end Indicates the score corresponding to the end position of the entity, P start (i|x) represents the probability of the i-th position being the starting position, P end (i|x) represents the probability of the i-th position being the end position; after calculating the probabilities of the start position and the end position, the word unit is located according to the probabilities of the start position and the end position;

[0038] When marking the positions of the start and end vectors, it is necessary to first judge the entity overlap, and then use an adaptive recognition mechanism to select different vector positioning methods for different overlapping situations, so that the system can dynamically adjust the labeling strategy according to the characteristics of the input data, that is, the legal data set. This method mainly focuses on the implementation of the guidance model; the model automatically identifies the entity boundaries and associations through context analysis, enhances the connection relationship between entities, and accurately captures the input features; at the same time, the dynamic results are dynamically adjusted to ensure that the start and end labels, that is, the position positioning of the entity information, are strictly aligned with the input features, to avoid the offset and error of the extraction results caused by the wrong position; through this method, the text features are fully captured, laying the foundation for efficient information extraction.

[0039] According to a preferred embodiment of the present invention, the classified and located legal data set is subjected to structured processing to obtain a structured text, which includes:

[0040] In order to quickly locate the type of information to be extracted, a structured pattern director S = [s1, s2, s3…] is used, which includes all pattern structures. The main task is to select the extracted information based on the pattern of the prompt mechanism; the information types included in the pattern structure, namely entities, relations and events, are combined with the text in the legal dataset; the pattern structure helps the model enhance its dependency on the input text by specifying the extraction task; the "[prompt] + [text]" format is used as input to the unified information extraction framework to linearly output the prediction result, as shown below:

[0041]

[0042] Where s represents the required pattern structure, i.e., the information type; x represents the text content of the legal dataset; y represents the extracted structured text; and UIE represents the Unified Information Extraction Framework. Indicates combined processing; the overall structured representation is:

[0043]

[0044] where s i represents the i-th pattern structure element, x i Represents the content corresponding to the i-th text; after summarizing the above formula, we get:

[0045]

[0046] Among them, text represents each data in the legal dataset, x |x| Indicates the content corresponding to the xth text.

[0047] Preferably, according to the present invention, an enhanced pre-training model is constructed; and the structured text obtained in step 2 is input into the enhanced pre-training model for training to obtain a unified information extraction model; including:

[0048] The enhanced pre-trained model (ERNIE3.0) includes a general processing module, a special task module, and an embedding layer;

[0049] The general processing module includes a multi-layer Transformer encoder. The Transformer encoder serves as the backbone network to extract semantic features and is shared by all tasks. By introducing this general module, the model can effectively process lexical and syntactic information in the data and gain a deeper understanding of the semantic structure of the model.

[0050] The special task module includes a natural language understanding module, which includes a multi-layer Transformer encoder for semantic understanding;

[0051] The Transformer encoder consists of multiple layers of stacked encoding modules, each of which includes a self-attention mechanism, a feedforward neural network, layer normalization, and a residual connection.

[0052] The self-attention mechanism includes a simplified linear attention mechanism and depthwise separable convolution to capture global dependencies in the input sequence. The feedforward neural network is responsible for feature transformation, and layer normalization and residual connections help stabilize gradients and optimize training. The entire Transformer encoder processes input through word embedding and positional encoding and outputs a high-dimensional contextual representation.

[0053] Structured text is mapped into vector representations at the embedding layer. The vector representations include word embeddings, position embeddings, and paragraph embeddings. These embeddings are summed to generate a sequence vector, which is then fed into the Transformer encoder in the general processing module. Semantic features are extracted using the Transformer encoder in the natural language understanding module, and these features are then fed into the Transformer encoder in the natural language understanding module for semantic understanding.

[0054] The self-attention mechanism is used to capture the correlation between the word units, that is, the vectors obtained by the embedding layer for each data in the legal dataset. The context-aware representation is generated by weighted aggregation of information from different word units. A simplified linear attention mechanism is used, and the Softmax function is replaced by the ReLU activation function, as shown below:

[0055] Sim SLA (Q i ,K j )=ReLU(Q i )·ReLU(K j ) T ;

[0056] Among them, Sim SLA represents the attention weight, Q i represents the query vector in the i-th attention mechanism, K j Represents the key vector in the jth attention mechanism, representing the key values of all elements; at the same time, the depth-wise separable convolution method is used to enhance the ability to extract local features, splitting the standard convolution into depth-wise convolution and point-wise convolution. The depth-wise convolution performs K*K convolution independently on each input channel without cross-channel calculation, while the point-wise convolution uses 1*1 convolution to fuse channel information. The complete self-attention mechanism output formula is:

[0057]

[0058] Among them, Sim SLA represents the attention weight, represents the original output obtained by simplifying the linear attention calculation, N represents the number of all elements involved, O SLA Represents the final output of the self-attention mechanism, V j Denotes the jth value vector, and DWC(V) denotes the result of depthwise separable convolution of the value vector. This method decomposes the convolution operation into channel-independent convolutions, which greatly reduces the computational complexity and simplifies the computational process while effectively capturing the local contextual relationship of the input data. The output of each layer of the Transformer encoder updates the semantic representation of the word, allowing it to integrate more semantic information layer by layer, and ultimately captures the contextual information contained in each word through a multi-layer Transformer encoder. After multiple rounds of iterative calculations, each word obtained not only reflects the individual meaning of the word, but also contains its complex relationship with other surrounding words, enhancing the ability to understand the relationship between words, thereby being more conducive to intelligent analysis and processing of text and obtaining a unified information extraction model.

[0059] Further preferably, when the enhanced pre-training model is trained, whole-word masking is used to mask the structured text; including:

[0060] The text conversion method is used to perform dynamic word embedding encoding on each word in the structured text, including adding the sentence start [CLS] tag representing the sentence pair and the [SEP] tag representing the separator between sentences in the structured text, so that each word is converted into a vector based on 0 to 1; the mapped vector representation can be based on the dynamic changes of the surrounding vocabulary, which is conducive to the positioning and identification of word boundaries, and then the text is divided into units that are more conducive to model understanding; in order to better segment and reorganize words, unlike the traditional method of covering individual words, the method of covering the entire unit, that is, the words in the entire sentence, is used to comprehensively simulate real language habits. This method greatly reduces the noise generated during the text conversion process and provides a more accurate semantic basis for downstream natural language processing.

[0061] Preferably, according to the present invention, a unified information extraction model is used to extract information from legal data to be subjected to conflict detection; the model includes:

[0062] Use a unified information extraction model to identify and extract key information from legal data to achieve transformation into a structured framework; the unified information extraction model includes entity extraction technology for identifying entities in text, relationship extraction technology for identifying relationships between entities in text, and event extraction technology for detecting events from text;

[0063] Among them, entity extraction technology is used to extract entity information such as the subject, predicate, object, attributive, punishment measures, and management unit described in the legal provisions; relationship extraction technology is used to identify the semantic relationship between different entities and punishment measures; event extraction technology is used to extract the events described in the legal provisions. Through the above three extraction methods, legal data is gradually organized into clear structured data units, achieving information unification.

[0064] The enhanced pre-trained model predicts each word in the legal dataset text to determine whether it corresponds to the content to be extracted. Through text structured processing and multiple rounds of iterative computation, the unified structure of prompt-based information extraction is further clarified, and different semantic roles or attributes need to be determined according to different downstream tasks. For entity extraction technology, the unified information extraction model predicts whether each word belongs to the entity to be extracted, and then performs prompt extraction based on the "[spot][text]" label. For relationship extraction technology, the unified information extraction model predicts the semantic relationship between multiple entities and uses "[spot][asso][spot][text]" for extraction. For event extraction, the unified information extraction model captures event trigger words, event types, and related entity information, and uses "[start-position][asso][spot][text]" to extract events. The output embedding representation of the last layer is passed to the classification layer, which predicts the specific type and entity label of each word, namely the extracted entity, relationship, and event. This approach not only ensures the efficiency of vector representation but also closely integrates the extraction objectives with specific tasks.

[0065] Preferably, according to the present invention, entities and relationships extracted from the information are recombined to form new events, including:

[0066] Based on the above steps, important information in the legal provisions can be extracted. Through this information, the key behaviors and punishment measures stipulated in the legal provisions can be quickly understood, which is conducive to judging the conflict points between superior and subordinate laws. However, the information currently extracted is only simple words, lacking basic semantic structure, and can only perform simple conflict judgments. For complex legal provisions, text conflict judgments based solely on extraction will produce large errors. Therefore, the present invention considers introducing reordering and alignment methods to construct an event recognition model. The core of this method is to reorganize the extracted entities and relationships, and transform disordered or scattered text information into a logical semantic structure.

[0067] The extracted entities and relationships are classified according to the syntactic components of the event description, including action subjects (sub), action predicates (act), action objects (obj), action adverbials (adv), negation words (no_word), event attributives (adj), and event trigger words (trigger_word). Different syntaxes are constructed based on these words to identify and parse events. After determining the syntactic components, the entities are recombined based on various syntactic relations, that is, the relations between the above grammatical words, to construct a multi-entity dependency syntactic structure.

[0068] Due to the different wordings of different legal provisions, some syntactic components may be missing during extraction. Based on this phenomenon, the missing necessary entities need to be supplemented so that the syntactic components can be combined into a complete sentence with a subject. After obtaining the complete syntactic structure, the events described in the two texts, namely the superordinate law and the subordinate law, are compared to see whether they can be determined as an event instance. The corresponding relationship between the events is established based on the context and semantics to ensure that the two events can be aligned. The coreference relationship between the events is to determine whether the two events are an event instance. The formula is as follows:

[0069] event a ={Action a ,P 1a ,P 2a ,...,P na},event b ={Action b ,P 1b ,P 2b ,...,P nb};

[0070] Among them, event a Indicates event a, Action a Indicates the event trigger word in event a, event b Indicates event b, Action b represents the event trigger word in event b, P na The event element representing the existence of event a, P nb Indicates the event elements that exist in event b; if the two event descriptions are the same example, that is:

[0071] event a ∈event_instance k ,event b ∈event_instance k ;

[0072] Among them, event_instance krepresents an event instance; then the two events are equivalent to the following relationship:

[0073]

[0074] PKS represents the key elements in an event. After completing event alignment, coreference merging is performed to eliminate redundant information and integrate the same or related event content to simplify event expression.

[0075] Further preferably, the reassembled new events are cleaned, including:

[0076] When extracting elements, spaces or line breaks are introduced to separate tokens to distinguish event elements. These symbols help the model better understand the elements described in the event and facilitate event alignment and comparison. However, this can lead to errors in conflict judgment. Therefore, after event alignment, data cleaning is performed.

[0077] Replace \r, \n, and \t characters in the text with spaces to remove line breaks and tabs, simplifying the text format. Use the regular expression \s+ to compress multiple adjacent spaces into a single space to optimize text layout and improve readability.

[0078] Regular expressions are used to remove the two sections of content, namely the superordinate and subordinate laws, in the text of the new event, thereby removing the influence of the title on the text similarity calculation; through this process, the data quality is improved, ensuring the accuracy and reliability of the data, which is conducive to improving the model data analysis capabilities.

[0079] According to the preferred embodiment of the present invention, conflict determination is performed on the new events after cleaning, including:

[0080] New events include the behavioral attributes and punishment attributes involved in the superior and inferior laws;

[0081] For the conflict judgment of behavior attributes, including behavior subjects, behavior objects, behavior predicates and behavior adverbials, the semantic vector large model (BAAI General Embedding, BGE) is adopted. BGE includes an encoder-decoder structure based on an asymmetric Transformer, in which the encoder part consists of a 12-layer Transformer encoder, which is responsible for generating the embedded vector representation of the input sentence; the decoder part has only one layer of Transformer decoder, which is responsible for further reconstructing the sentence and converting high-dimensional discrete text data into low-dimensional dense vector representation. These vectors can reflect the semantic similarity between texts, making the distance between semantically related events closer in the vector space, thereby providing a reliable basis for the calculation and judgment of the relationship between events; the first paragraph of text, that is, the content query data q of the superordinate method, is encoded into the embedding vector E q ={}, the second paragraph of text, i.e., the content document data p of the lower level method, is encoded as the embedding vector E p ={}, then the interaction between the two texts is expressed as:

[0082]

[0083] Where N represents all vectors in the first paragraph, M represents all vectors in the second paragraph, i represents the i-th vector, and j represents the j-th vector. Fine-grained similarity is calculated using the above formula. After combining different comparison methods, the final relevance score is calculated using the following formula:

[0084] s rank =w1·s dense +w2·s iex +w3·s mul ;

[0085] Among them, w1, w2, w3 represent different weights, s dense Indicates dense vector calculation, s iex Indicates sparse vector calculation, s mul Represents mixed vector calculation; in order to better combine the contextual semantics in the text and make the prediction results more accurate, an error function is introduced as a criterion for judging the accuracy of semantic prediction in the semantic vector model. The error function is defined as follows:

[0086]

[0087] L' * =-p(s inter )·logp(s * );

[0088] Among them, p *represents positive sample data, p' represents negative sample data, τ represents temperature parameter, s * Represents the score of the retrieval method, s(q,p) represents the similarity calculation function of two texts, q represents the text vector, L s (s) represents the loss in state s, L' * represents the corrected loss function, s inter Represents the probability distribution of a certain state during the model operation process; the error function is finally obtained:

[0089]

[0090] Among them, L represents the loss function in the general state, and L' represents the corrected loss function;

[0091] Through the correlation score, the model can have a very high semantic understanding ability when facing different text contents. At the same time, it can calculate the similarity between two texts based on their semantics, thereby determining the relationship between the two texts. This includes setting a similarity threshold of 0.9. If the correlation score of the two texts is higher than the threshold of 0.9, it means that there is an implication relationship between the two. Otherwise, it means that there is no direct relationship between the two, and the events described by the hierarchical structure are inconsistent, thus judging that there is a conflict in the content of the behavior involved in the hierarchical structure.

[0092] Further preferably, for conflict judgment involving penalty attributes in legal provisions, including penalty objects, penalty scope, and management units, a conflict detection algorithm is used to determine whether the polarity parameters such as penalty amount, penalty object, penalty scope, and management unit in the upper and lower laws are consistent, including:

[0093] If the two texts have the same polarity parameter, the penalty attributes of the two texts involving the polarity parameter are compared. For the penalty amount, the comparison is whether the penalty amount range stipulated by the superior law includes the penalty amount of the inferior law. If the penalty amount of the inferior law is inconsistent with the superior law, the two are in conflict.

[0094] Regarding the objects of punishment, compare whether the objects of punishment stipulated in the superior law are also covered in the inferior law. If the inferior law lacks a certain object of punishment, then the two are in conflict.

[0095] Regarding the scope of punishment, compare whether there are any punishment measures in the lower-level law that are not mentioned in the higher-level law. If so, it means that the lower-level law has added content without authorization, and the two laws conflict.

[0096] For management units, compare whether there is a superior-subordinate relationship between the management units stipulated in the superior law and the management units stipulated in the inferior law, that is, whether the management department mentioned in the superior law is responsible for directing the management department mentioned in the inferior law. If they are inconsistent, there is a conflict between the two.

[0097] If the polarity parameters in the two texts are inconsistent, it directly indicates that there is a conflict between the two; this method can efficiently detect the conflict points in the upper and lower methods.

[0098] A computer device includes a memory and a processor, wherein the memory stores a computer program and the processor implements the steps of a legal text conflict detection method based on information extraction when executing the computer program.

[0099] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of a legal text conflict detection method based on information extraction.

[0100] A second aspect of the present invention provides a legal text conflict detection system based on information extraction, comprising:

[0101] The dataset construction module is configured to: construct a legal dataset; classify and locate the legal dataset to meet the needs of scenarios with overlapping entities and non-overlapping entities;

[0102] The structured processing module is configured to: perform structured processing on the classified and located legal data set to obtain structured text;

[0103] The model training module is configured to: construct an enhanced pre-training model; and input the structured text obtained by the structured processing module into the enhanced pre-training model for training to obtain a unified information extraction model;

[0104] The extraction module is configured to: extract information from legal data to be subjected to conflict detection using a unified information extraction model;

[0105] The combination module is configured to: recombine the entities and relationships obtained from the information extraction to form new events, and clean the recombined new events;

[0106] The conflict judgment module is configured to perform conflict judgment on the new events after cleaning.

[0107] The beneficial effects of the present invention are:

[0108] 1. The proposed text detection method based on information extraction can efficiently and accurately capture key elements in the law, thereby better adjudicating conflicts between superior and subordinate laws. This method effectively addresses the current inefficiency of text conflict detection in the legal field, fills the gap in the comparison of superior and subordinate laws, enhances the pertinence and authority of legal decisions, and provides new methods and ideas for legal review.

[0109] 2. We propose a conflict detection algorithm for fine items, focusing on the handling of violations and penalties. By combining the transfer learning capabilities of the semantic vector model with the efficient processing advantages of rule matching, the algorithm can quickly locate conflict points in fine items, improving the efficiency of review. BRIEF DESCRIPTION OF THE DRAWINGS

[0110] Figure 1 This is a flow chart of conflict decision based on information extraction in the present invention;

[0111] Figure 2 This is the relationship diagram of the main elements extracted in information extraction;

[0112] Figure 3 This is the structure diagram of the enhanced pre-training model. DETAILED DESCRIPTION

[0113] The present invention will be further described below with reference to embodiments and accompanying drawings, but is not limited thereto.

[0114] Example 1

[0115] A legal text conflict detection method based on information extraction, comprising:

[0116] Step 1: Construct a legal dataset; classify and locate the legal dataset to meet the needs of scenarios with overlapping entities and non-overlapping entities;

[0117] Step 2: Structural processing is performed on the classified and located legal dataset to obtain structured text;

[0118] Step 3: Build an enhanced pre-training model; input the structured text obtained in step 2 into the enhanced pre-training model for training to obtain a unified information extraction model;

[0119] Step 4: Use the unified information extraction model to extract information from the legal data to be used for conflict detection;

[0120] Step 5: Recombine the entities and relationships obtained from information extraction to form new events, and clean the recombined new events;

[0121] Step 6: Conduct conflict judgment on the new events after cleaning.

[0122] Example 2

[0123] According to the legal text conflict detection method based on information extraction described in Example 1, Figure 1 As shown, the difference is:

[0124] Constructing legal datasets; including:

[0125] Legal intelligent assisted review is carried out based on superior laws and relevant local regulations and departmental rules to verify whether there are conflicts between laws and regulations or whether there is information retrieval beyond the scope.

[0126] Due to the current scarcity of Chinese-language legal data, we independently constructed a legal dataset with the assistance of legal experts. This dataset covers 200 laws, covering areas such as transportation, administration, environmental protection, and electricity, ensuring both universality and professionalism. We also annotated and tagged each entry with its relationship and type, laying a solid foundation for subsequent model training and result evaluation.

[0127] We sorted out 16,121 items of existing laws in my country as research objects, including the chapters on legal responsibilities in the laws. The scope of the laws includes transportation, administration, environmental protection, electricity and other fields. Each data includes the name of the law, the type of law, the location of the law, and the superior law corresponding to the law. This information can help the model better understand the relationship between the laws.

[0128] A dataset was constructed based on the aforementioned legal entry data to ensure its professionalism and accuracy. This included organizing the legal entry data in the form of a mind map using the Xmind tool, making the data display more intuitive and clear. The mind map was saved in the .xmind format, and the xmindparser library was used to convert the .xmind format into a JSON file. The JSON file was then processed using a recursive traversal algorithm and a conditional filtering algorithm. The filtering conditions were set by traversing all nodes in the tree structure to extract data, and a tag dictionary was constructed based on the provided path and hierarchy.

[0129] Considering the practicality of the invention, the fines item in the legal review was selected as the research focus. To ensure the accuracy and efficiency of text information extraction, the regular matching method was used to match and extract the content related to fines in the legal liability chapter (the Chinese legal dataset, i.e., the legal dataset, contains all chapters. The matching extraction method can extract only the chapters related to fines). The specific matching code is "rs = re.findall(r'fines', law["provision"])";

[0130] The extracted penalty items, i.e., the content involving penalty, are divided into two parts: illegal behavior and penalty measures. Illegal behavior includes the subject, predicate, object, and adjective of the behavior; penalty measures include the target of penalty, scope of penalty, and management unit. In addition, since laws include multiple types such as transportation, administration, environmental protection, and electricity, different types of laws have different professional terms. Therefore, the legal type is introduced as a trigger word according to the different types of penalty items to determine whether the behaviors described by the upper and lower laws belong to the same legal type. The content of the penalty items is well labeled with relationships and types to lay a good foundation for subsequent model training and result judgment, and to construct a generated legal dataset.

[0131] Classify and locate legal datasets to meet the needs of scenarios with both overlapping and non-overlapping entities; including:

[0132] To accurately locate the word units to be extracted, a combination of sequence labeling and a dual-pointer network is used to classify and locate the word units (i.e., the preprocessed dataset). This determines the positions of the start and end vectors, adapting to different scenarios with overlapping and non-overlapping entities.

[0133] The entity overlapping scenario refers to the intersection of multiple entities, i.e., the entity information to be extracted, and the entity non-overlapping scenario refers to the intersection of multiple entities, i.e., the positions of ...

[0134] In scenarios where entities do not overlap, a sequence labeling method is used, including the use of the BIO tagging system to locate entities. The BIO tagging system includes [B-], [I-], and [-O], where [B-] represents the starting word of the entity, [I-] means the word at that position is in the middle of the entity, and [-O] indicates that the word does not belong to a specific entity. In this way, each word can be labeled as the starting, internal, and non-entity position of the entity. This method can quickly define the entity range, which is efficient and concise.

[0135] In the case of overlapping entities, using a dual-pointer network, sequence labeling cannot effectively represent the cross-relationships between multiple entities. Therefore, a dual-pointer network is introduced. The start and end vector positions of the entities are marked respectively by a start pointer and an end pointer. This method can construct multi-head tasks and construct multiple entities simultaneously, effectively solving the problem of entity overlap. The formula for locating the start and end pointers of the pointer network is:

[0136]

[0137] Among them, i represents the word at the i-th position, s start represents the score corresponding to the starting position of the entity, j represents the word at the jth position, s end Indicates the score corresponding to the end position of the entity, P start (i|x) represents the probability of the i-th position being the starting position, Pend (i|x) represents the probability of the i-th position being the end position; after calculating the probabilities of the starting and ending positions, the word unit is located according to the probabilities of the starting and ending positions;

[0138] When marking the positions of the start and end vectors, it is necessary to first judge the entity overlap, and then use an adaptive recognition mechanism to select different vector positioning methods for different overlapping situations, so that the system can dynamically adjust the labeling strategy according to the characteristics of the input data, that is, the legal data set. This method mainly focuses on the implementation of the guidance model; the model automatically identifies the entity boundaries and associations through context analysis, enhances the connection relationship between entities, and accurately captures the input features; at the same time, the dynamic results are dynamically adjusted to ensure that the start and end labels, that is, the position positioning of the entity information, are strictly aligned with the input features, to avoid the offset and error of the extraction results caused by the wrong position; through this method, the text features are fully captured, laying the foundation for efficient information extraction.

[0139] Structural processing is performed on the classified and located legal dataset to obtain structured text, including:

[0140] In order to quickly locate the type of information to be extracted, a structured pattern director S = [s1, s2, s3…] is used, which includes all pattern structures. The main task is to select the extracted information based on the pattern of the prompt mechanism; the information types included in the pattern structure, namely entities, relations and events, are combined with the text in the legal dataset; the pattern structure helps the model enhance its dependency on the input text by specifying the extraction task; the "[prompt] + [text]" format is used as input to the unified information extraction framework to linearly output the prediction result, as shown below:

[0141]

[0142] Where s represents the required pattern structure, i.e., the information type; x represents the text content of the legal dataset; y represents the extracted structured text; and UIE represents the Unified Information Extraction Framework. Indicates combined processing; the overall structured representation is:

[0143]

[0144] where s i represents the i-th pattern structure element, x i Represents the content corresponding to the i-th text; after summarizing the above formula, we get:

[0145]

[0146] Among them, text represents each data in the legal dataset, x|x| Indicates the content corresponding to the xth text.

[0147] Construct an enhanced pre-training model; input the structured text obtained in step 2 into the enhanced pre-training model for training to obtain a unified information extraction model; Figure 3 Shown, including:

[0148] The enhanced pre-trained model (ERNIE3.0) includes a general processing module, a special task module, and an embedding layer;

[0149] The general processing module includes a multi-layer Transformer encoder. The Transformer encoder serves as the backbone network to extract semantic features and is shared by all tasks. By introducing this general module, the model can effectively process lexical and syntactic information in the data and gain a deeper understanding of the semantic structure of the model.

[0150] The special task module includes a natural language understanding module, which includes a multi-layer Transformer encoder for semantic understanding;

[0151] The Transformer encoder consists of multiple layers of stacked encoding modules, each of which includes a self-attention mechanism, a feedforward neural network, layer normalization, and a residual connection.

[0152] Among them, the self-attention mechanism includes a simplified linear attention mechanism and depth-wise separable convolution, which are used to capture global dependencies in the input sequence. The feedforward neural network is responsible for feature transformation. Layer normalization and residual connections help to stabilize gradients and optimize training. The entire Transformer encoder processes input through word embedding and position encoding, and outputs high-dimensional context representation.

[0153] Structured text is mapped into vector representations at the embedding layer. The vector representations include word embeddings, position embeddings, and paragraph embeddings. These embeddings are summed to generate a sequence vector, which is then fed into the Transformer encoder in the general processing module. Semantic features are extracted using the Transformer encoder in the natural language understanding module, and these features are then fed into the Transformer encoder in the natural language understanding module for semantic understanding.

[0154] The self-attention mechanism is used to capture the correlation between the word units, that is, the vectors obtained by the embedding layer for each data in the legal dataset, and to generate context-aware representations by weighted aggregation of information from different word units. Unlike the traditional encoder self-attention mechanism that only uses the Softmax function, this paper adopts a simplified linear attention mechanism and replaces the Softmax function with the ReLU activation function, as shown below:

[0155] Sim SLA (Q i ,K j )=ReLU(Q i )·ReLU(K j ) T ;

[0156] Among them, Sim SLA represents the attention weight, Q i represents the query vector in the i-th attention mechanism, K j Represents the key vector in the jth attention mechanism, representing the key values of all elements; at the same time, the depth-wise separable convolution method is used to enhance the ability to extract local features, splitting the standard convolution into depth-wise convolution and point-wise convolution. The depth-wise convolution performs K*K convolution independently on each input channel without cross-channel calculation, while the point-wise convolution uses 1*1 convolution to fuse channel information. The complete self-attention mechanism output formula is:

[0157]

[0158] Among them, Sim SLA represents the attention weight, represents the original output obtained by simplifying the linear attention calculation, N represents the number of all elements involved, O SLA Represents the final output of the self-attention mechanism, V j Denotes the j-th value vector, and DWC(V) denotes the result of depthwise separable convolution of the value vector. This method decomposes the convolution operation into channel-independent convolutions, which greatly reduces the computational complexity and simplifies the computational process, while also effectively capturing the local contextual relationship of the input data. The output of each layer of the Transformer encoder updates the semantic representation of the word, allowing it to integrate more semantic information layer by layer, and ultimately captures the contextual information contained in each word through a multi-layer Transformer encoder. After multiple rounds of iterative calculations, each word obtained not only reflects the individual meaning of the word, but also contains its complex relationship with other surrounding words, enhancing the ability to understand the relationship between words, thereby being more conducive to intelligent analysis and processing of text, and obtaining a unified information extraction model.

[0159] When training the enhanced pre-trained model, full-word masking is used to mask the structured text; this includes:

[0160] A text conversion method is used to perform dynamic word embedding encoding on each word in the structured text. This involves adding a sentence start [CLS] tag to indicate a sentence pair and a sentence separator [SEP] tag to indicate a separator between sentences, converting each word into a vector between 0 and 1. The mapped vector representation can dynamically change based on the surrounding vocabulary, thereby facilitating the location and identification of word boundaries, and further segmenting the text into units that are more conducive to model understanding. To achieve better segmentation and reorganization between words, unlike the traditional method of masking individual words, a method of masking entire units, that is, words in entire sentences, is used to fully simulate real language habits. This method greatly reduces the noise generated during the text conversion process and provides a more accurate semantic foundation for downstream natural language processing.

[0161] Use a unified information extraction model to extract information from legal data that will be used for conflict detection; Figure 2 Shown, including:

[0162] Use a unified information extraction model to identify and extract key information from legal data to achieve transformation into a structured framework; the unified information extraction model includes entity extraction technology for identifying entities in text, relationship extraction technology for identifying relationships between entities in text, and event extraction technology for detecting events from text;

[0163] Among them, entity extraction technology is used to extract entity information such as the subject, predicate, object, attributive, punishment measures, and management unit described in the legal provisions; relationship extraction technology is used to identify the semantic relationship between different entities and punishment measures; event extraction technology is used to extract the events described in the legal provisions. Through the above three extraction methods, legal data is gradually organized into clear structured data units, achieving information unification.

[0164] The enhanced pre-trained model predicts each word in the legal dataset text to determine whether it corresponds to the content to be extracted. Through text structured processing and multiple rounds of iterative computation, the unified structure of prompt-based information extraction is further clarified, and different semantic roles or attributes need to be determined according to different downstream tasks. For entity extraction technology, the unified information extraction model predicts whether each word belongs to the entity to be extracted, and then performs prompt extraction based on the "[spot][text]" label. For relationship extraction technology, the unified information extraction model predicts the semantic relationship between multiple entities and uses "[spot][asso][spot][text]" for extraction. For event extraction, the unified information extraction model captures event trigger words, event types, and related entity information, and uses "[start-position][asso][spot][text]" to extract events. The output embedding representation of the last layer is passed to the classification layer, which predicts the specific type and entity label of each word, namely the extracted entity, relationship, and event. This approach not only ensures the efficiency of vector representation but also closely integrates the extraction objectives with specific tasks.

[0165] Recombining the entities and relationships extracted from information to form new events; including:

[0166] Based on the above steps, important information in the legal provisions can be extracted. Through this information, the key behaviors and punishment measures stipulated in the legal provisions can be quickly understood, which is conducive to judging the conflict points between superior and subordinate laws. However, the information currently extracted is only simple words, lacking basic semantic structure, and can only perform simple conflict judgments. For complex legal provisions, text conflict judgments based solely on extraction will produce large errors. Therefore, the present invention considers introducing reordering and alignment methods to construct an event recognition model. The core of this method is to reorganize the extracted entities and relationships, and transform disordered or scattered text information into a logical semantic structure.

[0167] The extracted entities and relationships are classified according to the syntactic components of the event description, including action subjects (sub), action predicates (act), action objects (obj), action adverbials (adv), negation words (no_word), event attributives (adj), and event trigger words (trigger_word). Different syntaxes are constructed based on these words to identify and parse events. After determining the syntactic components, the entities are recombined based on various syntactic relations, that is, the relations between the above grammatical words, to construct a multi-entity dependency syntactic structure.

[0168] Due to the different wordings of different legal provisions, some syntactic components may be missing during extraction. Based on this phenomenon, the missing necessary entities need to be supplemented so that the syntactic components can be combined into a complete sentence with a subject. After obtaining the complete syntactic structure, the events described in the two texts, namely the superordinate law and the subordinate law, are compared to see whether they can be determined as an event instance. The corresponding relationship between the events is established based on the context and semantics to ensure that the two events can be aligned. The coreference relationship between the events is to determine whether the two events are an event instance. The formula is as follows:

[0169] event a ={Action a ,P 1a ,P 2a ,...,P na},event b ={Action b ,P 1b ,P 2b ,...,P nb};

[0170] Among them, event a Indicates event a, Action a Indicates the event trigger word in event a, event b Indicates event b, Action b represents the event trigger word in event b, P na The event element representing the existence of event a, P nb Indicates the event elements that exist in event b; if the two event descriptions are the same example, that is:

[0171] event a ∈event_instance k ,event b ∈event_instance k ;

[0172] Among them, event_instance k represents an event instance; then the two events are equivalent to the following relationship:

[0173]

[0174] Among them, PKS represents the key elements in the event; after completing the event alignment, co-reference merging is performed to eliminate redundant information and integrate the same or related event content to simplify the event expression.

[0175] Clean up the newly reassembled events, including:

[0176] When extracting elements, spaces or line breaks are introduced to separate tokens to distinguish event elements. These symbols help the model better understand the elements described in the event and facilitate event alignment and comparison. However, this can lead to errors in conflict judgment. Therefore, after event alignment, data cleaning is performed.

[0177] Replace \r, \n, and \t characters in the text with spaces to remove line breaks and tabs, simplifying the text format. Use the regular expression \s+ to compress multiple adjacent spaces into a single space to optimize text layout and improve readability.

[0178] Regular expressions are used to remove the two sections of content, namely the superordinate and subordinate laws, in the text of the new event, thereby removing the influence of the title on the text similarity calculation; through this process, the data quality is improved, ensuring the accuracy and reliability of the data, which is conducive to improving the model data analysis capabilities.

[0179] Make conflicting judgments about new events after the purge; including:

[0180] New events include the behavioral attributes and punishment attributes involved in the superior and inferior laws;

[0181] For conflict judgment of behavior attributes, including behavior subjects, behavior objects, behavior predicates and behavior adverbials, a semantic vector large model (BAAI General Embedding, BGE) is adopted, including an encoder-decoder structure based on an asymmetric Transformer, in which the encoder part consists of a 12-layer Transformer encoder, which is responsible for generating the embedded vector representation of the input sentence; the decoder part has only one layer of Transformer decoder, which is responsible for further reconstructing the sentence and converting high-dimensional discrete text data into low-dimensional dense vector representation. These vectors can reflect the semantic similarity between texts, making the distance between semantically related events closer in the vector space, thereby providing a reliable basis for the calculation and judgment of the relationship between events; the first paragraph of text, that is, the content query data q of the superordinate method, is encoded into the embedding vector E q ={}, the second paragraph of text, i.e., the content document data p of the lower level method, is encoded as the embedding vector E p ={}, then the interaction between the two texts is expressed as:

[0182]

[0183] Where N represents all vectors in the first paragraph, M represents all vectors in the second paragraph, i represents the i-th vector, and j represents the j-th vector. Fine-grained similarity is calculated using the above formula. After combining different comparison methods, the final relevance score is calculated using the following formula:

[0184] s rank =w1·s dense +w2·s iex +w3·s mul ;

[0185] Among them, w1, w2, w3 represent different weights, s dense Indicates dense vector calculation, s iex Indicates sparse vector calculation, s mul Represents mixed vector calculation; in order to better combine the contextual semantics in the text and make the prediction results more accurate, an error function is introduced as a criterion for judging the accuracy of semantic prediction in the semantic vector model. The error function is defined as follows:

[0186]

[0187] L' * =-p(s inter )·logp(s * );

[0188] Among them, p * represents positive sample data, p' represents negative sample data, τ represents temperature parameter, s * Represents the score of the retrieval method, s(q,p) represents the similarity calculation function of two texts, q represents the text vector, L s (s) represents the loss in state s, L' * represents the corrected loss function, s inter Represents the probability distribution of a certain state during the model operation process; the error function is finally obtained:

[0189]

[0190] Among them, L represents the loss function in the general state, and L' represents the corrected loss function;

[0191] Through the correlation score, the model can have a very high semantic understanding ability when facing different text contents. At the same time, it can calculate the similarity between two texts based on their semantics, thereby determining the relationship between the two texts. This includes setting a similarity threshold of 0.9. If the correlation score of the two texts is higher than the threshold of 0.9, it means that there is an implication relationship between the two. Otherwise, it means that there is no direct relationship between the two, and the events described by the hierarchical structure are inconsistent, thus judging that there is a conflict in the content of the behavior involved in the hierarchical structure.

[0192] For conflict judgments involving penalty attributes in legal provisions, including penalty targets, penalty scopes, and management units, a conflict detection algorithm is used to determine whether the polarity parameters of penalty amounts, penalty targets, penalty scopes, and management units in the superior and subordinate laws are consistent, including:

[0193] If the two texts have the same polarity parameter, the penalty attributes of the two texts involving the polarity parameter are compared. For the penalty amount, the comparison is whether the penalty amount range stipulated by the superior law includes the penalty amount of the inferior law. If the penalty amount of the inferior law is inconsistent with the superior law, the two are in conflict.

[0194] Regarding the objects of punishment, compare whether the objects of punishment stipulated in the superior law are also covered in the inferior law. If the inferior law lacks a certain object of punishment, then the two are in conflict.

[0195] Regarding the scope of punishment, compare whether there are any punishment measures in the lower-level law that are not mentioned in the higher-level law. If so, it means that the lower-level law has added content without authorization, and the two laws conflict.

[0196] For management units, compare whether there is a superior-subordinate relationship between the management units stipulated in the superior law and the management units stipulated in the inferior law, that is, whether the management department mentioned in the superior law is responsible for directing the management department mentioned in the inferior law. If they are inconsistent, there is a conflict between the two.

[0197] If the polarity parameters in the two texts are inconsistent, it directly indicates that there is a conflict between the two; this method can efficiently detect the conflict points in the upper and lower methods.

[0198] To ensure the generalization and robustness of the model, a cross-validation was performed on the legal and regulatory dataset. The dataset was divided into 10 mutually exclusive subsets. In each iteration, one subset was used as the validation set, and the remaining 9 subsets were used as the training set. After 10 cycles, the average performance indicators of the model were evaluated. In order to comprehensively evaluate the model effect, a confusion matrix was used as a visualization tool for the results. The confusion matrix can be used to analyze the output of the classification model. By comparing the predicted values with the actual values, it can clearly reflect the performance of the model in different categories. Among them, the rows of the matrix represent the predicted categories of the model, and the columns of the matrix represent the actual categories of the data. The matrix definition is shown in the following table:

[0199] Table 1

[0200]

[0201] Table 1 contains four classification results. TP (True Positive) indicates the number of samples whose true category is positive and correctly predicted as positive by the model; FN (False Negative) indicates the number of samples whose true category is positive but incorrectly predicted as negative by the model; FP (False Positive) indicates the number of samples whose true category is negative but incorrectly predicted as positive by the model; and TN (True Negative) indicates the number of samples whose true category is negative and correctly predicted as negative by the model. Based on these classification results, the accuracy of the model prediction can be further calculated. (FP+TP) indicates the number of samples in the correctly predicted dataset, and (FN+TN) indicates the number of samples in the incorrectly predicted dataset. Based on the above classification, the following indicators are defined:

[0202]

[0203] Among them, Precision stands for accuracy, which indicates the proportion of all instances predicted by the model as positive samples that are actually positive samples; Recall stands for recall, which indicates the proportion of all instances that are actually positive samples that are correctly predicted by the model as positive samples; Accuracy stands for accuracy, which can measure the proportion of correct predictions made by the model among all samples; F1-score is the harmonic mean of precision and recall, which is used as a common comprehensive indicator in classification tasks. When it is 1, it indicates the best model performance; when it is 0, it indicates the worst model performance.

[0204] During data processing, k-fold cross-validation is used to reduce evaluation bias and improve the reliability of results. The dataset is divided into k subsets of similar size. Each time, over k iterations, one of the subsets is selected as the validation set, and the remaining k-1 subsets are used as the training set. This ensures that every data point has an opportunity to be used for validation. In each iteration, the model is trained on the training set and its performance is tested on the test set. In this way, performance results are obtained for k different data partitions. The metrics for each evaluation are recorded, and their mean and standard deviation are calculated to determine the accuracy and stability of the model. This multiple validation effectively avoids the randomness caused by a single partition of the dataset, preventing overfitting and more accurately reflecting the model's generalization ability.

[0205] Results were obtained by feeding the legal and regulatory dataset into the model for training and validation. Table 2 provides an analysis of the model's performance in identifying different conflict points in legal clauses. Conflicting hierarchical and sub-hierarchical laws are labeled 0, while non-conflicting hierarchical and sub-hierarchical laws are labeled 1. The prediction results of this experiment are shown in Table 2:

[0206] Table 2

[0207]

[0208] As shown in the table above, sub represents the subject of the behavior established in the law. By comparing whether the same behavior object is stipulated in the upper and lower laws at the same time, we can judge whether the two are in conflict; act+obj represents the behavior predicate and object described in the law. They constitute the behavior content stipulated in the law. By comparing the similarity of the behavior content in the law, we can judge whether the behavior stipulated in the upper and lower laws is consistent, and thus make a conflict judgment; preadv represents the behavior adverbial mentioned in the law. Comparing whether the upper and lower laws have the same behavior adverbial can make a more accurate conflict judgment; no_word indicates whether there are negation words in the upper and lower laws at the same time. If the negation words are different, If the range of penalty amounts stipulated in the superior law includes the range of penalty amounts stipulated in the inferior law, it means that the two are in an implication relationship, otherwise they are in conflict; fine_people represents the penalty objects stipulated in the law. By comparing whether the penalty objects are individuals or organizations, the conflict between the superior and inferior laws can be judged more efficiently; fine_department represents the management department involved in the law. If the management departments in the superior and inferior laws have a hierarchical relationship, it means that there is an implication relationship, otherwise they are in conflict.

[0209] Analysis of the results shows that the model's detection accuracy for all seven conflict point categories exceeded 90%, demonstrating excellent generalization. For certain conflict points with significant features and high discrimination, the conflict judgment accuracy reached 100%. Furthermore, the model's overall accuracy, recall, and F1-value averages were 95.61%, 93.98%, and 94.78%, respectively. This significant improvement demonstrates that the information extraction-based text conflict detection method is suitable for conflict detection using the context-sensitive conflict detection method.

[0210] Example 3

[0211] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the legal text conflict detection method based on information extraction described in Example 1 or 2 are implemented.

[0212] Example 4

[0213] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the legal text conflict detection method based on information extraction described in Example 1 or 2 are implemented.

[0214] Example 5

[0215] A legal text conflict detection system based on information extraction, comprising:

[0216] The dataset construction module is configured to: construct a legal dataset; classify and locate the legal dataset to meet the needs of scenarios with overlapping entities and non-overlapping entities;

[0217] The structured processing module is configured to: perform structured processing on the classified and located legal data set to obtain structured text;

[0218] The model training module is configured to: construct an enhanced pre-training model; and input the structured text obtained by the structured processing module into the enhanced pre-training model for training to obtain a unified information extraction model;

[0219] The extraction module is configured to: extract information from legal data to be subjected to conflict detection using a unified information extraction model;

[0220] The combination module is configured to: recombine the entities and relationships obtained from the information extraction to form new events, and clean the recombined new events;

[0221] The conflict judgment module is configured to perform conflict judgment on the new events after cleaning.

Claims

1. A legal text conflict detection method based on information extraction, characterized in that: include: Step 1: Construct a legal dataset; Classify and locate legal datasets to meet the needs of scenarios with overlapping and non-overlapping entities; Step 2: Structural processing is performed on the classified and located legal dataset to obtain structured text; Step 3: Build an enhanced pre-training model; input the structured text obtained in step 2 into the enhanced pre-training model for training to obtain a unified information extraction model; Step 4: Use the unified information extraction model to extract information from the legal data to be used for conflict detection; Step 5: Recombine the entities and relationships obtained from information extraction to form new events, and clean the recombined new events; Step 6: Conduct conflict judgment on the new events after cleaning.

2. The method for detecting legal text conflicts based on information extraction according to claim 1, characterized in that: Constructing legal datasets; including: Organize the legal items in existing laws, including the legal liability sections in the laws. The data of each legal item includes the name of the law, the category of the law, the location of the legal item, and the corresponding superior law of the legal item; Based on the above legal item data, a data set is constructed and the legal item data is organized in the form of a mind map; The regular matching method is used to match and extract the content related to fines in the legal liability chapter; The extracted penalty items, i.e., the content involving penalty, are divided into two parts: illegal behavior and penalty measures. Illegal behavior includes the subject, predicate, object, and attributive of the behavior; penalty measures include the penalty target, penalty scope, and management unit. Based on the different types of penalty items, legal categories are introduced as trigger words to construct a legal dataset. Further preferably, the legal dataset is classified and located to meet the needs of scenarios with overlapping entities and non-overlapping entities; including: The entity overlapping scenario refers to the intersection of multiple entities, i.e., the entity information to be extracted, and the entity non-overlapping scenario refers to the intersection of multiple entities, i.e., the positions of ... In the case of non-overlapping entities, a sequence annotation method is used, including the use of a BIO tagging system to locate the entities. In the case of overlapping entities, a dual-pointer network is used, using a start pointer and an end pointer to mark the start and end vector positions of the entities respectively. The formula for locating the start and end pointers of the pointer network is: Among them, i represents the word at the i-th position, s start represents the score corresponding to the starting position of the entity, j represents the word at the jth position, s end Indicates the score corresponding to the end position of the entity, P start (i|x) represents the probability of the i-th position being the starting position, P end (i|x) represents the probability of the i-th position being the end position; after calculating the probabilities of the starting position and the end position, the word unit is positioned according to the probabilities of the starting position and the end position.

3. The method for detecting legal text conflicts based on information extraction according to claim 2, characterized in that: Structural processing is performed on the classified and located legal dataset to obtain structured text, including: Using the structured pattern director, the information types included in the pattern structure, namely entities, relationships, and events, are combined with the text in the legal dataset; the expression is as follows: Where s represents the required pattern structure, i.e., the information type; x represents the text content of the legal dataset; y represents the extracted structured text; and UIE represents the Unified Information Extraction Framework. Indicates combined processing; the overall structured representation is: where s i represents the i-th pattern structure element, x i Represents the content corresponding to the i-th text; after summarizing the above formula, we get: Among them, text represents each data in the legal dataset, x |x| Indicates the content corresponding to the xth text.

4. The method for detecting legal text conflicts based on information extraction according to claim 3, characterized in that: Build enhanced pre-trained models; The structured text obtained in step 2 is input into the enhanced pre-training model for training to obtain a unified information extraction model; including: The enhanced pre-trained model includes a general processing module, a special task module, and an embedding layer; The general processing module includes a multi-layer Transformer encoder, which serves as the backbone network to extract semantic features; The special task module includes a natural language understanding module, which includes a multi-layer Transformer encoder for semantic understanding; The Transformer encoder consists of multiple layers of stacked encoding modules, each of which includes a self-attention mechanism, a feedforward neural network, layer normalization, and a residual connection. Among them, the self-attention mechanism includes a simplified linear attention mechanism and depth-wise separable convolution to capture the global dependencies in the input sequence, the feedforward neural network is responsible for feature transformation, and layer normalization and residual connections contribute to gradient stabilization and training optimization; Structured text is mapped into vector representations at the embedding layer. The vector representations include word embeddings, position embeddings, and paragraph embeddings. These embeddings are summed to generate a sequence vector, which is then fed into the Transformer encoder in the general processing module. Semantic features are extracted using the Transformer encoder in the natural language understanding module, and these features are then fed into the Transformer encoder in the natural language understanding module for semantic understanding. The self-attention mechanism is used to capture the correlation between the word units, that is, the vectors obtained by the embedding layer for each data in the legal dataset. The context-aware representation is generated by weighted aggregation of information from different word units. A simplified linear attention mechanism is used as follows: Yes SLA (Q i ,K j )=ReLU(Q i )·ReLU(K j ) T ; Among them, Sim SLA represents the attention weight, Q i represents the query vector in the i-th attention mechanism, K j It represents the key vector in the jth attention mechanism, which represents the key values of all elements. At the same time, the depth-wise separable convolution method is used to enhance the ability to extract local features. The complete self-attention mechanism output formula is: Among them, Sim SLA represents the attention weight, represents the original output obtained by simplifying the linear attention calculation, N represents the number of all elements involved, O SLA Represents the final output of the self-attention mechanism, V j represents the j-th value vector, and DWC(V) represents the result of depthwise separable convolution of the value vector. Finally, a multi-layer Transformer encoder is used to capture the contextual information contained in each word. After multiple rounds of iterative calculations, a unified information extraction model is obtained. Further preferably, when the enhanced pre-training model is trained, whole-word masking is used to mask the structured text; including: The text conversion method is used to perform dynamic word embedding encoding on each word in the structured text, including adding a sentence start marker representing a sentence pair and a marker representing a separator between sentences in the sentence in the structured text, so that each word is converted into a vector based on 0 to 1.

5. The method for detecting legal text conflicts based on information extraction according to claim 1, characterized in that: Use a unified information extraction model to extract information from legal data for conflict detection; including: Use a unified information extraction model to identify and extract key information from legal data to achieve transformation into a structured framework; the unified information extraction model includes entity extraction technology for identifying entities in text, relationship extraction technology for identifying relationships between entities in text, and event extraction technology for detecting events from text; Among them, entity extraction technology is used to extract entity information such as the subject, predicate, object, attributive, punishment measures and management unit described in the law; relationship extraction technology is used to identify the semantic relationship between different entities and punishment measures; event extraction technology is used to extract events described in the law.

6. The method for detecting legal text conflicts based on information extraction according to claim 5, characterized in that: Recombining the entities and relationships extracted from information to form new events; including: The extracted entities and relations are classified according to the syntactic components of the event description, including action subjects, action predicates, action objects, action adverbials, negation words, event attributives, and event triggers. After the syntactic components are determined, the entities are recombined based on various syntactic relations, that is, the relations between the above grammatical words, to construct a multi-entity dependency syntactic structure. After obtaining the complete syntactic structure, we compare the events described in the two texts, i.e., the superordinate and subordinate terms, to see whether they can be determined as an event instance. The coreference relationship between the events determines whether the two events are an event instance. The formula is as follows: event a ={Action a ,P 1a ,P 2a ,...,P na },event b ={Action b ,P 1b ,P 2b ,...,P nb }; Among them, event a Indicates event a, Action a Indicates the event trigger word in event a, event b Indicates event b, Action b represents the event trigger word in event b, P na The event element representing the existence of event a, P nb Indicates the event elements that exist in event b; if the two event descriptions are the same example, that is: event a ∈event_instance k ,event b ∈event_instance k ; Among them, event_instance k represents an event instance; then the two events are equivalent to the following relationship: Among them, PKS represents the key elements in the event; after completing the event alignment, the coreference merging work is carried out, and the same or related event contents are integrated; Further preferably, the reassembled new events are cleaned, including: Replace the \r, \n, and \t characters in the text with spaces to remove line breaks and tabs; use the regular expression \s+ to compress multiple adjacent spaces into a single space; Regular expressions are used to remove the upper and lower level content in the text, i.e., the new event, thereby removing the influence of the title on the text similarity calculation.

7. The method for detecting legal text conflicts based on information extraction according to claim 6, characterized in that: Make conflicting judgments about new events after the purge; including: New events include the behavioral attributes and punishment attributes involved in the superior and inferior laws; For the conflict judgment of behavior attributes, including behavior subject, behavior object, behavior predicate and behavior adverbial, a semantic vector model is used to convert high-dimensional discrete text data into low-dimensional dense vector representation, and the first paragraph of text, i.e., the content query data q of the superordinate law, is encoded into an embedding vector E q ={}, the second paragraph of text, i.e., the content document data p of the lower level method, is encoded as the embedding vector E p ={}, then the interaction between the two texts is expressed as: Where N represents all vectors in the first paragraph, M represents all vectors in the second paragraph, i represents the i-th vector, and j represents the j-th vector. The final relevance score is calculated by combining different comparison methods. The formula is as follows: s rank =w1·s dense +w2·s iex +w3·s mul ; Among them, w1, w2, w3 represent different weights, s dense Indicates dense vector calculation, s iex Indicates sparse vector calculation, s mul Represents mixed vector calculation; an error function is introduced as a criterion for judging the accuracy of semantic prediction in the semantic vector model. The error function is defined as follows: L' * =-p(s inter )·logp(s * ); Among them, p * represents positive sample data, p' represents negative sample data, τ represents temperature parameter, s * Represents the score of the retrieval method, s(q,p) represents the similarity calculation function of two texts, q represents the text vector, L s (s) represents the loss in state s, L' * represents the corrected loss function, s inter Represents the probability distribution of a certain state during the model operation process; the error function is finally obtained: Among them, L represents the loss function in the general state, and L' represents the corrected loss function; The relationship between two texts is determined by correlation scores. This includes setting a similarity threshold. If the correlation score of the two texts is higher than the threshold, it indicates that the two texts are implied. Otherwise, it indicates that there is no direct relationship between the two texts, and the events described in the context of the context are inconsistent, thus determining that there is a conflict in the content of the behavior involved in the context of the context. Further preferably, for conflict judgment involving penalty attributes in legal provisions, including penalty objects, penalty scope, and management units, a conflict detection algorithm is used to determine whether the polarity parameters such as penalty amount, penalty object, penalty scope, and management unit in the upper and lower laws are consistent, including: If the two texts have the same polarity parameter, the penalty attributes of the two texts involving the polarity parameter are compared. For the penalty amount, the comparison is whether the penalty amount range stipulated by the superior law includes the penalty amount of the inferior law. If the penalty amount of the inferior law is inconsistent with the superior law, the two are in conflict. Regarding the objects of punishment, compare whether the objects of punishment stipulated in the superior law are also covered in the inferior law. If the inferior law lacks a certain object of punishment, then the two are in conflict. Regarding the scope of punishment, compare whether there are any punishment measures in the lower-level law that are not mentioned in the higher-level law. If so, it means that the lower-level law has added content without authorization, and the two laws conflict. For management units, compare whether there is a superior-subordinate relationship between the management units stipulated in the superior law and the management units stipulated in the inferior law, that is, whether the management department mentioned in the superior law is responsible for directing the management department mentioned in the inferior law. If they are inconsistent, there is a conflict between the two. If the polarity parameters in the two texts are inconsistent, it directly indicates that there is a conflict between the two.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the legal text conflict detection method based on information extraction according to any one of claims 1 to 7 are implemented.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the legal text conflict detection method based on information extraction according to any one of claims 1 to 7 are implemented.

10. A legal text conflict detection system based on information extraction, characterized in that: include: The dataset construction module is configured to: construct a legal dataset; Classify and locate legal datasets to meet the needs of scenarios with overlapping and non-overlapping entities; The structured processing module is configured to: perform structured processing on the classified and located legal data set to obtain structured text; The model training module is configured to: construct an enhanced pre-training model; and input the structured text obtained by the structured processing module into the enhanced pre-training model for training to obtain a unified information extraction model; The extraction module is configured to: extract information from legal data to be subjected to conflict detection using a unified information extraction model; The combination module is configured to: recombine the entities and relationships obtained from the information extraction to form new events, and clean the recombined new events; The conflict judgment module is configured to perform conflict judgment on the new events after cleaning.

Citation Information

Cited By

  • Intelligent interaction method and system based on legal consultation

    CN120821838A

  • Conflict-aware legal case judgment prediction method and system

    CN121235859A