Attention-based judicial text classification method, device, and storage medium
By optimizing the judicial text classification method through feature word selection and association graph analysis based on the structure of judicial texts, the problem of low accuracy caused by differences in the incidence of different cases was solved, and the identification ability and classification accuracy of small sample cases were improved.
Patent Information
- Application Number
- CN202611292875.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-25
- Publication Date
- 2026-11-10
AI Technical Summary
Existing technologies fail to effectively account for the differences in the incidence of cases across different judicial texts, resulting in low accuracy in text classification.
By filtering feature words based on the structure of judicial texts, generating word vector sequences, performing the first classification using word relationship weights, and performing the second classification by combining the similarity and association graph of the background information vocabulary database, performing bias verification, and optimizing the attention mechanism.
It improves the accuracy of judicial text classification, especially the ability to identify special cases with small samples, and avoids classification bias and overfitting problems caused by insufficient training samples.
Smart Images

Figure CN123068632A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of text classification technology, and in particular to a judicial text classification method, apparatus and storage medium based on an attention mechanism. Background Technology
[0002] Judicial texts possess highly structured stylistic features and rigorous logical argumentation patterns. The contributions of different parts—factual descriptions, points of contention, court reasoning, and the basis for judgment—to classification vary significantly. General attentional weighting is often diluted by high-frequency, formulaic expressions, failing to highlight decisive elements such as the constituent facts and the application of law. Furthermore, judicial texts involve elements of a crime, chains of evidence, and the citation and conflict of legal provisions. The incidence of cases differs considerably across different categories, yet judicial texts involving different judgments often contain many identical or similar expressions, easily confusing text classification. General attentional mechanisms lack the ability to classify such judicial texts, leading to potential discrepancies between attentional distribution and legal professional judgment, thus affecting classification accuracy. Therefore, there is an urgent need to design attentional mechanisms that better suit the characteristics of judicial texts and effectively integrate legal knowledge to improve the accuracy of judicial text classification.
[0003] Chinese Patent Application Publication No. CN112784047A discloses a controllable and interpretable judicial text classification method based on a self-attention mechanism, belonging to the field of natural language processing text classification. This method proposes a Leader model, where the role of each head is manually defined, divided into keyword heads and multi-granularity context heads, achieving macro-level controllability and interpretability. For keyword heads, a self-attention mechanism is used, employing multi-task learning, combining text classification with keyword extraction, allowing the model to controllably focus attention on words that can serve as explanations for the classification, achieving micro-level controllability and interpretability. Applied to the judicial field, this invention can provide explanations for classification while achieving high accuracy, and the human-controlled attention matrix focuses on keywords related to the type of case, allowing relevant personnel to trust the classification results. However, the above technical solution has the following problem: it does not consider the significant differences in the incidence rates of cases in different categories, resulting in low accuracy in text classification. Summary of the Invention
[0004] To address this issue, the present invention provides a judicial text classification method, apparatus, and storage medium based on an attention mechanism, which overcomes the problem in the prior art that the large differences in the incidence rates of cases in different categories lead to low accuracy in text classification.
[0005] To achieve the above objectives, in one aspect, the present invention provides a judicial text classification method based on an attention mechanism, comprising: Based on the structure of judicial texts, several text data are selected from judicial texts, and the feature vocabulary data of each text data is filtered out to generate a word vector sequence. Based on the word relation weights of each word in the word vector sequence, the feature word data are classified, the judicial text is classified for the first time based on the core information word set, and the background similarity between the background information word set and the background information word library is calculated. Calculate the fuzzy classification degree of the first classification, and combine it with the background similarity to determine whether the judicial text is a feature judicial text; In response to determining that the judicial text is a feature judicial text, several target word nodes are selected from the background information vocabulary set, and the node similarity between each target word node and the special word nodes in several special information vocabulary sets is calculated. Based on the node similarity, associated edges are set to construct a vocabulary association graph corresponding to each of the special information vocabulary databases and the association degree of the vocabulary association graph is calculated. The feature judicial texts are classified a second time based on the correlation degree, and the deviation is checked based on the deviation value between the background information vocabulary set of the feature judicial texts and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. In response to the deviation verification passing, the feature judicial text is sent to the special information vocabulary corresponding to the second classification result to update the special information vocabulary.
[0006] Furthermore, the process of calculating the fuzzy classification degree of the first classification includes, The results of the first classification of the judicial text are analyzed to obtain several classification result probability values; The fuzzy classification degree is calculated by statistically analyzing several classification results whose probability values are greater than a preset probability threshold and calculating the average probability value of the non-unique classification results.
[0007] Furthermore, the process of determining whether the judicial text is a characteristic judicial text based on the background similarity includes, The feature text coefficients are calculated based on the fuzzy classification degree and the background similarity. The feature text coefficients are compared with a preset text coefficient threshold, and the judicial text is determined to be a feature judicial text based on the comparison result.
[0008] Furthermore, in response to the fact that the feature text coefficient is greater than or equal to the preset text coefficient threshold, the judicial text is determined to be a feature judicial text; If the feature text coefficient is less than the preset text coefficient threshold, then the judicial text is determined not to be a feature judicial text.
[0009] Furthermore, the process of calculating the node similarity between each target word node and special word nodes in several special information vocabularies includes, Count the frequency of each word in the aforementioned background information vocabulary set; Based on the word relation weights of each word in the background information vocabulary set and the frequency of occurrence, a vocabulary representation value is generated; The word corresponding to the determination result that the word representation value is greater than the preset representation threshold is determined as the target word node; Each target word node is sequentially placed into a special information vocabulary database, and the node similarity between each target word node and each special word node in the special information vocabulary database is calculated.
[0010] Furthermore, the process of calculating the relevance of the lexical association graph includes, Based on the node similarity, association edges are set between each target word node and each special word node in the special information vocabulary database to construct a vocabulary association graph corresponding to each special information vocabulary database. The number of associated edges in each of the aforementioned word association graphs is the association degree.
[0011] Furthermore, the process of deviation verification based on the deviation value between the background information vocabulary set of the featured judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result includes, The vocabulary set of background information of the featured judicial texts is aligned with the vocabulary set of historical background information of each historical judicial text corresponding to the second classification result. Calculate the deviation value between the background information vocabulary set of the aligned feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result; If the deviation value is greater than or equal to the preset deviation threshold, the deviation verification is deemed to have passed. If the deviation value is less than the preset deviation threshold, the deviation verification is deemed to have failed.
[0012] Furthermore, in response to the failure of the deviation verification, the characteristic judicial text is set as a single special information vocabulary to distinguish it from several existing special information vocabularys.
[0013] Secondly, the present invention also provides a judicial text classification device based on an attention mechanism, comprising: The preprocessing module is used to select several text data in the judicial text based on the structure of the judicial text, filter out the feature word data of each text data to generate a word vector sequence, classify each feature word data based on the word relationship weight of each word in the word vector sequence, perform the first classification of the judicial text based on the core information vocabulary set, and calculate the background similarity between the background information vocabulary set and the background information vocabulary library. The classification module is used to calculate the fuzzy classification degree of the first classification, and determine whether the judicial text is a feature judicial text in combination with the background similarity. In response to determining that the judicial text is a feature judicial text, a number of target word nodes are selected in the background information vocabulary set, and the node similarity between each target word node and the special word nodes in a number of special information vocabulary sets is calculated. The graph analysis module is used to set association edges based on the node similarity to construct a word association graph corresponding to each of the special information vocabulary databases and to calculate the association degree of the word association graph. The verification module is used to perform a second classification of the feature judicial text based on the correlation degree, and to perform deviation verification based on the deviation value between the background information vocabulary set of the feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. In response to the deviation verification passing, the feature judicial text is sent to the special information vocabulary library corresponding to the second classification result to update the special information vocabulary library.
[0014] Thirdly, the present invention also provides a judicial text classification apparatus based on an attention mechanism, wherein the computer-executable instructions, when executed, implement the steps of the judicial text classification method based on an attention mechanism as described in the first aspect.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention selects several text data from judicial texts based on the structure of the judicial text, filters out the feature vocabulary data of each text data to generate a word vector sequence, and, based on the word relation weights of each word in the word vector sequence, classifies words with larger word relation weights into a core information vocabulary set and words with smaller word relation weights into a background information vocabulary set. The judicial text is then classified for the first time according to different word relation weights. Then, the similarity in the background information vocabulary database is used to characterize whether the judicial text belongs to a special judicial text with a low probability of occurrence. By selecting target word nodes in special judicial texts and combining them with the special information vocabulary database... By constructing a lexical association graph and performing secondary classification of judicial texts based on the graph, the limitations of general text classification, which treats all texts indiscriminately, are overcome. By prioritizing the extraction of core paragraph data and filtering redundant content, feature extraction focuses on semantic segments that truly affect the characterization of cases. This solves the problem of labeling and training small-sample special cases. Special judicial texts are usually not much different from ordinary cases in terms of core factual elements, but they are unique in their background information. By calculating the similarity of background information lexicon, these special cases with low probability of occurrence can be accurately screened without a large amount of labeled data, further improving the accuracy of judicial text classification based on attention mechanisms.
[0016] In particular, this invention performs an initial classification by analyzing judicial texts, specifically using a conventional attention mechanism to obtain the probability values of different classification results. It then statistically analyzes several classification results whose probability values exceed a preset probability threshold. If the classification results are not unique, it indicates insufficient accuracy of the initial classification. The background information vocabulary consists of semantic terms from infrequently occurring judicial texts. Calculating the background similarity between the background information vocabulary set and the background information vocabulary library can characterize whether the judicial text contains a large number of semantic terms from infrequently occurring judicial texts. These semantic terms are crucial for judicial classification. Because individual judicial texts are extremely rare, they are prone to being classified in a bias towards high-frequency categories. By combining fuzzy classification degree and background similarity analysis, we can characterize whether the first classification is accurate. Judicial texts that are not classified accurately in the first classification are identified as characteristic judicial texts. When a judicial text contains a large number of semantic words from the background information vocabulary, even if its core factual elements are similar to those of ordinary cases, it will still be identified as a characteristic judicial text. This mechanism can effectively avoid the problem of rare cases being forcibly classified into high-frequency categories due to insufficient training samples, so that new and difficult cases can receive due attention and accurate handling, and further improve the accuracy of judicial text classification based on attention mechanism.
[0017] In particular, this invention generates lexical representation values by statistically analyzing the frequency of occurrence of each word in the background information lexical set, based on the word relation weights and frequency of occurrence of each word in the background information lexical set. An increase in either the word relation weight or the frequency of occurrence reflects the special characteristics of the judicial text. Target word nodes are determined through lexical representation values, and each target word node is sequentially placed between two different adjacent words in each special information lexical set. The node similarity between each target word node and each special word node in the special information lexical set is calculated sequentially. By traversing all adjacent word pairs for insertion calculation, the system can discover indirect and cross-related associations between target words and special words. By analyzing the overall context of target words in the special information lexical set, it can accurately distinguish subtle legal differences between them, reduce the mismatch rate, avoid overfitting problems in small sample learning, and further improve the accuracy of judicial text classification based on attention mechanisms.
[0018] In particular, this invention performs a deviation check on the second classification of judicial texts. It calculates the deviation between the judicial text and the historical judicial texts included in the second classification result using a set of background information vocabularies. A large deviation indicates the accuracy of the second classification result; a small deviation indicates the judicial text is dissimilar to all other texts and cannot be classified. Therefore, this judicial text is set up as a separate, special information vocabulary. Traditional secondary classification methods, even when faced with completely mismatched texts, will forcibly classify them into the most similar existing category, leading to systematic bias. This step, by setting a deviation threshold, can clearly distinguish between categorizable and uncategorizable texts, avoiding the problem of incorrectly classifying new cases into old categories, and further improving the accuracy of judicial text classification based on the attention mechanism. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the steps of the judicial text classification method based on the attention mechanism in an embodiment of the present invention. Figure 2 This is a logic diagram for deviation verification in an embodiment of the present invention; Figure 3 This is a structural block diagram of the judicial text classification system based on the attention mechanism according to an embodiment of the present invention. Detailed Implementation
[0020] To make the objectives and advantages of the present invention clearer, the present invention will be further described below with reference to embodiments; it should be understood that the specific embodiments described herein are merely for explaining the present invention and are not intended to limit the present invention.
[0021] Preferred embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.
[0022] Please see Figure 1 The diagram shows a flowchart of the steps in the judicial text classification method based on an attention mechanism according to an embodiment of the present invention. The embodiment of the present invention provides a judicial text classification method based on an attention mechanism, comprising: Step S1: Select several text data from the judicial text based on the structure of the judicial text, and filter out the feature vocabulary data of each text data to generate a word vector sequence; Specifically, judicial texts, including judgments and litigation documents, are structurally standardized. They typically consist of three main sections: an introduction, the body, and a conclusion. The order and content of each section are fixed. The introduction lists headings such as the document title, case number, information on the parties and litigation participants, cause of action, trial organization, and trial proceedings. The body is the core, following a progressive structure of facts, reasons, and main text. Each progressive section contains headings such as the plaintiff's claims, the defendant's defense, third-party statements, evidence presented by each party, cross-examination, and the court's findings of fact. The conclusion contains headings such as the allocation of litigation costs, notification of the right of appeal, the signature of the collegial panel, and the date. This formatted feature allows any legal professional to quickly locate information, and judicial texts often use long sentences.
[0023] Specifically, the judicial text is segmented according to title words to generate several text data, which will not be elaborated further.
[0024] Specifically, a legal terminology dictionary is constructed based on legal terminology, such as legal code terms, high-frequency legal terms in judgments, and crime databases. According to the different structures of different text data in judicial texts, and based on the heading words contained in the corresponding structures, the characteristic vocabulary data of each text data is selected according to the legal terminology dictionary. For example, if the text data is under the heading words of the plaintiff's claim in the main text, the characteristic vocabulary data will mainly retain verbs of litigation claims, amounts, subject matter, and legal relationship words, etc., which will not be elaborated further.
[0025] Specifically, the semantic similarity between each word in the selected feature vocabulary data and the corresponding words in the legal vocabulary list can be calculated by inputting the feature vocabulary data into the BERT model to obtain the word vectors corresponding to each word in the feature vocabulary data, summarizing them to generate a word vector sequence, replacing each word in the feature vocabulary data with the corresponding words in the legal vocabulary list, inputting the replaced feature vocabulary data into the BERT model to obtain the replaced word vectors corresponding to each word in the replaced feature vocabulary data, and summarizing them to generate a replaced word vector sequence.
[0026] Understandably, for a given target word, it is placed in a sentence that can reflect its meaning and input into the BERT model. From the hidden layer output of the BERT model, the dynamic word vector corresponding to the word is found. If there are sub-words, the sub-word vectors are averaged. This is the semantic vector of the target word in the current context, that is, the word vector, which will not be elaborated further.
[0027] Step S2: Based on the word relationship weights of each word in the word vector sequence, classify each feature word data, perform the first classification of the judicial text based on the core information word set, and calculate the background similarity between the background information word set and the background information word library. Specifically, the average word relation weight of each word in the word vector sequence is calculated based on the attention mechanism. If a word has only one neighboring word, then the word relation weight between the word and the single neighboring word is the word relation weight of the word. It can be understood that the word relation weights produced by the attention mechanism have already been normalized by Softmax and usually do not need to be normalized again, which will not be elaborated here.
[0028] In this embodiment, a word relation weight calculation unit is provided to determine the word relation weight. The word relation weight is used to determine the average dependence of a word on its adjacent words when constructing its own semantics. The larger the word relation weight, the more the semantics of the word is determined by the structure of the adjacent phrases. The word is highly dependent on the local context. In the context of different segmented text data, the word can be identified as a core information word. Several core information words are summarized to generate a core information word set. The smaller the word relation weight, the more the semantics of the word is determined by the distant context or its own independent meaning. The word is less dependent on the local context. In the context of different segmented text data, the word can be identified as a background information word. Several background information words are summarized to generate a background information word set. In this embodiment, the higher the user's requirement for the accuracy of the determination of core information words, the higher the preset weight threshold. Preferably, the preset weight threshold in this embodiment is 0.1.
[0029] It is understandable that a historical judicial text classification library is constructed based on several judicial texts included in the judicial classification results of multiple samples, and a background information vocabulary library is constructed based on background information words in several judicial texts included in the judicial classification results of small samples. Background information words are words that appear more frequently in the judicial texts included in the judicial classification results of small samples. The higher the user's requirement for the accuracy of the judicial classification results of small samples, the greater the probability that the selected background information words will appear in the judicial texts included in the judicial classification results of small samples. This will not be elaborated further.
[0030] Specifically, in the first classification of judicial texts based on the core information vocabulary set, the probability value of each word in the core information vocabulary set belonging to different classification results in the historical judicial text classification database is analyzed based on the conventional attention mechanism; the probability values of the classification results of several words corresponding to different classification results are summed to generate the total classification result probability value, and the classification result corresponding to the maximum total classification result probability value is selected as the classification result of the first classification.
[0031] Specifically, the semantic similarity between each background information word in the background information vocabulary set and each word in the background information vocabulary library is calculated, and the maximum semantic similarity is selected as the background similarity of the background information word.
[0032] Step S3: Calculate the fuzzy classification degree of the first classification, and combine it with the background similarity to determine whether the judicial text is a feature judicial text; Step S4: In response to determining that the judicial text is a feature judicial text, select a number of target word nodes in the background information vocabulary set and calculate the node similarity between each target word node and the special word nodes in the special information vocabulary set. Step S5: Set up association edges based on node similarity to construct a vocabulary association graph corresponding to each special information vocabulary and calculate the association degree of the vocabulary association graph; Step S6: Perform a second classification of the feature judicial texts based on the correlation degree, and perform deviation verification based on the deviation value of the background information vocabulary set of the feature judicial texts and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. Step S7: In response to the deviation verification passing, the feature judicial text is sent to the special information vocabulary corresponding to the second classification result to update the special information vocabulary.
[0033] In particular, this invention selects several text data from judicial texts based on the structure of the judicial texts, filters out the feature vocabulary data of each text data to generate a word vector sequence, and, based on the word relation weights of each word in the word vector sequence, classifies words with larger word relation weights into a core information vocabulary set and words with smaller word relation weights into a background information vocabulary set. The judicial texts are then classified for the first time according to different word relation weights. Then, the similarity in the background information vocabulary database indicates whether the judicial text belongs to a special judicial text with a low probability of occurrence. By selecting target word nodes in special judicial texts and constructing a vocabulary association graph in conjunction with the special information vocabulary database, the judicial texts are classified for the second time based on the vocabulary association graph. This overcomes the limitation of general text classification's indiscriminate processing of the entire text. By prioritizing the extraction of core paragraph data and filtering redundant content, feature extraction focuses on semantic segments that truly affect the case's characterization. This solves the problem of difficulty in labeling and training small-sample special cases. Special judicial texts are usually not much different from ordinary cases in terms of core factual elements, but they have unique background information. Through similarity calculation in the background information vocabulary database, these special cases with a low probability of occurrence can be accurately screened without a large amount of labeled data, further improving the accuracy of judicial text classification based on the attention mechanism.
[0034] Specifically, in step S3, the process of calculating the fuzzy classification degree of the first classification includes, Analyze the results of the first classification of judicial texts to obtain several probability values of the classification results; The fuzzy classification degree is calculated as the probability mean of several classification results whose probability values are greater than a preset probability threshold.
[0035] In this embodiment, a preset result probability threshold calculation unit is provided to determine the preset result probability threshold. The preset result probability threshold is used to determine the degree of tendency of words to be classified into different classification results during the first classification. The larger the classification result probability value, the greater the tendency of the word to be classified into that classification result; the smaller the classification result probability value, the smaller the tendency of the word to be classified into that classification result; when the classification result probability value greater than the preset result probability threshold is unique, the classification tendency is strong and does not belong to fuzzy classification, and the fuzzy classification degree is recorded as 0; when the classification result probability value greater than the preset result probability threshold is not unique, the classification tendency is weak and belongs to fuzzy classification; in this embodiment, the higher the user's requirement for the accuracy of fuzzy classification, the smaller the preset result probability threshold. Preferably, in this embodiment, the preset result probability threshold is 0.8.
[0036] Specifically, in step S3, the process of determining whether a judicial text is a characteristic judicial text by combining background similarity includes, The feature text coefficients are calculated based on fuzzy classification degree and background similarity. The feature text coefficients are compared with preset text coefficient thresholds, and the judicial text is determined as a feature judicial text based on the comparison results.
[0037] In this embodiment, a feature text coefficient calculation unit is also provided to determine the feature text coefficient. The feature text coefficient is used to determine the degree to which the judicial text tends to be classified as a feature judicial text. The larger the feature text coefficient, the higher the degree to which the judicial text tends to be classified as a feature judicial text. The smaller the feature text coefficient, the lower the degree to which the judicial text tends to be classified as a feature judicial text. Preferably, the feature text coefficient is the sum of the fuzzy classification degree and the background similarity.
[0038] In this embodiment, a preset text coefficient threshold calculation unit is also provided to determine the preset text coefficient threshold. The preset text coefficient threshold is used to quantify the degree to which judicial text tends to be classified as characteristic judicial text. Then, by comparing the characteristic text coefficient with the preset text coefficient threshold, the judicial text is distinguished as a characteristic judicial text. In this embodiment, the higher the user's requirement for the accuracy of the determination of characteristic judicial text, the larger the preset text coefficient threshold will be. Preferably, in this embodiment, the preset text coefficient threshold is 1.6.
[0039] Specifically, in step S3, in response to the feature text coefficient being greater than or equal to a preset text coefficient threshold, the judicial text is determined to be a feature judicial text; If the feature text coefficient is less than a preset text coefficient threshold, the judicial text is determined not to be a feature judicial text.
[0040] In particular, this invention performs an initial classification by analyzing judicial texts, specifically using a conventional attention mechanism to obtain the probability values of different classification results. It then statistically analyzes several classification results whose probability values exceed a preset probability threshold. If the classification results are not unique, it indicates insufficient accuracy of the initial classification. The background information vocabulary consists of semantic terms from infrequently occurring judicial texts. Calculating the background similarity between the background information vocabulary set and the background information vocabulary library can characterize whether the judicial text contains a large number of semantic terms from infrequently occurring judicial texts. These semantic terms are crucial for judicial classification and are... Since some judicial texts are extremely rare, they can easily lead to a bias towards high-frequency categories in classification. By combining fuzzy classification degree and background similarity analysis, we can characterize whether the first classification is accurate. Judicial texts that are not accurately classified in the first classification are identified as characteristic judicial texts. When a judicial text contains a large number of semantic words from the background information vocabulary, even if its core factual elements are similar to those of ordinary cases, it will still be identified as a characteristic judicial text. This mechanism can effectively avoid the problem of rare cases being forcibly classified into high-frequency categories due to insufficient training samples, so that new and difficult cases can receive due attention and accurate handling, and further improve the accuracy of judicial text classification based on the attention mechanism.
[0041] Specifically, in step S4, the process of calculating the node similarity between each target word node and the special word nodes in several special information vocabularies includes, Count the frequency of each word in the background information vocabulary set; Lexical representation values are generated based on the word relation weights and frequency of occurrence of each word in the background information vocabulary set; In this embodiment, a lexical representation value calculation unit is also provided to determine the lexical representation value. The lexical representation value is used to determine the importance of the background information lexical in the semantic composition. The larger the lexical representation value, the higher the semantic importance of the background information lexical. The smaller the lexical representation value, the lower the semantic importance of the background information lexical. Preferably, the lexical representation value is the sum of the relation weights of several words of the same lexical in the background information lexical set divided by the number of times the lexical appears in the background information lexical set.
[0042] The words whose word representation values are greater than a preset representation threshold are identified as target word nodes. In this embodiment, a preset representation threshold calculation unit is also provided to determine the preset representation threshold. The preset representation threshold is used to quantify the semantic importance of background information words. Then, by comparing the word representation value with the preset representation threshold, it is possible to distinguish whether the background information words in the background information word set are target word nodes. In this embodiment, the higher the user's requirement for the accuracy of the determination of target word nodes, the larger the preset representation threshold will be. Preferably, in this embodiment, the preset representation threshold is 0.1.
[0043] Each target word node is sequentially placed into each special information vocabulary database, and the node similarity between each target word node and each special word node in the special information vocabulary database is calculated.
[0044] Specifically, in step S5, the process of calculating the relevance of the word association graph includes, Based on node similarity, association edges are set between each target word node and each special word node in the special information vocabulary to construct a vocabulary association graph corresponding to each special information vocabulary. Specifically, between target word nodes and special information word nodes, associative edges are constructed based on the calculated node similarity, thereby generating a corresponding word association graph for each special information vocabulary. In essence, each target word node is sequentially placed into its respective special information vocabulary, and its similarity to each special word node in that vocabulary is calculated. A similarity threshold is set, and an associative edge is established between the two nodes only when the similarity meets the threshold. This forms a graph where the two types of nodes are connected by associative edges, revealing the semantic relationships between key concepts in the background information vocabulary set and specialized terms in each special information vocabulary set.
[0045] The degree of association is the number of associated edges in the association graph of each word.
[0046] Specifically, in the second classification of feature-based judicial texts based on relevance, the classification result of the special information vocabulary corresponding to the maximum relevance is selected as the classification result of the second classification.
[0047] In particular, this invention generates lexical representation values by statistically analyzing the frequency of occurrence of each word in the background information lexical set, based on the word relation weights and frequency of occurrence of each word in the background information lexical set. An increase in either the word relation weight or the frequency of occurrence reflects the special characteristics of the judicial text. Target word nodes are determined through lexical representation values, and each target word node is sequentially placed between two different adjacent words in each special information lexical set. The node similarity between each target word node and each special word node in the special information lexical set is calculated sequentially. By traversing all adjacent word pairs for insertion calculation, the system can discover indirect and cross-related associations between target words and special words. By analyzing the overall context of target words in the special information lexical set, it can accurately distinguish subtle legal differences between them, reduce the mismatch rate, avoid overfitting problems in small sample learning, and further improve the accuracy of judicial text classification based on attention mechanisms.
[0048] Specifically, in step S6, the process of deviation verification based on the deviation value between the background information vocabulary set of the feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result includes: It is understandable that the historical background information vocabulary set is a collection of background information terms contained in various historical judicial texts.
[0049] The vocabulary set of background information of the feature judicial texts is aligned with the vocabulary set of historical background information of each historical judicial text corresponding to the second classification results. Understandably, the background information vocabulary set and the historical background information vocabulary set are arranged and aligned based on the position of the background information vocabulary they contain in the text data segmented by the same title vocabulary, and the vocabulary lacking alignment words is aligned using tags.
[0050] Calculate the deviation value between the context information vocabulary set of the aligned feature judicial text and the historical context information vocabulary set of each historical judicial text corresponding to the second classification result; In this embodiment, a deviation value calculation unit is also provided to determine the deviation value. The deviation value is used to determine the accuracy of the second classification result. The larger the deviation value, the lower the accuracy of the second classification result; the smaller the deviation value, the higher the accuracy of the second classification result. Preferably, the deviation value is the weighted cosine similarity between the background information vocabulary set of the aligned feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. It can be understood that when calculating the vocabulary aligned with the label, the weight of the vocabulary on the label side is directly set to 0.
[0051] Please see Figure 2 As shown, it is a logic judgment diagram for deviation verification in an embodiment of the present invention. If the deviation value is greater than or equal to the preset deviation threshold, the deviation verification is determined to be passed. If the deviation value is less than the preset deviation threshold, the deviation verification is deemed to have failed.
[0052] In this embodiment, a deviation threshold calculation unit is also provided to determine the deviation threshold. The deviation threshold is used to quantify the accuracy of the second classification result. Then, by comparing the deviation value with the deviation threshold, the accuracy of the second classification result of the feature judicial text is distinguished. In this embodiment, the higher the user's requirement for the accuracy of the second classification result, the larger the deviation threshold. Preferably, the deviation threshold in this embodiment is 0.8.
[0053] Specifically, in step S7, in response to the deviation check passing, the feature judicial text is sent to the special information vocabulary corresponding to the second classification result to update the special information vocabulary. In response to a failed deviation check, the featured judicial text is set as a single special information vocabulary to distinguish it from several existing special information vocabularys.
[0054] In particular, this invention performs a deviation check on the second classification of judicial texts. It calculates the deviation between the judicial text and the historical judicial texts included in the second classification result using a set of background information vocabularies. A large deviation indicates the accuracy of the second classification result; a small deviation indicates the judicial text is dissimilar to all other texts and cannot be classified. Therefore, this judicial text is set up as a separate, special information vocabulary. Traditional secondary classification methods, even when faced with completely mismatched texts, will forcibly classify them into the most similar existing category, leading to systematic bias. This step, by setting a deviation threshold, can clearly distinguish between categorizable and uncategorizable texts, avoiding the problem of incorrectly classifying new cases into old categories, and further improving the accuracy of judicial text classification based on the attention mechanism.
[0055] Please see Figure 3 The diagram shown is a structural block diagram of a judicial text classification system based on an attention mechanism according to an embodiment of the present invention. The judicial text classification system based on an attention mechanism according to an embodiment of the present invention includes: The preprocessing module includes a word relation weight calculation unit and a preset result probability threshold calculation unit. It is used to select several text data in the judicial text based on the structure of the judicial text, filter out the feature word data of each text data to generate a word vector sequence, classify each feature word data based on the word relation weight of each word in the word vector sequence, perform the first classification of the judicial text based on the core information word set, and calculate the background similarity between the background information word set and the background information word library. The classification module includes a feature text coefficient calculation unit, a preset text coefficient threshold calculation unit, a vocabulary representation value calculation unit, and a preset representation threshold calculation unit. It is connected to the preprocessing module and is used to calculate the fuzzy classification degree of the first classification. It combines the background similarity to determine whether the judicial text is a feature judicial text. In response to the determination that the judicial text is a feature judicial text, it selects several target word nodes in the background information vocabulary set and calculates the node similarity between each target word node and several special word nodes in the special information vocabulary set. The graph analysis module, which is connected to the classification module, is used to set up association edges based on node similarity to construct a word association graph corresponding to each special information vocabulary and calculate the association degree of the word association graph. The verification module includes a deviation value calculation unit and a deviation threshold calculation unit, which are connected to the classification module and the graph analysis module, respectively. It is used to perform a second classification of the feature judicial text based on the correlation degree, and to perform deviation verification based on the deviation value of the background information vocabulary set of the feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. In response to the deviation verification failing, the feature judicial text is sent to the special information vocabulary library corresponding to the second classification result to update the special information vocabulary library.
[0056] Specifically, the judicial text classification device based on the attention mechanism provided in this embodiment of the invention can achieve the same technical effect by adopting the judicial text classification method based on the attention mechanism described above, and will not be repeated here.
[0057] This application provides a storage medium for storing computer-executable instructions, which, when executed, implement the steps of the attention-based judicial text classification method described in any of the above embodiments.
[0058] It should be noted that the embodiments concerning storage media in this specification and the embodiments of the judicial text classification method based on attention mechanism in this specification are based on the same inventive concept. Therefore, the specific implementation of this embodiment can be referred to the aforementioned implementation of the corresponding judicial text classification method based on attention mechanism, and the repeated parts will not be described again.
[0059] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0060] For ease of description, the above apparatus is described by dividing it into various functional units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in one or more software and / or hardware.
[0061] Those skilled in the art will understand that one or more embodiments of this specification can be provided as a method, system, or computer program product. Therefore, one or more embodiments of this specification may take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this specification may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0062] This specification is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this specification. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create a machine for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0063] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0064] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0065] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0066] One or more embodiments of this specification can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a particular task or implement a particular abstract data type. One or more embodiments of this specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0067] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0068] The technical solution of the present invention has been described above with reference to the preferred embodiments shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will all fall within the scope of protection of the present invention.
Claims
1. A judicial text classification method based on an attention mechanism, characterized in that, include: Based on the structure of judicial texts, several text data are selected from judicial texts, and the feature vocabulary data of each text data is filtered out to generate a word vector sequence. Based on the word relation weights of each word in the word vector sequence, the feature word data are classified, the judicial text is classified for the first time based on the core information word set, and the background similarity between the background information word set and the background information word library is calculated. Calculate the fuzzy classification degree of the first classification, and combine it with the background similarity to determine whether the judicial text is a feature judicial text; In response to determining that the judicial text is a feature judicial text, several target word nodes are selected from the background information vocabulary set, and the node similarity between each target word node and the special word nodes in several special information vocabulary sets is calculated. Based on the node similarity, associated edges are set to construct a vocabulary association graph corresponding to each of the special information vocabulary databases and the association degree of the vocabulary association graph is calculated. The feature judicial texts are classified a second time based on the correlation degree, and the deviation is checked based on the deviation value between the background information vocabulary set of the feature judicial texts and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. In response to the deviation verification passing, the feature judicial text is sent to the special information vocabulary corresponding to the second classification result to update the special information vocabulary.
2. The judicial text classification method based on attention mechanism according to claim 1, characterized in that, The process of calculating the fuzzy classification degree of the first classification includes, The results of the first classification of the judicial text are analyzed to obtain several classification result probability values; The fuzzy classification degree is calculated by statistically analyzing several classification results whose probability values are greater than a preset probability threshold and calculating the average probability value of the non-unique classification results.
3. The judicial text classification method based on attention mechanism according to claim 2, characterized in that, The process of determining whether the judicial text is a characteristic judicial text based on the background similarity includes, The feature text coefficients are calculated based on the fuzzy classification degree and the background similarity. The feature text coefficients are compared with a preset text coefficient threshold, and the judicial text is determined to be a feature judicial text based on the comparison result.
4. The judicial text classification method based on attention mechanism according to claim 3, characterized in that, If the feature text coefficient is greater than or equal to the preset text coefficient threshold, then the judicial text is determined to be a feature judicial text. If the feature text coefficient is less than the preset text coefficient threshold, then the judicial text is determined not to be a feature judicial text.
5. The judicial text classification method based on attention mechanism according to claim 4, characterized in that, The process of calculating the node similarity between each target word node and special word nodes in several special information vocabularies includes, Count the frequency of each word in the aforementioned background information vocabulary set; Based on the word relation weights of each word in the background information vocabulary set and the frequency of occurrence, a vocabulary representation value is generated; The word corresponding to the determination result that the word representation value is greater than the preset representation threshold is determined as the target word node; Each target word node is sequentially placed into a special information vocabulary database, and the node similarity between each target word node and each special word node in the special information vocabulary database is calculated.
6. The judicial text classification method based on attention mechanism according to claim 5, characterized in that, The process of calculating the relevance of the lexical association graph includes, Based on the node similarity, association edges are set between each target word node and each special word node in the special information vocabulary database to construct a vocabulary association graph corresponding to each special information vocabulary database. The number of associated edges in each of the aforementioned word association graphs is the association degree.
7. The judicial text classification method based on attention mechanism according to claim 6, characterized in that, The process of deviation verification based on the deviation value of the background information vocabulary set of the aforementioned feature judicial texts and the historical background information vocabulary sets of each historical judicial text corresponding to the second classification results includes: The vocabulary set of background information of the featured judicial texts is aligned with the vocabulary set of historical background information of each historical judicial text corresponding to the second classification result. Calculate the deviation value between the background information vocabulary set of the aligned feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result; If the deviation value is greater than or equal to the preset deviation threshold, the deviation verification is deemed to have passed. If the deviation value is less than the preset deviation threshold, the deviation verification is deemed to have failed.
8. The judicial text classification method based on attention mechanism according to claim 7, characterized in that, In response to the failure of the deviation verification, the feature judicial text is set as a single special information vocabulary to distinguish it from several existing special information vocabularys.
9. An attention-based judicial text classification device applied to the attention-based judicial text classification method according to any one of claims 1-8, characterized in that, include: The preprocessing module is used to select several text data in the judicial text based on the structure of the judicial text, filter out the feature word data of each text data to generate a word vector sequence, classify each feature word data based on the word relationship weight of each word in the word vector sequence, perform the first classification of the judicial text based on the core information vocabulary set, and calculate the background similarity between the background information vocabulary set and the background information vocabulary library. The classification module is used to calculate the fuzzy classification degree of the first classification, and determine whether the judicial text is a feature judicial text in combination with the background similarity. In response to determining that the judicial text is a feature judicial text, a number of target word nodes are selected in the background information vocabulary set, and the node similarity between each target word node and the special word nodes in a number of special information vocabulary sets is calculated. The graph analysis module is used to set association edges based on the node similarity to construct a word association graph corresponding to each of the special information vocabulary databases and to calculate the association degree of the word association graph. The verification module is used to perform a second classification of the feature judicial text based on the correlation degree, and to perform deviation verification based on the deviation value between the background information vocabulary set of the feature judicial text and the historical background information vocabulary set of each historical judicial text corresponding to the second classification result. In response to the deviation verification passing, the feature judicial text is sent to the special information vocabulary library corresponding to the second classification result to update the special information vocabulary library.
10. A storage medium for storing computer-executable instructions, characterized in that, When executed, the computer-executable instructions implement the steps of the judicial text classification method based on the attention mechanism as described in any one of claims 1-8.
Citation Information
Patent Citations
Controllable interpretable judicial text classification method based on self-attention mechanism
CN112784047A
