A legal article recommendation method integrating legal article keywords

By constructing a legal keyword list and automatically retrieving similar cases, the problem of judges spending time and effort on reading laws and regulations in judicial trials is solved, and the accurate legal recommendation of the facts of the case is achieved, and the trial efficiency and accuracy are improved.

CN114547237BActive Publication Date: 2025-04-08HOHAI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210078543.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-24
Publication Date
2025-04-08
Estimated Expiration
2042-01-24

AI Technical Summary

Technical Problem

During the current judicial trial process, judges need to spend a lot of time and energy to read laws and regulations, resulting in misjudgment and misjudgment often occur, and different judges have different judgment standards for the same type of case.

Method used

By constructing a legal keyword list, coding the case facts, automatically searching for past cases, searching for similar cases, and classifying legal terms through the full connection layer, and recommending relevant legal terms.

Benefits of technology

The relevant laws and regulations have been achieved to accurately predict the facts of the case, which reduces the workload of judges, improves trial efficiency, and reduces the possibility of misjudgment and missed judgments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114547237B_ABST
    Figure CN114547237B_ABST
Patent Text Reader

Abstract

The present invention provides a method for recommending legal articles by integrating legal article keywords, comprising the following steps: step 1, constructing a legal article keyword table; step 2, processing the case fact description in the data set, vectorizing the processed case fact description and the legal article keywords of the case, fusing them, performing binary classification modeling through a neural network model, and training to generate a classification model; step 3, processing the case fact description input by the user; step 4, jointly encoding the processed case fact description and the extracted legal article keywords, and inputting them into the classification model trained in step 2, and the output of the classification model is the relevant legal article involved in the case fact description. The method of the present invention can improve the effect of legal article recommendation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for recommending legal provisions by integrating legal provision keywords. Background Art

[0002] In traditional judicial trials, case trials are mainly based on the results of professional review and debate by judges, lawyers, prosecutors and other legal professionals. On the one hand, with the improvement of people's legal awareness, the number of cases has increased dramatically, but the number of judges has decreased instead of increased, resulting in a sharp increase in the workload of the courts; on the other hand, some cases are complicated and require extremely high personal qualities of judges and lawyers. In the process of case trials, judges need to carefully read a large number of laws and regulations, and then combine them with considerations of the facts of the case to ensure the fairness and justice of the judgment. This process usually takes a lot of time and energy. Secondly, for the same type of cases, different judges often have different standards of judgment, which may lead to misjudgments and missed judgments. Summary of the invention

[0003] Purpose of the invention: The technical problem to be solved by the present invention is to address the deficiencies of the prior art. The purpose of the present invention is to realize a method for recommending legal provisions that integrates legal provision keywords. By encoding the description of case facts, previous cases are automatically retrieved, similar cases are searched, and subsequent processing is performed to provide relevant legal provisions involved in the case facts. The effect achieved can accurately predict relevant legal provisions.

[0004] The present invention is achieved through the following technical solutions:

[0005] Step 1: Construct a legal article keyword table. The so-called legal article keyword table refers to the keyword extraction of each legal article to form a correspondence between legal articles and keywords, which is similar to the crime keyword table. Specific methods include keyword extraction based on statistical features (TF-IDF); keyword extraction based on word graph model (PageRank, TextRank); keyword extraction based on topic model (LDA), etc.

[0006] Step 2: Build a previous case search library with more than 150,000 data in the dataset, and save the case fact description after word embedding in a dictionary for similar case search. The key of the dictionary is a 300-dimensional case fact description vector, and the value is the relevant law.

[0007] Step 3: Process the case fact description input by the user, search for similar cases from the previous case search library based on the processed case fact description, sort the laws of similar cases according to the rules, select the laws of the first k similar cases as the candidate law set, and extract the keywords of these k laws according to the law keyword table.

[0008] Step 4: Based on the case fact description input by the user, the legal article keywords are extracted through step 3. The processed case fact description and the extracted legal article keywords are jointly encoded and input into a fully connected layer for legal article classification. The output of the fully connected layer is the relevant legal article involved in the case fact description.

[0009] In the step 1, the keyword table of legal articles is constructed mainly by extracting the keywords of legal articles in each law from the Criminal Law by using the TF-IDF (term frequency-inverse document frequency) method. The keywords are the content covered by the legal articles. For example, the keyword table of Article 133 of the Criminal Law [Dangerous Driving Crime] includes the words such as chasing and racing, drunk driving, speeding, and transporting dangerous goods. Step 1 includes: extracting the keywords contained in each legal article by using the TF-IDF (term frequency-inverse document frequency) method.

[0010] In step 1, the following formula is used to extract the keywords contained in each legal provision:

[0011]

[0012]

[0013] TF i,j -IDF i =TF i,j IDF i

[0014] Among them, n i,j Indicates the keyword t i In Article d j The number of occurrences in n k,j Indicates the keyword t k In Article d j The number of times it appears in the text, k is a set parameter, indicating the number of keywords in a legal article; TF i,j Indicates the keyword t i In Article d j The frequency of occurrence, IDF i Indicates the keyword t i The inverse document frequency in all legal provisions, · represents the multiplication operation, |D| represents the number of all legal provisions, |j:t i ∈d j | indicates that the keyword t is included i The number of laws.

[0015] Step 2 includes: vectorizing all the more than 150,000 case fact descriptions in the data set, that is, vectorizing and encoding the case fact description T in each data.

[0016] Step 2 specifically includes the following steps:

[0017] Step 2-1: First, the case fact description T is segmented and stop words (attributive words, auxiliary words, pronouns, etc.) are removed. After segmentation and stop words are removed, a series of words w1, w2, ..., w s Composition, w s represents the sth word, that is, T = {w1, w2, w3, ..., w s}, use 300d-Glove to convert each word into word vector form x i :

[0018] x i =E(w i )

[0019] Among them, E∈R |V|×d is the word embedding matrix, where R is a real number, |V| is the size of the vocabulary, and d is the dimension of the word vector;

[0020] Step 2-2: Use the vector summation method to obtain the vector representation W of the case fact description for all word vector sets of each data i ,

[0021] Step 2-3: Represent the vector describing the case facts as W i Saved in a dictionary. The dictionary key key and value value are the vector representation W of the case fact description. i And the legal article L corresponding to the case. Thus, the previous case search library M is obtained.

[0022] Step 3 includes: inputting the case fact description T in Execute step 2 to obtain the vectorized representation of the case fact description of the model input after processing through steps 2-1 to 2-2. in , through I in The case facts vectorized representation I in the previous case search database M t Perform Euclidean distance calculation to compare similarities:

[0023]

[0024]

[0025] Among them, d(x, y i ) represents vectors x and y i The distance between them, sim(x, y i ) represents vectors x and y i The similarity between them, x is the vectorized representation of the case fact description of the model input I in ,yi is the vectorized representation of case facts in the previous case search database M t ;

[0026] By calculating the Euclidean distance between the input case fact description and the case fact description in the previous case search library M, and sorting them from small to large, the k cases with the highest similarity are obtained. According to the previous case search library M, the legal provisions of the first k cases are extracted as the alternative legal provision set; according to the legal provision keyword table established in step 1, the legal provision keyword Z in the alternative legal provision set is extracted.

[0027] 5. Step 4 includes: encoding the case fact description input by the model and the legal article keywords obtained in step 3 respectively, and then fusing them, and inputting the fused features into a fully connected layer. The output of the fully connected layer is the recommended legal article, which specifically includes the following steps:

[0028] Step 4-1: After the case fact description input by the model is operated in step 2-1, the word vector J of each word in the text is obtained, and then the word vector J is respectively subjected to the Attention mechanism (attention mechanism) and BiLSTM (bidirectional long short-term memory) to obtain word-level key information and word-level global structure information.

[0029] The formula for using the Attention mechanism to capture word-level key pattern information I1 is as follows:

[0030]

[0031]

[0032] Among them, u is the training attention parameter, u T is the transpose of u, a i represents each weighted word vector, and s is the number of words contained in the description of the case facts after processing;

[0033] Since BiLSTM performs well in extracting global structural information of text, we use BiLSTM on word vectors to capture the word-level global structural information I2 of the case fact description:

[0034]

[0035]

[0036]

[0037] Among them, the word-level global structure information I2 is the final state of the forward LSTM and the final state of the reverse LSTM Spliced ​​together, x sRepresents the word vector of the sth word; LSTM (Long Short Term Memory) is a variant of the recurrent neural network, but with more parameters and gating mechanisms to control information transmission, including input gate, output gate and forget gate. The input gate determines how much of the network input at the current moment will be saved to the unit state; the output gate controls how much of the unit state is output to the current output value of the LSTM; the forget gate, as the name implies, controls whether to forget, and determines how much of the unit state at the previous moment is retained to the current moment. All gated units use the hidden layer state h at the previous moment t-1 and the current input x t To calculate the unit state at the next moment. The specific calculation formula is as follows:

[0038] i t =σ(W i ·[h t-1 , x t ]+b i )

[0039] f t =σ(W f ·[h t-1 , x t ]+b f )

[0040]

[0041] o t =σ(W o ·[h t-1 , x t ]+b o )

[0042]

[0043] Among them, i t , f t , o t They correspond to the input gate, forget gate, and output gate at time t respectively; is the cell state at time t, W i , W f , W C , W o and b i , b f , b C , b o are the corresponding weights and bias terms, σ and tanh are activation functions, and · and * represent multiplication operations;

[0044] Step 4-2: Use CNN (convolutional neural network) on the word vector J to capture phrase-level features D, using convolution kernel F∈R n×d, n is the window size, and the input sentence is regarded as a matrix X∈R s×d , the convolution kernel F is convolved with the matrix X to obtain the feature map d∈R s-n+l , each element d in the feature map d k It is calculated in the following way:

[0045] d k =σ(∑I,j(F⊙X k:k+n-l ))

[0046] Among them, σ represents the activation function, ⊙ is the multiplication operation of the corresponding element, and X k:k+n-l Represents the kth to k+nlth columns of the input word vector matrix; for the problem of inconsistent input length and output length, the same padding is used to make the input length of the convolutional layer the same as the output length, that is, d∈R s ; Use m convolution kernels to obtain m feature maps, namely phrase-level features D∈R m×s ;

[0047] Step 4-3: After obtaining the phrase-level feature D, use the Attention mechanism and BiLSTM bidirectional long-short time series memory to obtain the key information at the phrase level and the global structure information at the phrase level:

[0048] Acting on phrase-level features D to capture phrase-level key pattern information I3:

[0049]

[0050]

[0051] Among them, β i represents each weighted word vector, v is the attention parameter to be learned, and v T is the transpose of v, d i is the i-th representation vector of phrase-level feature D;

[0052] Use bidirectional long short-term memory LSTM to act on phrase-level features D to obtain phrase-level global structure information I4:

[0053]

[0054]

[0055]

[0056] Among them, the convolution kernel F is convolved with the matrix X to obtain the feature map d∈R s-n+l , the sth element in feature map d is d s , the phrase-level global structure information I4 is the final state of the forward LSTM The final state of the reverse LSTM Spliced ​​together;

[0057] Step 4-4: The fusion of word-level key pattern information I1, word-level global structure information I2, phrase-level key pattern information I3, and phrase-level global structure information I4 is processed using a weighted average method to obtain a representation vector I of the case fact description text T. t , the specific formula is as follows:

[0058] I t =(I1+I2+I3+I4) / 4;

[0059] Step 4-5: The legal keyword Z obtained in step 3 is embedded using the 300d-glove word vector, and then the word-level key information L1 and word-level global structure information L2 of the legal keyword Z are obtained through the Attention mechanism and BiLSTM bidirectional long-short temporal memory in step 4-1. L1 and L2 are weightedly added to obtain the legal keyword information I5;

[0060] I5=(L1+L2) / 2

[0061] Step 4-6: Vector representation I of the case fact description text T t and the legal article keyword information I5, and perform splicing and filling processing to obtain the fusion representation I of the text legal article keyword information T , the specific formula is as follows:

[0062] I T =[I t ; I5].

[0063] Step 4-7: After the above operations, the text representation matrix I for the model classifier is obtained T , then the text representation matrix I T The input is sent to the fully connected layer and the output layer to obtain the predicted logits vector of the legal article label, and finally the sigmoid function is used to predict the probability of all legal article labels. The fully connected layer and the sigmoid layer are used as classification models.

[0064] In steps 4-7, the classification model uses sigmoid as the activation function of the output layer and uses the binary cross entropy loss function binary_crossentropy as the loss function:

[0065] L=-∑ k (y k log(σ(l k ))+(1-y k )log(1-σ(lk )))

[0066] Among them, L represents the loss of the entire model, y k represents the label corresponding to the one-hot encoding, σ(l k ) indicates that the sigmoid function is used to activate the neurons corresponding to the output layer.

[0067] The data set format in this invention is: case fact description, legal provisions. The data set uses the data set of CAIL2018_stage_one, which includes more than 150,000 criminal cases, each of which consists of fact descriptions and corresponding judgment results. The judgment results involve 183 criminal law articles and 202 criminal charges. This invention selects the case fact part and the relevant legal provisions part in this data set. At the same time, about 10,000 pieces of data are built for the final test.

[0068] The present invention provides a method for recommending legal provisions that integrates legal provision keywords. By mining text information of case facts, the method recommends legal provisions that may be applicable to the case to judges, thereby providing more intelligent technical means to improve case handling efficiency. On the one hand, the method allows judges to quickly obtain the relevant legal provisions involved in the case, which can greatly reduce the occurrence of different judgments on the same case; on the other hand, all roles involved in legal cases can benefit from legal provision recommendations. For example, for parties to a case who lack legal knowledge, it is difficult for them to know whether there are suitable legal provisions to protect their rights and interests without the help of professionals. A method that can correctly recommend legal provisions can solve their problems.

[0069] Beneficial effect: Through the method of the present invention, on the premise of encoding the description of case facts, similar cases are searched from the previous case search library through the approximate search method, the keywords of the laws in similar cases are extracted through the constructed law keyword table, and the law keywords are integrated into the case facts, so that the input has more semantic information, thereby improving the effect of law recommendation. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments, and the above and / or other advantages of the present invention will become more clear.

[0071] Figure 1 It is a schematic diagram of the overall structure of the method of the present invention.

[0072] Figure 2 It is a schematic diagram of the vectorized representation of case facts in the present invention.

[0073] Figure 3 This is a schematic diagram of the vectorized representation of legal keyword information in the present invention.

[0074] Figure 4 The keywords for the constructed legal provisions express the intention.

[0075] Figure 5 Schematic diagram of the previous case search library constructed. DETAILED DESCRIPTION

[0076] like Figure 1 As shown, the present invention provides a method for recommending legal provisions by integrating legal provision keywords, comprising the following steps:

[0077] Step 1: Construct a keyword table for legal provisions:

[0078] The keywords contained in each legal article are extracted through the TF-IDF method. The purpose of establishing a legal article keyword table is to establish a mapping relationship between legal articles and their keywords. The specific formula is:

[0079]

[0080]

[0081] TF-IDF=TF·IDF

[0082] Among them, n i,j Indicates the keyword t i In Article d j The number of occurrences in TF i,j It means the keyword t i In Article d j The frequency of occurrence in |D| represents the number of all legal provisions, |j:t i ∈d j | indicates that the keyword t is included i The number of laws.

[0083] The specific steps for constructing a legal keyword table based on the TF-IDF method are as follows:

[0084] Read the legal sample source file;

[0085] Get the legal article number and legal article text content of each row record;

[0086] Load a custom stop word list and perform data preprocessing on the legal text content, including word segmentation, filtering out words that match the part of speech, removing stop words, and concatenating them into text separated by spaces;

[0087] Traverse the legal text records and put the pre-processed legal text into the document set;

[0088] Get the word frequency matrix, a[j][i] represents the word frequency of the jth word in the i-th legal article text;

[0089] Calculate the tf-idf weight of each word;

[0090] Get the legal information words and the corresponding tf-idf matrix in the bag-of-words model;

[0091] Traverse the tf-idf matrix and print the vocabulary and corresponding weights of each legal text;

[0092] Arrange each legal article in descending order according to the word weight value, select the top N words as the legal article information words, and write them into the data frame;

[0093] The final result is written into the file, and the keywords of each law are obtained, such as Figure 4 shown.

[0094] Step 2: Build a previous case search library:

[0095] The existing data set is constructed into a previous case search library, and all the more than 150,000 case fact descriptions in the data set are vectorized, that is, the case fact description T in each data is vectorized and encoded, which specifically includes the following steps:

[0096] Step 2-1: First, the case fact description T is segmented and stop words are removed. After segmentation and stop words are removed, a series of words w1, w2, ..., w s composition, that is, T = {w1, w2, w3, ..., w s}, use 300d-Glove to convert each word into word vector form x i :

[0097] x i =E(w i )

[0098] Among them, E∈R |V|×d is the word embedding matrix, where R is a real number, |V| is the size of the vocabulary, and d is the dimension of the word vector;

[0099] Step 2-2: Use the vector summation method to obtain the vector representation W of the case fact description for all word vector sets of each data i ,

[0100] Step 2-3: Represent the vector describing the case facts as W i Saved in a dictionary. The key values ​​of the dictionary are the vector representation W of the case fact description. i And the legal article L corresponding to the case. Then the previous case search database M has been initially constructed, such as Figure 5 shown.

[0101] Step 3: Search for similar cases:

[0102] The case fact description T entered by the user in Execute step 2 to obtain the vectorized representation of the case fact description of the model input after processing through steps 2-1 to 2-2. in , through I in The case facts vectorized representation I in the previous case search database M t Perform Euclidean distance calculation to compare similarities:

[0103]

[0104]

[0105] Where x is the vectorized representation of the case fact description of the model input in , y is the vectorized representation of case facts in the previous case search database M t ;

[0106] By calculating the Euclidean distance between the input case fact description and the case fact description in the previous case search library M, and sorting them from small to large, the k cases with the highest similarity are obtained. According to the previous case search library M, the legal provisions of the first k cases are extracted as the alternative legal provision set; according to the legal provision keyword table established in step 1, the legal provision keyword Z in the alternative legal provision set is extracted.

[0107] Step 4: Vectorized representation of case fact description and legal article keywords:

[0108] The input case fact description and the legal article keywords obtained in step 3 are encoded separately and then fused. The fused features are input into a fully connected layer, and the output of the fully connected layer is the recommended legal article.

[0109] The coding of the case facts is as follows: Figure 2 As shown, the specific steps include:

[0110] Step 4-1: After the input case fact description is processed through step 2-1, the word vector J of each word in the text is obtained. Then, the word vector J is respectively subjected to the Attention mechanism (attention mechanism) and BiLSTM (bidirectional long short-term memory) to obtain word-level key information and word-level global structure information.

[0111] The formula for using Attention to capture word-level key pattern information I1 is as follows:

[0112]

[0113]

[0114] Among them, u is the training attention parameter, u T is the transpose of u, a i represents each weighted word vector, and s is the number of words contained in the description of the case facts after processing;

[0115] Since BiLSTM performs well in extracting global structural information of text, we use BiLSTM on word vectors to capture the word-level global structural information I2 of the case fact description:

[0116]

[0117]

[0118]

[0119] Among them, the word-level global structure information I2 is the final state of the forward LSTM and the final state of the reverse LSTM spliced ​​together. LSTM (Long Short Term Memory) is a variant of recurrent neural network, but with more parameters and gating mechanisms to control information transmission, including input gate, output gate and forget gate. The input gate determines how much of the network's input at the current moment will be saved to the unit state; the output gate controls how much of the unit state is output to the current output value of the LSTM; the forget gate, as the name implies, controls whether to forget, and determines how much of the unit state at the previous moment is retained to the current moment. All gated units calculate the unit state at the next moment by using the hidden layer state ht-1 at the previous moment and the input xt at the current moment. The specific calculation formula is as follows:

[0120] i t =σ(W i ·[h t-1 , x t ]+b i )

[0121] f t =σ(W f ·[h t-1 , x t ]+b f )

[0122]

[0123] o t =σ(W o ·[h t-1 , x t ]+b o )

[0124]

[0125] Among them, i t , f t , o t They correspond to the input gate, forget gate, and output gate at time t respectively. is the unit state at time t, W and b are the corresponding weight and bias terms respectively.

[0126] Step 4-2: Use CNN (convolutional neural network) on the word vector J to capture phrase-level features D, using convolution kernel F∈R n×d , n is the window size, and the input sentence is regarded as a matrix X∈R s×d , the convolution kernel F is convolved with the matrix X to obtain the feature map d∈R s-n+l , each element d in the feature map d k It is calculated in the following way:

[0127] d k =σ(∑I,j(F⊙X k:k+n-l ))

[0128] Among them, σ represents the activation function, ⊙ is the multiplication operation of the corresponding element, and X k:k+n-l Represents the kth to k+nlth columns of the input word vector matrix; for the problem of inconsistent input length and output length, the same padding is used to make the input length of the convolutional layer the same as the output length, that is, d∈R s ; Use m convolution kernels to obtain m feature maps, namely phrase-level features D∈R m×s ;

[0129] Step 4-3: After obtaining the phrase-level feature D, use the Attention mechanism and BiLSTM on D to obtain the key information at the phrase level and the global structure information at the phrase level.

[0130] Use Attention to act on phrase-level features D to capture phrase-level key pattern information I3:

[0131]

[0132]

[0133] Among them, v is the attention parameter to be learned, v T is the transpose of v, d i is the i-th representation vector of phrase-level feature D, β i Represents each word vector after weighting;

[0134] Use bidirectional LSTM to act on phrase-level features D to obtain phrase-level global structure information I4:

[0135]

[0136]

[0137]

[0138] Among them, the phrase-level global structure information I4 is the final state of the forward LSTM The final state of the reverse LSTM Spliced ​​together;

[0139] Step 4-4: The fusion of word-level key pattern information I1, word-level global structure information I2, phrase-level key pattern information I3, and phrase-level global structure information I4 is processed using a weighted average method to obtain a representation vector I of the case fact description text T. t , the specific formula is as follows:

[0140] I t =(I1+I2+I3+I4) / 4;

[0141] Step 4-5: The legal keyword Z obtained in step 3 is also embedded using the 300d-glove word vector. Then, the word-level key pattern information L1 and L2 of the legal keyword Z are obtained through step 4-1. The legal keyword information I5 is obtained by weighted addition of L1 and L2. The encoding of the legal keyword is as follows: Figure 3 As shown;

[0142] I5=(L1+L2) / 2

[0143] Step 4-6: Vector representation I of the case fact description text T t and the legal article keyword information I5, and perform splicing and filling processing to obtain the fusion representation I of the text legal article keyword information T , the specific formula is as follows:

[0144] I T =[I t ; I5].

[0145] Step 4-7: After the above operations, the text representation matrix I for the model classifier can be obtained T , then the text is represented by the matrix I T The input is sent to the fully connected layer and the output layer to obtain the predicted logits vector of the legal article label, and finally the sigmoid function is used to predict the probability of all legal article labels. This model uses sigmoid as the activation function of the output layer and binary_crossentropy (binary cross entropy loss function) as the loss function, converting a multi-label problem into a binary classification problem on each label:

[0146] L=-∑ k (y k log(σ(l k ))+(1-y k )log(1-σ(l k )))

[0147] Among them, L represents the loss of the entire model, y k Corresponding to the one-hot encoded label, σ(l k ) indicates that the sigmoid function is used to activate the neurons corresponding to the output layer.

[0148] The present invention provides a method for recommending legal articles by integrating legal article keywords. There are many methods and ways to implement the technical solution. The above is only a preferred implementation of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. All components not specified in this embodiment can be implemented by existing technologies.

Claims

1. A method for recommending legal provisions by integrating legal provision keywords, characterized in that: The steps include: Step 1: Build a legal keyword table; Step 2: Build a previous case search library and save the case fact description after word embedding in a dictionary for similar case search. The key of the dictionary is a case fact description vector, and the value is the relevant law. Step 3: Process the case fact description input by the user, search for similar cases from the previous case search database based on the processed case fact description, sort the laws of similar cases according to the rules, select the laws of the first k similar cases as the candidate law set, and extract the keywords of these k laws according to the law keyword table; Step 4: Based on the case fact description input by the user, the legal article keywords are extracted through step 3, the processed case fact description and the extracted legal article keywords are jointly encoded, and then input into a fully connected layer for legal article classification. The output of the fully connected layer is the relevant legal articles involved in the case fact description; Step 2 includes: vectorizing all case fact descriptions in the data set, that is, vectorizing and encoding the case fact description T in each piece of data; Step 2 specifically includes the following steps: Step 2-1: First, the case fact description T is segmented and stop words are removed. After segmentation and stop words are removed, a series of words w1, w2, ..., w s Composition, w s represents the sth word, that is, T = {w1, w2, w3, ..., w s }, convert each word into a word vector form x i : x i =E(w i ) Among them, E∈R |V|×d is the word embedding matrix, where R is a real number, |V| is the size of the vocabulary, and d is the dimension of the word vector; Step 2-2: Use the vector summation method to obtain the vector representation W of the case fact description for all word vector sets of each data i , Step 2-3: Represent the vector describing the case facts as W i Saved in a dictionary, the dictionary key key, value value is the vector representation W of the case fact description i And the legal article L corresponding to the case, thus obtaining the previous case search library M; Step 3 includes: inputting the case fact description T in Execute step 2 to obtain the vectorized representation of the case fact description of the model input after processing through steps 2-1 to 2-2. in , through I in The case facts vectorized representation I in the previous case search database M t Perform Euclidean distance calculation to compare similarities: Among them, d(x, y i ) represents vectors x and y i The distance between them, sim(x, y i ) represents vectors x and y i The similarity between them, x is the vectorized representation of the case fact description of the model input I in ,y i is the vectorized representation of case facts in the previous case search database M t ; By calculating the Euclidean distance between the input case fact description and the case fact description in the previous case search library M, sorting them from small to large, thus obtaining the k cases with the highest similarity, and extracting the legal provisions of the first k cases from the previous case search library M as the candidate legal provision set; according to the legal provision keyword table established in step 1, extracting the legal provision keyword Z from the candidate legal provision set; Step 4 includes: encoding the case fact description input by the model and the legal article keywords obtained in step 3 respectively, and then fusing them, and inputting the fused features into a fully connected layer. The output of the fully connected layer is the recommended legal article, which specifically includes the following steps: Step 4-1: After the case fact description input by the model is operated in step 2-1, the word vector J of each word in the text is obtained, and then the word vector J is respectively used with the Attention mechanism and the BiLSTM bidirectional long-short temporal memory to obtain the word-level key information and the word-level global structure information; The formula for using the Attention mechanism to capture word-level key pattern information I1 is as follows: Among them, u is the training attention parameter, u T is the transpose of u, a i represents each weighted word vector, and s is the number of words contained in the description of the case facts after processing; Use BiLSTM on word vectors to capture the word-level global structural information I2 of the case fact description: Among them, the word-level global structure information I2 is the final state of the forward LSTM and the final state of the reverse LSTM Spliced ​​together, x s Represents the word vector of the sth word; All gated units calculate the unit state at the next moment by using the hidden layer state ht-1 at the previous moment and the input xt at the current moment. The specific calculation formula is as follows: i t =σ(W i ·[h t-1 ,x t ]+b i ) f t =σ(W f ·[h t-1 ,x t ]+b f ) the t =σ(W o ·[h t-1 ,x t ]+b o ) Among them, i t , f t , o t They correspond to the input gate, forget gate, and output gate at time t respectively; is the cell state at time t, W i , W f , W C , W o and b i , b f , b C , b o are the corresponding weights and bias terms, σ and tanh are activation functions, and · and * represent multiplication operations; Step 4-2: Use CNN convolutional neural network on word vector J to capture phrase-level features D, using convolution kernel F∈R n×d , n is the window size, and the input sentence is regarded as a matrix X∈R s×d , the convolution kernel F is convolved with the matrix X to obtain the feature map d∈R s-n+1 , each element d in the feature map d k It is calculated by: d k =σ(∑I,j(F☉X k:k+n-1 )) Among them, σ represents the activation function, ☉ is the multiplication operation of the corresponding element, and X k:k+n-1 Represents the kth column to the k+n-1th column of the input word vector matrix; for the problem of inconsistent input length and output length, the same padding is used to make the input length of the convolutional layer the same as the output length, that is, d∈R s ; Use m convolution kernels to obtain m feature maps, namely phrase-level features D∈R m×s ; Step 4-3: After obtaining the phrase-level feature D, use the Attention mechanism and BiLSTM bidirectional long-short time series memory to obtain the key information at the phrase level and the global structure information at the phrase level: Acting on phrase-level features D to capture phrase-level key pattern information I3: Among them, β i represents each weighted word vector, v is the attention parameter to be learned, and v T is the transpose of v, d i is the i-th representation vector of phrase-level feature D; Use bidirectional long short-term memory LSTM to act on phrase-level features D to obtain phrase-level global structure information I4: Among them, the convolution kernel F is convolved with the matrix X to obtain the feature map d∈R s-n+1 , the sth element in feature map d is d s , the phrase-level global structure information I4 is the final state of the forward LSTM The final state of the reverse LSTM Spliced ​​together; Step 4-4: The fusion of word-level key pattern information I1, word-level global structure information I2, phrase-level key pattern information I3, and phrase-level global structure information I4 is processed using a weighted average method to obtain a representation vector I of the case fact description text T. t , the specific formula is as follows: I t =(I1+I2+I3+I4) / 4; Step 4-5: The legal keyword Z obtained in step 3 is embedded, and then the word-level key information L1 and word-level global structure information L2 of the legal keyword Z are obtained through the Attention mechanism and BiLSTM bidirectional long-short temporal memory in step 4-1. L1 and L2 are weightedly added to obtain the legal keyword information I5; I5=(L1+L2) / 2 Step 4-6: Vector representation I of the case fact description text T t and the legal article keyword information I5, and perform splicing and filling processing to obtain the fusion representation I of the text legal article keyword information T , the specific formula is as follows: I T =[I t ;I5]; Step 4-7: Get the text representation matrix for the model classifier, and then transform the text representation matrix I T The input is sent to the fully connected layer and the output layer to obtain the predicted logits vector of the legal article label. Finally, the sigmoid function is used to predict the probability of all legal article labels, where the fully connected layer and the sigmoid layer serve as classification models.

2. The method according to claim 1, characterized in that: Step 1 includes: extracting the keywords contained in each legal article through the TF-IDF method.

3. The method according to claim 2, characterized in that In step 1, the following formula is used to extract the keywords contained in each legal provision: TF i,j -IDF i =TF i,j ·IDF i Among them, n i,j Indicates the keyword t i In Article d j The number of occurrences in n k,j Indicates the keyword t k In Article d j The number of times it appears in the text, k is a set parameter, indicating the number of keywords in a legal article; TF i,j Indicates the keyword t i In Article d j The frequency of occurrence, IDF i Indicates the keyword t i The inverse document frequency in all legal provisions, · represents the multiplication operation, |D| represents the number of all legal provisions, |j:t i ∈d j | indicates that the keyword t is included i The number of laws.

4. The method according to claim 3, characterized in that In steps 4-7, the classification model uses sigmoid as the activation function of the output layer and uses the binary cross entropy loss function binary_crossentropy as the loss function: L=-∑ k (y k log(σ(l k ))+(1-y k )log(1-σ(l k ))) Among them, L represents the loss of the entire model, y k represents the label corresponding to one-hot encoding, σ(l k ) indicates that the sigmoid function is used to activate the neurons corresponding to the output layer.

Citation Information

Patent Citations

  • A power operation and maintenance text analysis method based on structured expression

    CN109800310A

  • Reusable law article recommendation framework

    CN110717843A