Intelligent processing system for small sample enhancement training of legal text
By constructing a dynamic hierarchical term replacement knowledge base and a multi-level evaluation mechanism, the problems of professionalism and logical violation in data augmentation in small-sample scenarios of legal texts are solved, achieving logical rigor and semantic coherence in efficient legal text data processing, and improving the generalization ability of the model.
Patent Information
- Application Number
- CN202510886121.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2045-06-30
AI Technical Summary
Existing technologies cannot balance professionalism and rigor in scenarios with small samples of legal texts, resulting in the disruption of legal logic during data augmentation and insufficient model generalization ability.
A dynamic hierarchical term replacement knowledge base is constructed, including a basic synonym library, a context adaptation library, and an extended explanation library. Text enhancement and evaluation are performed by combining NLP, FastText, BERT, and knowledge graphs, and the system is optimized through review by legal experts.
It enhances the professionalism and logical rigor of legal text data, improves the model's generalization ability under small sample training, and is applicable to fields such as intellectual property law and financial securities law.
Smart Images

Figure CN120706434B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to the technical field of intelligent processing of legal texts, in particular to an intelligent processing system for small sample enhancement training of legal texts. BACKGROUND
[0002] Legal texts have highly professional and detailed field division characteristics. Taking intellectual property law, financial securities law and other subdivided fields as examples, each of them has a unique term system and logical architecture. Large-scale labeling requires the participation of legal experts, and the labor cost is 5-8 times that of general fields. Therefore, it takes a lot of manpower, time and economic cost to obtain large-scale labeled data. In the prior art, legal text processing in a small sample scenario usually uses general data enhancement technology. When data enhancement is performed, the general data enhancement technology is directly applied to legal texts, which cannot take into account the professionalism and rigor of legal texts. Simple word replacement can easily destroy the logical relationship and legal properties of legal texts, for example, "treaty fault liability" is replaced as "breach of contract", which leads to a qualitative change in legal relationship, and it is difficult to generate high-quality enhanced data, which causes the model to have insufficient generalization ability in small sample training and cannot effectively learn the characteristics of legal texts.
[0003] Therefore, we improve it and propose an intelligent processing system for small sample enhancement training of legal texts. SUMMARY
[0004] The application provides the following technical solutions:
[0005] The application is specifically as follows:
[0006] An intelligent processing system for small sample enhancement training of legal texts, comprising a knowledge base module, a data enhancement module and a data quality evaluation module.
[0007] The knowledge base module is used to construct a dynamic hierarchical term replacement knowledge base and provide a term replacement candidate set to the data enhancement module, and receives feedback from the data quality evaluation module to update the knowledge base, including a basic synonym library, a context adaptation library and an expanded explanation library. The basic synonym library stores standardized legal terms and their synonym relationship pairs, and is constructed based on co-occurrence frequency and authoritative dictionaries. The context adaptation library constructs a term-scene mapping matrix based on a legal scene classification model, and provides scene-specific adapted terms. The expanded explanation library stores the hyponym-hypernym relationship and logical rules of legal concepts in the form of a knowledge graph.
[0008] The data enhancement module performs text enhancement operations based on the term library of the knowledge base module, and is used for term replacement, redundancy deletion and fragment insertion of legal texts, and sends the enhanced results to the data quality evaluation module, including a text replacement unit, a text deletion unit and a text insertion unit.
[0009] Data quality evaluation module: used for legal property, logical consistency and semantic coherence evaluation of enhanced text, and feedback of controversial cases to knowledge base module to optimize system performance, including automatic checking unit, classification sampling unit, manual review unit and feedback optimization unit;
[0010] The classification sampling unit samples the enhanced text according to the automatic checking result, and The text with a logical verification confidence of less than 60% is sampled at a sampling ratio of 60% by a random number generation algorithm, and the sampled text is sent to the manual review unit, wherein the logical verification confidence is generated by a legal knowledge graph logical verification algorithm.
[0011] The manual review unit pushes the sampled text to a legal expert labeling interface, and the expert compares the original text and the enhanced text through a visual interface, fills in the review opinion and labels the dispute type, and the manual review unit automatically records the review opinion and the dispute type and stores them in the dispute case library.
[0012] The feedback optimization unit dynamically updates the knowledge base through the following mechanism: when the number of cases in the dispute case library with the same term replacement leading to changes in legal properties is greater than or equal to 5, the scene mapping matrix of the context adaptation library is automatically triggered for retraining, the legal element features in the logically contradictory cases are extracted, new knowledge graph verification rules are generated and added to the extended explanation library.
[0013] The basic synonym library is as follows:
[0014] Standardized legal terms and official definitions are extracted from various authoritative dictionaries, and more than 100,000 pieces of judicial documents are crawled from the China Judgments Document Network, the terms and context are extracted through OCR technology, the unstructured content in the judicial documents is removed, the same term meaning sentence is matched using regular expressions, the synonym relationship pairs are preliminarily extracted, based on the synonym relationship list in the Legal Term Specification, the candidate synonym pairs are matched in batches through regular expressions, for the term pairs not explicitly included, the co-occurrence frequency in the judicial documents is calculated, and the number of occurrences is greater than or equal to 10 times is considered as a potential synonym, a sliding window method is used, the window size is set to 50 words, the co-occurrence frequency of the term pair is counted, a co-occurrence matrix is generated, and a synonym confidence threshold is set: the term pair with a co-occurrence frequency greater than or equal to 50 times and a co-occurrence probability greater than 0.8 is included in the basic synonym library, the NPC Standing Committee Bulletin is regularly crawled, the terms in the newly added or revised legal provisions are identified, and the terms are added to the synonym library after manual review, the feedback of legal experts on the term replacement results is collected, and if a synonym pair is marked as "logical contradiction" for more than or equal to 3 times, it is removed from the library or marked as a risk level; wherein the unstructured content includes punctuation errors and format disorder paragraphs;
[0015] The context adaptation library is as follows:
[0016] Collect 100,000+ contract texts, judgment books, and mark scene tags by domain. 20,000 texts are annotated by legal experts. Use jieba word segmentation tool to segment the text, remove stop words, and generate a scene-text mapping table. Extract bag-of-words features, TF-IDF features, and syntax features from the text. Construct a legal scene feature vector, including domain keywords and term frequency. Divide the training set, validation set, and test set in a ratio of 8:1:1. Train the LSTM-CRF model with a hidden layer dimension of 256, a learning rate of 0.001, and 50 iterations. Adjust the dropout rate based on the validation set to avoid overfitting. Set the dropout rate to 0.3. The scene classification accuracy on the test set must be ≥90%. Otherwise, adjust the features or hyperparameters. For each scene, use the attention mechanism to calculate the scene relevance score of the terms. A higher weight indicates greater importance. Extract the top 100 terms in each scene to form a set of scene key terms. Construct a mapping matrix with row dimensions of legal scenes and column dimensions of terms. The matrix value is the probability of the term appearing in the corresponding scene. The matrix value is calculated by weighting TF-IDF and scene frequency. When the probability of a term in a scene is ≥0.2, it is marked as an adaptive term for that scene. Train the LSTM-CRF model using an 8:1:1 ratio to divide the training set, validation set, and test set. Train the LSTM-CRF model with the following parameter combination optimized based on cross-validation: hidden layer dimension 256 to balance model capacity and training efficiency, learning rate 0.001 to avoid gradient explosion, and scene classification accuracy on the test set stable ≥90% after 50 iterations.
[0017] The expanded explanation library is as follows:
[0018] Define entity types: legal subjects, legal actions, legal consequences, and legal concepts. Define relationship types: hierarchical relationships, causal relationships, and rights and obligations relationships. Extract entity relationship pairs from legal texts and judicial interpretations. Use Neo4j graph database to store the knowledge graph. Nodes include entity names, definitions, and domain tags. Edges include relationship types and confidence. Determine through expert review. For abstract legal concepts, traverse all subordinate concepts through the knowledge graph, extract key elements of subordinate concepts, and generate a concrete expression framework. Based on the template filling method, combine the definition framework of the abstract concept with the terms in the basic synonym library. Perform syntax correctness verification on the generated expression to ensure smooth semantics. Update the knowledge graph annually. Add concepts in newly enacted laws. Establish their hierarchical relationships through expert review. If a concrete expression is marked as "semantic ambiguity" after being inserted into the text by human review, update the subordinate relationships of the concept in the graph and supplement more limiting elements.
[0019] The specific steps of the text replacement unit are as follows:
[0020] SA1, start;
[0021] SA2, input legal text, use NLP technology to perform part-of-speech tagging, syntactic analysis and semantic role labeling on the input legal text;
[0022] SA3, based on the syntactic structure position and semantic function of the word, determine whether the word is a non-core legal relationship node, if yes, retrieve candidate terms based on the basic synonym library and context adaptation library, if not, proceed to step SA4, wherein the non-core legal relationship node is a term that does not directly affect the legal subject, right and obligation relationship;
[0023] SA4, use FastText legal attribute multi-classification model to detect legal attribute changes and determine , if , proceed to SA5, if , cancel the replacement and record the exception, and at the same time, feed back the exception case to the knowledge base module for optimization;
[0024] SA5, based on the logical verification algorithm of the legal knowledge graph, determine whether there is a logical contradiction in the legal subject, right and obligation relationship, and legal fact involved in the text before and after replacement, if not, execute the replacement, if yes, cancel the replacement and record the exception, and at the same time, feed back the exception case to the knowledge base module for optimization;
[0025] SA6, end;
[0026] The text deletion unit has the following specific steps:
[0027] SB1, start;
[0028] SB2, use dependency syntax analysis and rule engine to decompose the text into sentence text, node type, parent node, child node list, information entropy and element contribution degree;
[0029] SB3, construct a logic tree, extract a key element set E={subject, behavior, consequence, time, place, object, other} through a legal element recognition model, and identify redundant branches, wherein the redundant branches include repeated legal principle elaboration and multiple appearances of the same bottom clause explanation;
[0030] SB4, use TF-IDF weighting method to calculate the information entropy of each sentence;
[0031] SB5, calculate the contribution degree based on the proportion of the number of elements in E included in the sentence to the total number of elements, and calculate the legal element contribution degree of the sentence;
[0032] SB6, judge whether the information entropy of the sentence is lower than the average information entropy and the contribution of the legal element is <20%, if not, trigger the manual review process, and determine whether to delete by a legal professional, if yes, compare the topological structure changes of the legal relationship graph before and after deletion, and judge whether the key legal relationship is damaged, if yes, trigger the manual review process, and determine whether to delete by a legal professional, if not, execute the deletion operation, wherein the key legal relationship damage includes the interruption of the rights and obligations connection between subjects and the rupture of the legal fact causal chain, and the average information entropy is the arithmetic mean of the information entropy of all sentences in the text to be processed, and each sentence information entropy is obtained by calculating the TF-IDF weighting method.
[0033] SB7, end.
[0034] The text insertion unit has the following specific steps:
[0035] SC1, start;
[0036] SC2, obtain the candidate segment and the text, retrieve the matching segment from the legal case library, the judicial interpretation library and the typical clause library, construct the OWL ontology model, calculate the concept semantic distance and the relationship path similarity between the text and the candidate segment based on the semantic similarity calculation method of the legal ontology;
[0037] SC3, judge whether the similarity is ≥0.7, if not, enter the manual review, judge the similarity of the candidate segment and the text by a legal professional, and modify the candidate segment, if yes, the candidate segment is;
[0038] SC4, calculate the coherence score of the text before and after the insertion position by using the BERT language model, the formula is: , wherein ti is the i-th word in the text, Score(ti, ti+1) is the semantic correlation score of adjacent words, and k is the number of text words;
[0039] SC5, judge whether the score is <0.8, if yes, adjust the insertion position or select a new segment, if not, enter the manual review, adjust the insertion position or select a new segment by a legal professional, after insertion, perform the legal logic verification again, check whether there is a contradiction in the legal fact causal chain by the knowledge graph, if there is a contradiction, perform manual correction, and the legal professional modifies the inserted text based on the text before and after the insertion position;
[0040] SC6, end.
[0041] The automatic verification unit is as follows:
[0042] SD1, start;
[0043] SD2, legal attribute consistency detection is performed, a FastText multi-classification model is used to calculate the legal attribute probability distribution P of the text before enhancement and P of the text after enhancement, and an attribute change threshold When , a warning is triggered, and manual modification is performed.
[0044] SD3, logic contradiction identification is performed, rules based on a legal knowledge graph are constructed, and a graph traversal algorithm is used to detect whether there is a contradiction in the logic graph, if there is a contradiction in the logic graph, a warning is triggered, and manual modification is performed, wherein the rules for constructing the legal knowledge graph include subject consistency, time logic and right and obligation correspondence.
[0045] SD4, semantic coherence evaluation is performed, a RoBERTa-large model is used to calculate the perplexity, and a syntax tree similarity algorithm is used to compare the dependency syntax structure change rate, when the change rate is greater than 0.4, it is determined that the syntax structure has changed significantly, a semantic coherence warning is triggered, and manual modification is performed.
[0046] SD5, end.
[0047] Compared with the prior art, the beneficial effects of the present application are:
[0048] 1, the basic synonym library ensures the standardization and authority of the term replacement through authoritative dictionaries, judgment documents mining and co-occurrence frequency calculation, realizes the scene accurate matching of term replacement, thereby reducing the problem of qualitative change of legal relationship, the context adaptation library realizes scene classification based on an LSTM-CRF model, extracts scene key terms combined with an attention mechanism, so that the term replacement is more suitable for the field context of the legal text, and the expansion explanation library maintains the abstract-concrete level of the replaced term and the rigor of the legal logic by maintaining the hyponym-hypernym relationship of legal concepts through a knowledge graph.
[0049] 2, the text replacement unit identifies non-core legal relationship nodes through NLP technology, detects legal attribute changes combined with a FastText model, and checks legal subjects, right and obligation relationships and other logic contradictions based on a knowledge graph, thereby reducing the legal logic damage caused by simple word replacement.
[0050] 3, the text deletion unit accurately identifies redundant content through dependency syntax analysis, information entropy and legal element contribution degree calculation, reduces the damage to key legal relationships when deleting, the text insertion unit calculates semantic similarity based on an OWL ontology model, evaluates coherence combined with a BERT model, ensures that the inserted segment is consistent with the original text logic, and at the same time, checks the contradiction of the cause-effect chain through a knowledge graph, thereby improving the rationality of data enhancement.
[0051] 4、Automatic checking unit detects legal attribute consistency through FastText, identifies logical contradictions through knowledge graph, and evaluates semantic coherence through RoBERTa-large model to realize enhanced quality control of text. The classification sampling unit samples high-risk text at a ratio of 60%, and legal experts review it through a visual interface, record dispute types, and store them in a case library to make up for the limitations of automatic checking. When there are ≥5 cases of the same term replacement leading to changes in legal attributes in the dispute case library, automatically trigger the context adaptation library retraining and generate new knowledge graph checking rules, so that the system can adapt to the dynamic changes of legal texts and continuously improve the quality of data enhancement.
[0052] 5、The generated enhanced data takes into account the legal professionalism and logical rigor, which can effectively help machine learning models learn legal text features and improve the generalization ability under small sample training, and is suitable for legal text processing in subfields such as intellectual property law and financial securities law. BRIEF DESCRIPTION OF DRAWINGS
[0053] Figure 1 The figure is a schematic diagram of the system architecture of the present application;
[0054] Figure 2 The figure is a schematic diagram of the text replacement unit process of the present application;
[0055] Figure 3 The figure is a schematic diagram of the text deletion unit process of the present application;
[0056] Figure 4 The figure is a schematic diagram of the text insertion unit process of the present application;
[0057] Figure 5 The figure is a schematic diagram of the data quality evaluation module process of the present application;
[0058] Figure 6 The figure is a schematic diagram of the automatic checking unit process of the present application;
[0059] Figure 7 The figure is a schematic diagram of the feedback optimization unit process of the present application. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme of the embodiments of the present application will be described in detail below with reference to the drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all embodiments.
[0061] Therefore, the following detailed description of the embodiments of the application is not intended to limit the scope of the application as claimed, but merely represents some embodiments of the application. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the application.
[0062] It should be noted that the embodiments in the application and the features and technical solutions in the embodiments can be combined with each other without conflict.
[0063] It should be noted that: similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0064] In the description of the application, it should be noted that the terms "upper", "lower", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, or the orientation or positional relationship commonly placed when the product of the application is used, or the orientation or positional relationship commonly understood by those skilled in the art. Such terms are only for the convenience of describing the application and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as limiting the application. In addition, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance.
[0065] The application provides the following technical solutions:
[0066] Please refer to Figures 1-7 An intelligent processing system for legal text small sample enhancement training, comprising: a knowledge base module, a data enhancement module, and a data quality evaluation module;
[0067] The knowledge base module is used to construct a dynamic hierarchical term replacement knowledge base, and provides a set of term replacement candidates to the data enhancement module, while receiving feedback from the data quality evaluation module to update the knowledge base, including a basic synonym library, a context adaptation library, and an expanded explanation library. The basic synonym library stores standardized legal terms and their synonym relationship pairs, and is constructed based on co-occurrence frequency and authoritative dictionaries. The context adaptation library constructs a term-scene mapping matrix based on a legal scene classification model, and provides scene-specific adapted terms. The expanded explanation library stores the hyponym-hypernym relationship and logical rules of legal concepts in the form of a knowledge graph.
[0068] Data enhancement module: based on the term library of the knowledge base module, perform text enhancement operations for term replacement, redundancy deletion and fragment insertion of legal texts, and send the enhanced results to the data quality assessment module, including text replacement unit, text deletion unit and text insertion unit; when the text replacement unit needs to retrieve candidate terms, the context adaptation library is queried first to obtain the adaptive term set of the current scene, if there is no suitable term in the context adaptation library, switch to the basic synonym library to check if there is a general synonym across scenes, for the replaced terms, query their hyponym-hypernym relationship through the extended explanation library to ensure that the replacement does not change the abstract-concrete level of legal concepts, after each term replacement, if the quality assessment module finds logical contradictions, automatically feed back the case to the corresponding sub-library: the basic synonym library updates the confidence of the synonym pair, the context adaptation library adjusts the scene probability of the term, and the extended explanation library corrects the relationship path of the knowledge graph.
[0069] Data quality assessment module: used for evaluating the legal properties, logical consistency and semantic coherence of the enhanced text, and feeding back controversial cases to the knowledge base module to optimize system performance, including automatic verification unit, classification sampling unit, manual review unit and feedback optimization unit;
[0070] Among them, the classification sampling unit samples the enhanced text according to the automatic verification results, and and the text with logical verification confidence <60% is sampled by random number generation algorithm at a sampling ratio of 60%, and the sampled text is sent to the manual review unit, wherein the logical verification confidence is generated by the legal knowledge graph logical verification algorithm;
[0071] The manual review unit pushes the sampled samples to the legal expert labeling interface, and the experts view the original text and the enhanced text through the visual interface, fill in the review opinions and mark the dispute types after comparing the original text and the enhanced text, and the manual review unit automatically records the review opinions and the dispute types and stores them in the dispute case library;
[0072] The feedback optimization unit dynamically updates the knowledge base through the following mechanism: when the number of cases in the dispute case library where the same term replacement leads to changes in legal properties is ≥5, automatically trigger the scene mapping matrix retraining of the context adaptation library, extract the legal element features in the logical contradiction cases, generate new knowledge graph verification rules and add them to the extended explanation library.
[0073] The basic synonym library is as follows:
[0074] Standardized legal terms and official definitions are extracted from various authoritative dictionaries. 100,000+ judicial documents are crawled from the China Judgments Document Network. The terms and context are extracted through OCR technology. Unstructured content is removed from the judicial documents. Regular expression is used to match the same term meaning sentence. The synonymous relationship pairs are preliminarily extracted. Based on the synonymous relationship list in the Legal Term Specification, the candidate synonymous pairs are matched by regular expression. For terms not explicitly included, the co-occurrence frequency in the judicial documents is calculated. If the number of occurrences is greater than or equal to 10, it is considered a potential synonym. A sliding window method is used with a window size of 50 words. The co-occurrence frequency of the term pair is counted. A co-occurrence matrix is generated. Set the synonym confidence threshold: co-occurrence frequency greater than or equal to 50 times and co-occurrence probability greater than 0.8. The term pair is included in the basic synonym library. Regularly crawl the NPC News Bulletin to identify new or revised legal terms. After manual review, add to the synonym library. Collect feedback from legal experts on term replacement results. If a synonymous pair is marked as "logical contradiction" more than 3 times, it is removed from the library or marked as a risk level. Unstructured content includes punctuation errors, format chaos paragraphs.
[0075] The context adaptation library is as follows:
[0076] Collect 100,000+ contract texts and judgments. Label the scene tags by domain. Label 20,000 texts by legal experts. Use jieba segmentation tool to segment the text. Remove stop words. Generate a scene-text mapping table. Extract bag-of-words features, TF-IDF features, and syntax features. Construct legal scene feature vectors, including domain keywords and term frequencies. Divide the training set, validation set, and test set in a ratio of 8:1:1. Train the LSTM-CRF model. Set the hidden layer dimension to 256. The learning rate is 0.001. The number of iterations is 50. Adjust the dropout rate through the validation set to avoid overfitting. Set the dropout rate to 0.3. The scene classification accuracy of the model on the test set must be greater than or equal to 90%. Otherwise, adjust the features or hyperparameters. For each scene, use the attention mechanism to calculate the scene relevance score of the term. A higher weight indicates greater importance. Extract the top 100 terms in each scene to form a scene key term set. Construct a mapping matrix with row dimension legal scene and column dimension term. The matrix value is the probability of the term appearing in the corresponding scene. The matrix value is calculated by weighting TF-IDF and scene frequency. When the probability of a term in a scene is greater than or equal to 0.2, it is marked as an adaptive term for that scene.
[0077] The extended explanation library is as follows:
[0078] The entity types are defined: legal subjects, legal acts, legal consequences and legal concepts, the relationship types are defined: hierarchical relationship, causal relationship and right and obligation relationship, the entity relationship pairs are extracted from legal provisions and judicial interpretations, the knowledge graph is stored using a Neo4j graph database, the nodes include entity names, definitions, field tags, the edges include relationship types and confidence, and the determination is made through expert review, for abstract legal concepts, all subordinate concepts are traversed through the knowledge graph, the key elements of the subordinate concepts are extracted, the concretized expression framework is generated, the definition framework of the abstract concept is combined with the terms in the basic synonym library based on the template filling method, the generated expression is checked for syntactic correctness to ensure semantic fluency, the knowledge graph is updated annually, the concepts in newly enacted laws are added, the superior and subordinate relationships of the concepts are established through expert review, if a concretized expression is marked as “semantic ambiguity” after being inserted into the text by manual review, the subordinate relationships of the concept in the graph are updated, and more limiting elements are supplemented.
[0079] The specific steps of the text replacement unit are as follows:
[0080] SA1, start;
[0081] SA2, input the legal text, and perform part-of-speech tagging, syntactic analysis and semantic role labeling on the input legal text using NLP technology;
[0082] SA3, based on the grammatical structure position and semantic function of the word, determine whether the word is a non-core legal relationship node, if yes, search for candidate terms based on the basic synonym library and context adaptation library, if not, proceed to step SA4, wherein the non-core legal relationship node is a term that does not directly affect the legal subject, right and obligation relationship;
[0083] SA4, using the legal attribute multi-classification model of FastText to detect legal attribute changes, to determine , if , proceed to SA5, if , cancel the replacement and record the exception, and at the same time, feed back the exception case to the knowledge base module for optimization;
[0084] SA5, based on the logical verification algorithm of the legal knowledge graph, determine whether there is a logical contradiction in the legal subject, right and obligation relationship, and legal fact involved in the text before and after replacement, if not, execute the replacement, if yes, cancel the replacement and record the exception, and at the same time, feed back the exception case to the knowledge base module for optimization;
[0085] SA6, end;
[0086] The specific steps of the text deletion unit are as follows:
[0087] SB1, start;
[0088] SB2, decompose the text into sentence text, node type, parent node, child node list, information entropy, and element contribution using dependency syntax analysis and rule engine;
[0089] SB3, construct a logical tree, extract a key element set E = {subject, behavior, consequence, time, place, object, and other} through a legal element identification model, and identify redundant branches, wherein the redundant branches include repeated legal principle elaboration and multiple occurrences of the same catch-all clause explanation;
[0090] SB4, calculate the information entropy of each sentence using the TF-IDF weighting method;
[0091] SB5, calculate the contribution degree based on the proportion of the number of elements in E included in the sentence to the total number of elements, and calculate the legal element contribution degree of the sentence;
[0092] SB6, determine whether the sentence information entropy is lower than the average information entropy and the legal element contribution degree is <20%, if not, trigger the manual review process, and determine whether to delete by a legal professional, if yes, compare the topological structure changes of the legal relationship graph before and after deletion, and determine whether the key legal relationship is damaged, if yes, trigger the manual review process, and determine whether to delete by a legal professional, if not, execute the deletion operation, wherein the key legal relationship damage includes the interruption of the rights and obligations connection between the subjects and the breaking of the legal fact causality chain, and the average information entropy is the arithmetic mean of the information entropy of all sentences in the text to be processed, and the information entropy of each sentence is calculated by the TF-IDF weighting method.
[0093] SB7, end.
[0094] The specific steps of the text insertion unit are as follows:
[0095] SC1, start;
[0096] SC2, obtain the candidate segment and the text, retrieve the matching segment from the legal case library, judicial interpretation library, and typical clause library, construct the OWL ontology model, calculate the concept semantic distance and relationship path similarity between the text and the candidate segment based on the semantic similarity calculation method of the legal ontology;
[0097] SC3, determine whether the similarity is ≥0.7, if not, enter the manual review, determine the similarity of the candidate segment and the text by a legal professional, and modify the candidate segment, if yes, the candidate segment is;
[0098] SC4, calculate the coherence score of the text before and after the insertion position using the BERT language model, the formula is: wherein, ti is the ith word in the text, Score(ti, ti+1) is the semantic correlation score of adjacent words, k is the number of words in the text;
[0099] SC5, determine whether the score is <0.8, if yes, adjust the insertion position or reselect the fragment, if no, enter manual review, adjust the insertion position or reselect the fragment by legal professionals, after insertion, perform legal logic verification again, check whether there is contradiction in the legal fact causality chain through the knowledge graph, if there is contradiction, perform manual correction, legal professionals modify the text after insertion based on the text before and after the insertion position;
[0100] SC6, end.
[0101] The automatic verification unit is specifically as follows:
[0102] SD1, start;
[0103] SD2, perform legal attribute consistency detection, calculate the legal attribute probability distribution Pbefore and Pafter of the enhanced before and after text using the FastText multi-classification model, and the attribute change threshold is triggered when , perform manual modification;
[0104] SD3, perform logic contradiction identification, construct rules based on the legal knowledge graph, and detect whether there is contradiction in the logic graph through the graph traversal algorithm, if there is contradiction in the logic graph, trigger an early warning, and perform manual modification, wherein the legal knowledge graph construction rules include subject consistency, time logic and right and obligation correspondence;
[0105] SD4, perform semantic coherence evaluation, calculate the perplexity based on the RoBERTa-large model, and compare the dependency syntax structure change rate using the syntax tree similarity algorithm, when the change rate >0.4, determine that the "syntax structure changes significantly", trigger a semantic coherence early warning, and perform manual modification;
[0106] SD5, end.
[0107] Embodiment 1:
[0108] Application scenario: A law firm needs to perform data enhancement on the "breach of contract" clause in a small sample sales contract to train the model to extract the compensation calculation method.
[0109] Specific operation:
[0110] Knowledge base module: The context adaptation library collects more than 100,000 contract texts, annotates "buy-sell contract-dispute responsibility" scenarios by legal experts, extracts key terms such as "penalty" and "compensation for losses", the scenario probability is 0.21, constructs a mapping matrix, and expands the explanation library to maintain the hierarchical relationship of "dispute responsibility", such as "continuing performance" and "taking remedial measures", and generates concrete expressions such as "The defaulting party shall compensate the non-defaulting party for direct losses caused by the defaulting party, including but not limited to …".
[0111] Data enhancement module: The text deletion unit decomposes contract clauses, calculates the information entropy of "dispute resolution" repetitive clauses as 0.51, the average value is 0.55, and the element contribution is 15%<20%, and confirms that the right and obligation connection is not interrupted after deletion. The text replacement unit replaces "force majeure" with "unpredictable, unavoidable and unmanageable objective conditions", and the FastText detection ΔP=0.27, and the knowledge graph verifies the logical consistency of legal facts.
[0112] Data quality evaluation module: The automatic verification unit calculates the change rate as 0.38<0.4 by the syntax tree similarity algorithm, and determines the semantic coherence; the classification sampling unit has ΔP=0.29 for high-risk text, with a confidence of 55%, and samples 60%, and updates the dispute case library after expert review.
[0113] Embodiment 2:
[0114] Application scenario: A securities company needs to enhance the data of the "risk factors" chapter in the small sample prospectus to train the model to identify compliance expressions.
[0115] Specific operation:
[0116] Knowledge base module: The expanded explanation library stores the hierarchical relationship of legal concepts such as "insider trading" and "information disclosure" in the Neo4j graph database, such as the lower-level concept of "illegal disclosure" including "failure to timely disclose major events", and generates a concrete expression framework; The basic synonym library includes the official definition of "The People's Republic of China Securities Law", such as the synonymous pair of "continuous supervision" and "subsequent supervision" with a co-occurrence frequency of 58 times and a co-occurrence probability of 0.82, and regularly crawls the CSRC announcement to update the terms;
[0117] Data enhancement module: The text insertion unit retrieves the "false statement liability" related fragments from the judicial interpretation library, calculates the semantic similarity based on the OWL ontology model 0.72≥0.7, and uses the BERT model to calculate the coherence score 0.85≥0.8, and inserts the text. After the verification of the knowledge graph, the cause-effect chain such as the correspondence between the illegal behavior and the legal consequences, the text replacement unit replaces the non-core terms such as "corporate governance" with "enterprise governance", and the FastText detection ΔP=0.18, and the knowledge graph verification does not appear the contradiction of right and obligation relationship;
[0118] The data quality evaluation module is checked: the automatic checking unit detects that the legal attribute change AP=0.15≤0.3, and the logic atlas is not contradictory; the feedback optimization unit automatically triggers the context adaptation library retraining if it is found that the same term replacement leads to attribute change cases≥5, such as "associated transactions" being replaced by "internal transactions".
[0119] In order to enable personnel in the technical field to better understand the technical solutions in the embodiments of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings.
[0120] It should be noted that, in the case of no conflict, the embodiments in the present application and the features and technical solutions in the embodiments can be combined with each other.
[0121] It should be noted that: similar labels and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0122] The above embodiments are only used to illustrate the present application and not to limit the technical solutions described in the present application. Although the present application has been described in detail with reference to the above embodiments, the present application is not limited to the above specific embodiments, and any modification or equivalent replacement of the present application; all technical solutions and improvements which do not deviate from the spirit and scope of the present application are covered in the scope of claims of the present application.
Claims
1. A legal text small sample enhanced training intelligent processing system, characterized in that, Comprise: knowledge base module, data enhancement module and data quality evaluation module; knowledge base module: used for constructing dynamic hierarchical term replacement knowledge base, and providing term replacement candidate set to data enhancement module, while receiving feedback from data quality evaluation module to update knowledge base, including basic synonym library, context adaptation library and expansion explanation library, basic synonym library stores standardized legal terms and their synonym relationship pairs, and is constructed based on co-occurrence frequency and authoritative dictionary; context adaptation library constructs term-scene mapping matrix based on legal scene classification model, and provides scene-specific adapted terms; expansion explanation library stores upper and lower relationships and logical rules of legal concepts in the form of knowledge graph; data enhancement module: performs text enhancement operation based on the term library of knowledge base module, for term replacement, redundancy deletion and fragment insertion of legal text, and sends the enhancement result to data quality evaluation module, including text replacement unit, text deletion unit and text insertion unit; data quality evaluation module: used for evaluating legal properties, logical consistency and semantic coherence of enhanced text, and feeding back controversial cases to knowledge base module to optimize system performance, including automatic checking unit, classification sampling unit, manual review unit and feedback optimization unit; The specific steps of the text replacement unit are as follows: SA1, start; SA2, input legal text, and perform part-of-speech tagging, syntax analysis and semantic role labeling on the input legal text by using NLP technology; SA3, based on the position of the word in the syntax structure and the semantic function, it is judged whether the word is a non-core legal relationship node, if yes, candidate terms are retrieved based on the basic synonym library and the context adaptation library, if not, step SA4 is performed, wherein the non-core legal relationship node is a term that does not directly affect the legal subject, right and obligation relationship; SA4, using the legal attribute multi-classification model of FastText to determine, detecting the change of legal attribute, determining whether it is less than or equal to 0.3, if , SA5 is performed, if , the replacement is cancelled and an exception is recorded, and the exception case is fed back to the knowledge base module for optimization; SA5, based on the logical verification algorithm of the legal knowledge graph, it is judged whether there is logical contradiction in the legal subject, right and obligation relationship and legal fact involved in the text before and after replacement, if not, the replacement is executed, if yes, the replacement is cancelled and the exception is recorded, and the exception case is fed back to the knowledge base module for optimization; SA6, end; The automatic checking unit is as follows: SD1, start; SD2, legal attribute consistency detection, using FastText multi-classification model to calculate the legal attribute probability distribution of the enhanced text P before enhancement, P after enhancement, attribute change threshold trigger an early warning when artificial modification SD3, perform logical contradiction identification, construct rules based on legal knowledge graph, and detect whether there is contradiction in the logical graph by graph traversal algorithm, if there is contradiction in the logical graph, trigger warning, and perform manual modification, wherein the legal knowledge graph construction rules include subject consistency, time logic and right and obligation correspondence; SD4, perform semantic coherence evaluation, calculate perplexity based on RoBERTa-large model, and compare the change rate of dependency syntax structure by combining syntax tree similarity algorithm, when the change rate>0.4, it is determined that "the syntax structure changes significantly", trigger semantic coherence warning, and perform manual modification; SD5, end.
2. The intelligent processing system for legal text small sample enhancement training according to claim 1, characterized in that the basic synonym library is as follows: Standardized legal terms and official definitions are extracted from various authoritative dictionaries. Judicial documents are crawled from the China Judgments Document Network. The terms and context are extracted through OCR technology. Unstructured content is removed from the judicial documents. Regular expression is used to match the same term meaning and the sentence pattern to preliminarily extract the synonym relationship pairs. Based on the synonym relationship list in the Legal Term Specification, the candidate synonym pairs are matched by regular expression. For terms that are not explicitly included, the co-occurrence frequency in the judicial documents is calculated. If the number of occurrences is greater than or equal to 10, it is considered a potential synonym. A sliding window method is used with a window size of 50 words. The co-occurrence frequency of the term pair is counted to generate a co-occurrence matrix. The synonym confidence threshold is set as follows: co-occurrence frequency greater than or equal to 50 times and co-occurrence probability greater than 0.
8. The term pairs are included in the basic synonym library. The Standing Committee of the National People's Congress Bulletin is regularly crawled to identify new or revised legal terms. After manual review, the terms are added to the synonym library. Feedback on term replacement results is collected from legal experts. If a synonym pair is marked as "logical contradiction" for more than 3 times, it is removed from the library or marked as a risk level. Unstructured content includes punctuation errors, format chaos paragraphs, etc. The context adaptation library is as follows: Contract texts and judgments are collected, and scene labels are marked by domain. Legal experts mark 20,000 texts in scene subcategories. Jieba segmentation tool is used for text segmentation. Stop words are removed to generate a scene-text mapping table. Bag-of-words features, TF-IDF features, and syntax features are extracted. Legal scene feature vectors are constructed, including domain keywords and term frequencies. The training set, validation set, and test set are divided in a ratio of 8:1:
1. The LSTM-CRF model is trained with a hidden layer dimension of 256, a learning rate of 0.001, and 50 iterations. The dropout rate is adjusted to 0.3 to avoid overfitting. The scene classification accuracy of the model on the test set must be greater than or equal to 90%. Otherwise, the features or hyperparameters are adjusted. For each scene, the attention mechanism is used to calculate the scene relevance score of the terms. A higher weight indicates a more critical term. The top 100 terms in each scene are extracted to form a scene key term set. A mapping matrix is constructed with legal scenes as row dimensions, terms as column dimensions, and term appearance probabilities in corresponding scenes as matrix values. The matrix values are calculated by weighting TF-IDF and scene frequency. When the probability of a term in a scene is greater than or equal to 0.2, it is marked as an adapted term for that scene. The extended explanation library is as follows: Definition of entity types: legal subjects, legal acts, legal consequences and legal concepts, definition of relationship types: hierarchical relationship, causal relationship and right and obligation relationship, extract entity relationship pairs from legal texts and judicial interpretations, store knowledge graph in Neo4j graph database, nodes include entity name, definition, domain label, edges include relationship type and confidence, and determine through expert review, for abstract legal concepts, traverse all subordinate concepts through knowledge graph, extract key elements of subordinate concepts, generate concretized expression framework, combine abstract concept definition framework with terms in basic synonym library based on template filling method, perform syntax correctness verification on generated expression to ensure smooth semantics, update knowledge graph every year, add concepts in newly enacted laws, establish their hierarchical relationships through expert review, if a concretized expression is marked as "semantic ambiguity" after being inserted into the text, update the subordinate relationships of the concept in the graph and supplement more limiting elements. 3.The intelligent processing system of legal text small sample reinforcement training according to claim 1, wherein, The text deletion unit has the following specific steps: SB1, start; SB2, adopt dependency syntax analysis and rule engine to decompose the text into sentence text, node type, parent node, child node list, information entropy and element contribution; SB3, construct a logical tree, extract a key element set E={subject, act, consequence, time, place, object, other} through a legal element recognition model, and identify redundant branches, wherein the redundant branches include repeated legal principle elaboration and multiple explanations of the same catch-all clause; SB4, calculate the information entropy of each sentence using the TF-IDF weighting method; SB5, calculate the contribution degree based on the proportion of the number of elements in E included in the sentence to the total number of elements; SB6, judge whether the sentence information entropy is lower than the information entropy average and the legal element contribution degree is <20%, if not, trigger the manual review process, and determine whether to delete by a legal professional, if yes, compare the topological structure changes of the legal relationship graph before and after deletion, and judge whether the key legal relationship is damaged, if yes, trigger the manual review process, and determine whether to delete by a legal professional, if not, execute the deletion operation, wherein the key legal relationship damage includes the interruption of the right and obligation connection between subjects and the breakage of the legal fact causal chain, and the information entropy average is the arithmetic average of the information entropy of all sentences in the text to be processed, which is calculated by the TF-IDF weighting method; SB7, end.
4. The intelligent processing system for small sample enhancement training of legal texts according to claim 1, characterized in that, The text insertion unit has the following specific steps: SC1, start; SC2, obtain the candidate segment and the text, retrieve the matching segment from the legal case library, judicial interpretation library and typical clause library, construct an OWL ontology model, calculate the concept semantic distance and relationship path similarity between the text and the candidate segment based on the semantic similarity calculation method of the legal ontology; SC3, judge whether the similarity is >=0.7, if not, enter the manual review, judge the similarity of the candidate segment and the text by a legal professional, and modify the candidate segment, if yes, the candidate segment is; SC4, the coherence score of the text before and after the insertion position is calculated by using the BERT language model, and the formula is: wherein, ti is the i th word in the text, Score(ti, ti+1) is the semantic correlation score of adjacent words, and k is the number of words in the text. SC5, judge whether the score is <0.8, if yes, adjust the insertion position or reselect the fragment, if no, enter artificial review, adjust the insertion position or reselect the fragment by legal professionals, after insertion, perform legal logic verification again, check whether there is contradiction in the legal fact causality chain through the knowledge graph, if there is contradiction, perform artificial correction, modify the text after insertion by legal professionals based on the context before and after the insertion position; SC6, end.
5. The intelligent processing system for small sample enhancement training of legal texts according to claim 1, wherein the classified sampling unit performs hierarchical sampling on the enhanced texts according to the automatic verification results, and extracts samples from the texts with a logic verification confidence level < 60% at a sampling ratio of 60% through a random number generation algorithm, and sends the extracted samples to the manual review unit. The logic verification confidence is generated by a legal knowledge graph logic verification algorithm. 6. The intelligent processing system for small sample enhancement training of legal texts according to claim 1, characterized in that, The artificial review unit pushes the sampling samples to a legal expert labeling interface, the experts view the original text and the enhanced text through a visual interface, fill in the review opinions and label the dispute types after comparing the original text and the enhanced text, the artificial review unit automatically records the review opinions and the dispute types, and stores them into a dispute case library.
7. The intelligent processing system for small sample enhancement training of legal texts according to claim 1, characterized in that, The feedback optimization unit dynamically updates the knowledge base through the following mechanism: when the number of cases in which the same term replacement leads to changes in legal properties in the dispute case library is ≥5, automatically trigger the scene mapping matrix retraining of the context adaptation library, extract the legal element features in the logical contradiction cases, generate new knowledge graph verification rules and add them to the extended explanation library.
Citation Information
Patent Citations
Intelligent legal text analysis method based on legal concept pedigree
CN119990290A
Text error correction method and apparatus, device, and medium
WO2022105083A1