Case similarity matching method, device, computer equipment and storage medium

Through ERNIE technology and twin neural networks in case similarity matching combined WordGCN and subject word model, the problem of poor case similarity matching effect in the existing technology is solved, and more efficient and accurate case similarity analysis is achieved.

CN114881028BActive Publication Date: 2024-11-12SHENZHEN SUNWIN INTELLIGENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210646944.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-08
Publication Date
2024-11-12
Estimated Expiration
2042-06-08

AI Technical Summary

Technical Problem

In the case similarity matching of the prior art, there are problems in the case similarity matching of attribute key-value pairs that ignore non-human car objects information, difficult to subdivided and distinguished subject word matching, and word2vec cannot represent the same words in different contexts, resulting in poor matching effect.

Method used

ERNIE technology is used to combine twin neural networks to match cases similarity through text vector models based on ERNIE, WordGCN and subject words, generate similar probability values, and analyze the characteristics of the field nouns in combination with attention mechanisms.

Benefits of technology

It improves the effectiveness and accuracy of case similarity matching, can better understand the meaning and case content of polysemes in the text, and improves the accuracy of matching.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114881028B_ABST
    Figure CN114881028B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a case similarity matching method, device, computer equipment and storage medium, the method comprising: obtaining the case judgment text in the case database; collecting stop words and special noun vocabulary from the case judgment text, and generating a stop word vocabulary library and a special word vocabulary library; selecting the first case text and the second case text that need to be similarly matched from the case judgment text; inputting the first case text and the second case text into the twin network for processing to obtain the similarity probability value of the first case text and the second case text; if the similarity probability value of the first case text and the second case text meets the set similarity threshold, then the first case text and the second case text are determined to be similar cases. The present invention improves the effectiveness and accuracy of case similarity matching.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data retrieval technology, and more specifically to a case similarity matching method, device, computer equipment and storage medium. Background Art

[0002] With the development of the times, the number of court trials has increased dramatically, and there are more and more case judgments in the case database. When analyzing cases, it is often necessary to find two or more similar cases from the case database for comparison. Currently, there are several ways to search for case similarities.

[0003] The first method is to retrieve the cases in the case database, extract the human, vehicle and object attribute elements in each case object model and add them to the corresponding human, vehicle array comparison container, calculate the similarity of the human, vehicle and object attributes in each human, vehicle and object array to be compared, and record at least two attribute element objects with the greatest similarity and the corresponding similarity values ​​in the form of key-value pairs in the similarity mapping table, and finally sort and display the human, vehicle and object attribute elements in the case object model of each case according to the similarity mapping table. This method matches the similarity of articles based on the key-value pairs of attributes, ignores a large amount of non-human, vehicle and object information, and seriously loses case information that is not human, vehicle and object or involves other fields, which has a serious impact on the case matching effect.

[0004] The second method is to use the layout and key words of the document as constraints, and use the automatic extraction algorithm to extract the three blocks of the document, namely, the case facts, the focus of the dispute, and the judgment results; based on the domain vocabulary, the subject model is used to extract the subject words of each document block to obtain the subject word block and non-subject word block of each document block, and the feature inverted index is constructed according to the feature words in the subject words and non-subject words of each document block. The feature inverted index is mapped to a feature vector, and the subject similarity model is used to calculate the similarity between the query statement and each document in the document data set, and the similarity between the query statement and each document in the document data set is sorted and the sorting result is output to complete the document retrieval. This method only judges the similarity based on the subject words, ignoring the content of the text itself, and it is difficult to make detailed distinctions for cases with similar themes.

[0005] The third method is to represent keywords with word vectors and use cosine similarity to calculate the similarity between different cases. After obtaining multiple cases related to the case, the judgment results are found based on the keyword extraction technology, and a reasonable judgment result range for this case is given intelligently. When the actual judgment result differs too much from the recommended judgment range, an intelligent warning is given in time. This method is based on word2vec technology to generate vectors for similarity comparison. The word2vec training word representation method cannot represent the same word in different contexts and different contexts, especially for professional vocabulary, so the similarity matching effect is not good and the practicality is not strong. Summary of the invention

[0006] The purpose of the present invention is to overcome the deficiencies of the prior art and provide a case similarity matching method, apparatus, computer equipment and storage medium, which can improve the effectiveness and accuracy of case similarity matching.

[0007] To achieve the above object, the present invention adopts the following technical solutions:

[0008] First, case similarity matching methods include:

[0009] Obtain the case judgment text from the case database;

[0010] Collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary and a special word vocabulary;

[0011] Selecting a first case text and a second case text to be matched for similarity from the case judgment text;

[0012] Inputting the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text;

[0013] If the similarity probability values ​​of the first case text and the second case text meet the set similarity threshold, the first case text and the second case text are determined to be similar cases.

[0014] Its further technical solution is: the first case text and the second case text are input into the twin network for processing to obtain the similarity probability value of the first case text and the second case text, and the twin network includes a network model of text vector based on ERNIE, a network model of text vector based on WordGCN graph and a network model of text vector based on keyword.

[0015] A further technical solution is: the first case text and the second case text are input into the twin network for processing to obtain a similarity probability value between the first case text and the second case text, including:

[0016] Inputting the first case text and the second case text into the network model of the text vector based on ERNIE for processing, so as to obtain the first processing features of the first case text and the second case text;

[0017] Inputting the first case text and the second case text into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text;

[0018] Inputting the first case text and the second case text into a network model based on a text vector of a subject word for processing, so as to obtain a third processing feature of the first case text and the second case text;

[0019] Perform concatenation processing on the first processing feature of the first case text and the second case text and the second processing feature of the first case text and the second case text to obtain a combined feature of the first case text and the second case text;

[0020] Inputting the combined features of the first case text and the second case text into the fully connected layer for processing to obtain fully connected layer processed features of the first case text and the second case text;

[0021] Performing a multiplication operation on the fully connected layer processed features of the first case text and the second case text and the third processed features of the first case text and the second case text to obtain text semantic representation features of the first case text and the second case text;

[0022] Performing full connection layer and activation function processing on the text semantic representation features of the first case text and the second case text to obtain the text abstract semantic representation of the first case text and the second case text;

[0023] The text abstract semantic representations of the first case text and the second case text are processed by a matrix of a fully connected layer with a dimension of 1 and a sigmoid activation function to obtain similarity probability values ​​between the first case text and the second case text.

[0024] A further technical solution is: the first case text and the second case text are input into a network model of a text vector based on ERNIE for processing to obtain first processing features of the first case text and the second case text, including:

[0025] Sentence segmentation is performed according to the sentence segmentation symbols of the text content in the first case text and the second case text;

[0026] Segment the sentences using a word segmentation tool combined with a stop word vocabulary and a proprietary word vocabulary to obtain word segmentation data;

[0027] The word segmentation data is processed by ERNIE based on MLM to obtain the word vector of each word;

[0028] Sum the word vectors of each word in each sentence to get the feature vector of the sentence vector;

[0029] The feature vectors of all sentence vectors of the text content are concatenated and fused through Bi-LSTM to obtain the first processing features of the first case text and the second case text.

[0030] A further technical solution is: the first case text and the second case text are input into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text, including:

[0031] Encode the words of the first case text and the second case text through the relationship between words at the sentence level and the corpus level in the WordGCN model to obtain word vectors;

[0032] Construct sentence vectors based on word vectors;

[0033] The sentence vector is input into Bi-GRU for processing to obtain the second processing features of the first case text and the second case text.

[0034] A further technical solution is: the first case text and the second case text are input into a network model based on a text vector of a subject word for processing to obtain a third processing feature of the first case text and the second case text, including:

[0035] The stop words in the texts of the first case text and the second case text are filtered using a stop word vocabulary library;

[0036] Extract the subject words from the filtered text;

[0037] Record the position index and importance of the extracted keywords;

[0038] Extracting proper nouns from the first case text and the second case text using a proper word vocabulary;

[0039] Record the position index and importance level of the extracted proper nouns;

[0040] The importance degree of the subject word and the importance degree of the proper noun are added together to obtain the third processing feature.

[0041] A further technical solution is: extracting the subject words of the filtered text by combining the BERTopic model with the LDA model.

[0042] In a second aspect, a case similarity matching device includes an acquisition unit, a generation unit, a selection unit, a processing unit, and a determination unit;

[0043] The acquisition unit is used to acquire the case judgment text from the case database;

[0044] The generating unit is used to collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary library and a special word vocabulary library;

[0045] The selection unit is used to select a first case text and a second case text that need to be matched for similarity from the case judgment text;

[0046] The processing unit is used to input the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text;

[0047] The determination unit is configured to determine that the first case text and the second case text are similar cases if the similarity probability values ​​of the first case text and the second case text meet a set similarity threshold.

[0048] In a third aspect, a computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the case similarity matching method as described above when executing the computer program.

[0049] In a fourth aspect, a computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the steps of the case similarity matching method as described above.

[0050] The beneficial effects of the present invention compared with the prior art are: by adopting the ERNIE technology, the present invention can better understand the meaning of polysemous words in the text by combining the context, perform case similarity analysis based on the twin neural network, and combine the attention mechanism to perform key feature analysis on nouns in the field of case particularity, thereby enhancing the model's understanding of the case content and improving the effectiveness and accuracy of case similarity matching.

[0051] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the following preferred embodiments are specifically cited and described in detail as follows. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0053] Figure 1 A flowchart of a case similarity matching method provided by a specific embodiment of the present invention;

[0054] Figure 2A schematic block diagram of a case similarity matching device provided in a specific embodiment of the present invention;

[0055] Figure 3 A schematic block diagram of a computer device provided for a specific embodiment of the present invention. DETAILED DESCRIPTION

[0056] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] Figure 1 A flowchart of a case similarity matching method provided for a specific embodiment of the present invention.

[0058] like Figure 1 As shown, the case similarity matching method includes the following steps: S10-S50.

[0059] S10. Obtain the case judgment text from the case database.

[0060] In this embodiment, the case database refers to a database used for court case judgments.

[0061] S20. Collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary library and a special word vocabulary library.

[0062] In this embodiment, due to the revision of laws and regulations and other factors, some words will be stopped. In addition, with the development of technology, new special terms will appear. Therefore, the stopped words and special terms can be collected from the case judgment text, and a stop word vocabulary library and a special word vocabulary library can be established for them to facilitate the subsequent text similarity analysis.

[0063] S30, selecting a first case text and a second case text that need to be matched for similarity from the case judgment text.

[0064] Before selecting, you can set selection conditions, for example, select similarity matching text based on content related to the case description and case conclusion.

[0065] Of course, it should be noted that the first case text and the second case text do not just refer to the similarity matching between one first case text and one second case text, but can also refer to the similarity matching between one first case text and multiple second case texts. If a first case text is matched with a second case text for similarity, it can be concluded whether the two are similar. If a first case text is matched with multiple second case texts for similarity, it can be concluded how close the similarity is between the multiple second case texts and the first case text, and they can be sorted according to the closeness of the similarity to facilitate personnel to conduct case analysis.

[0066] S40: Input the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text.

[0067] In this embodiment, the twin network is divided into two identical and parallel left and right sub-networks, each of which includes a network model of text vectors based on ERNIE, a network model of text vectors based on WordGCN graphs, and a network model of text vectors based on keywords. The first case text can be processed by the left sub-network, and the second case text can be processed by the right sub-network.

[0068] In this embodiment, step S40 specifically includes the following steps: S401-S408.

[0069] S401. Input the first case text and the second case text into a network model of a text vector based on ERNIE for processing to obtain first processing features of the first case text and the second case text.

[0070] The network model of text vector based on ERNIE is to train all cases through the ERNIE model to obtain the word vector of each word. The training method adopts the form of fine-tuning to train the word vector.

[0071] In one embodiment, step S401 specifically includes the following steps: S4011 - S4015 .

[0072] S4011. Segment the text according to the sentence segmentation symbols in the first case text and the second case text.

[0073] S4012. Segment the sentence using a word segmentation tool in combination with a stop word vocabulary and a proprietary word vocabulary to obtain word segmentation data.

[0074] S4013. Process the word segmentation data based on MLM through ERNIE to obtain the word vector of each word.

[0075] S4014. Sum the word vectors of each word in each sentence to obtain a feature vector of the sentence vector.

[0076] S4015. Concatenate and fuse the feature vectors of all sentence vectors of the text content through Bi-LSTM to obtain the first processing features of the first case text and the second case text.

[0077] For steps S4011-S4015, in this embodiment, the sentences are first segmented based on the punctuation symbols in the text, and then the sentences are segmented by the word segmentation tool. The sequence length in the sentence is selected to be 16 words. The text sequence exceeding the word length is truncated, and the text sequence shorter than the sequence length is padded by padding. It should also be noted that the analysis of proper nouns needs to be combined with the proper noun vocabulary to avoid segmenting the proper nouns internally. For the position encoding in the transformer mechanism in ERNIE, if the position of the word in the text is an even number, it is used , if the word is in an odd position in the base Position indicates the position of a word in a sentence, and i is the dimension range of the word vector, which ranges from 0 to 64.

[0078] The word vector of each word can be obtained by training the ERNIE model based on the MLM (Masked Language Model) method. A sentence has multiple words. The feature vector of the sentence vector is obtained by adding multiple words, and all sentence vectors are concatenated to obtain the text vector. The length of the text vector is selected as 500, that is, 500 sentences are selected, and sentences exceeding this length are truncated, so that a sentence vector with a length of 500 and a dimension of 64 based on the word vector can be obtained. .Will Input into Bi-LSTM to get text vector .

[0079] S402: Input the first case text and the second case text into a network model of text vector based on the WordGCN graph for processing to obtain second processing features of the first case text and the second case text.

[0080] In one embodiment, step S402 specifically includes the following steps: S4021-S4023.

[0081] S4021. Encode the words of the first case text and the second case text through the relationship between words at the sentence level and the corpus level in the WordGCN model to obtain word vectors.

[0082] S4022. Construct a sentence vector based on the word vector.

[0083] S4023. Input the sentence vector into Bi-GRU for processing to obtain the second processing features of the first case text and the second case text.

[0084] For steps S4021-S4023, in this embodiment, the WordGCN model is used to represent the sentence model. Words are encoded by the relationship between words at the sentence level and the corpus level. Sentence encoding is performed by word segmentation and fixed sentence length. The sentence length is set to 16 words. If the sentence length exceeds the length, it is truncated. If it does not exceed the length, it is padded by panning. The sentence vector is still obtained by adding word vectors. The length of the text vector is 500, and sentences exceeding this length are truncated. In this way, a sentence vector based on word vectors with a length of 500 and a dimension of 64 can be obtained. .Will Input into Bi-GRU to get text vector .

[0085] S403: Input the first case text and the second case text into a network model based on a text vector of a keyword for processing to obtain a third processing feature of the first case text and the second case text.

[0086] In one embodiment, step S403 specifically includes the following steps: S4031 - S4036 .

[0087] S4031. Filter the stop words in the first case text and the second case text through a stop word vocabulary library.

[0088] S4032. Extract keywords from the filtered text.

[0089] S4033. Record the position index and importance level corresponding to the extracted keywords.

[0090] S4034. Extract proper nouns from the first case text and the second case text using a proper word vocabulary.

[0091] S4035. Record the position index and importance level corresponding to the extracted proper noun.

[0092] S4036: Add the importance of the subject word and the importance of the proper noun to obtain a third processing feature.

[0093] For steps S4031-S4036, in this embodiment, the stop words in the text are first filtered through the stop word vocabulary library, and the subject word model is used to extract the case subject words based on the records after the above word segmentation to obtain the subject words in the case. The subject word vocabulary adopts BERTopic, and c-tf-idf is used internally. It extracts keywords based on the number of case categories rather than the number of documents. The LDA model is also used to extract subject words from the case content. Based on the subject words extracted by the two methods, the position index corresponding to the subject word and the importance of the vocabulary are recorded. The importance ranges from 0 to 1. Then, the proper nouns in the case text are extracted through the case proper word vocabulary library, and the position index corresponding to the proper nouns is recorded. The importance of the proper nouns is uniformly set to 0.5. The special word position index is generated by the union of the subject word position index and the proper noun position index. The importance of these subject words is added to obtain the attention weight matrix , the matrix size is 16x500.

[0094] S404: Concatenate and merge the first processing features of the first case text and the second case text and the second processing features of the first case text and the second case text to obtain merged features of the first case text and the second case text.

[0095] In this embodiment, and Concatenate to get features .

[0096] S405: Input the combined features of the first case text and the second case text into the fully connected layer for processing to obtain fully connected layer processed features of the first case text and the second case text.

[0097] In this embodiment, Input to the fully connected layer to get features .

[0098] S406: Multiply the fully connected layer processing features of the first case text and the second case text with the third processing features of the first case text and the second case text to obtain text semantic representation features of the first case text and the second case text.

[0099] In this embodiment, Matrix and Attention Matrix Multiply to get the final text semantic representation .

[0100] S407, performing full connection layer and activation function processing on the text semantic representation features of the first case text and the second case text to obtain the text abstract semantic representation of the first case text and the second case text.

[0101] In this embodiment, the semantic representation Connect to a fully connected layer and activation function and then connect to another fully connected layer to get the abstract semantic representation of the text .

[0102] S408, processing the text abstract semantic representations of the first case text and the second case text through a matrix of a fully connected layer with a dimension of 1 and a sigmoid activation function to obtain similarity probability values ​​between the first case text and the second case text.

[0103] In this embodiment, the text abstract semantic representation obtained by the left and right sub-networks After passing through the matrix of dimension 1 of the fully connected layer, it is connected to the sigmoid activation function and finally outputs a similarity probability value from 0 to 1.

[0104] S50: If the similarity probability values ​​of the first case text and the second case text meet the set similarity threshold, the first case text and the second case text are determined to be similar cases.

[0105] In this embodiment, the similarity threshold is 0.5. If the similarity probability value between the second case text and the first case text is greater than 0.5, the case texts of the two cases are considered similar. If it is less than 0.5, the case contents of the two cases are considered dissimilar.

[0106] By adopting ERNIE technology, the present invention can better understand the meaning of polysemous words in the text by combining the context, perform case similarity analysis based on the twin neural network, and combine the attention mechanism to perform key feature analysis on nouns in the field of case particularity, thereby enhancing the model's understanding of the case content and improving the effectiveness and accuracy of case similarity matching.

[0107] Figure 2 1 is a schematic block diagram of a case similarity matching device 100 provided in a specific embodiment of the present invention. Corresponding to the above-mentioned case similarity matching method, a specific embodiment of the present invention further provides a case similarity matching device 100. The case similarity matching device 100 includes a unit for executing the above-mentioned case similarity matching method, and the device can be configured in a server.

[0108] like Figure 2 As shown, the case similarity matching device 100 includes an acquisition unit 110 , a generation unit 120 , a selection unit 130 , a processing unit 140 and a determination unit 150 .

[0109] The acquisition unit 110 is used to acquire the case judgment text in the case database.

[0110] In this embodiment, the case database refers to a database used for court case judgments.

[0111] The generating unit 120 is used to collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary library and a special word vocabulary library.

[0112] In this embodiment, due to the revision of laws and regulations and other factors, some words will be stopped. In addition, with the development of technology, new special terms will appear. Therefore, the stopped words and special terms can be collected from the case judgment text, and a stop word vocabulary library and a special word vocabulary library can be established for them to facilitate the subsequent text similarity analysis.

[0113] The selection unit 130 is used to select a first case text and a second case text that need to be matched for similarity from the case judgment text.

[0114] Before selecting, you can set selection conditions, for example, select similarity matching text based on content related to the case description and case conclusion.

[0115] Of course, it should be noted that the first case text and the second case text do not just refer to the similarity matching between one first case text and one second case text, but can also refer to the similarity matching between one first case text and multiple second case texts. If a first case text is matched with a second case text for similarity, it can be concluded whether the two are similar. If a first case text is matched with multiple second case texts for similarity, it can be concluded how close the similarity is between the multiple second case texts and the first case text, and they can be sorted according to the closeness of the similarity to facilitate personnel to conduct case analysis.

[0116] The processing unit 140 is used to input the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text.

[0117] In this embodiment, the twin network is divided into two identical and parallel left and right sub-networks, each of which includes a network model of text vectors based on ERNIE, a network model of text vectors based on WordGCN graphs, and a network model of text vectors based on keywords. The first case text can be processed by the left sub-network, and the second case text can be processed by the right sub-network.

[0118] In one embodiment, the processing unit 140 includes a first processing module, a second processing module, a third processing module, a merging module, a fourth processing module, a calculation module, a fifth processing module, and a sixth processing module.

[0119] The first processing module is used to input the first case text and the second case text into the network model of the text vector based on ERNIE for processing, so as to obtain the first processing features of the first case text and the second case text.

[0120] The network model of text vector based on ERNIE is to train all cases through the ERNIE model to obtain the word vector of each word. The training method adopts the form of fine-tuning to train the word vector.

[0121] In one embodiment, the first processing module includes a segmentation submodule, a word segmentation submodule, a first processing submodule, an operation submodule, and a fusion submodule.

[0122] The segmentation submodule is used to segment sentences according to the sentence segmentation symbols of the text content in the first case text and the second case text.

[0123] The word segmentation submodule is used to segment the sentence by using the word segmentation tool in combination with the stop word vocabulary and the proprietary word vocabulary to obtain the word segmentation data.

[0124] The first processing submodule is used to process the word segmentation data based on MLM through ERNIE to obtain the word vector of each word.

[0125] The operator module is used to sum the word vectors of each word in each sentence to obtain a feature vector of the sentence vector.

[0126] The fusion submodule is used to concatenate and fuse the feature vectors of all sentence vectors of the text content through Bi-LSTM to obtain the first processing features of the first case text and the second case text.

[0127] For the segmentation submodule, word segmentation submodule, processing submodule, operation submodule and fusion submodule, in this embodiment, the sentence segmentation is first performed based on the sentence segmentation symbols in the text, and then the sentence is segmented by the word segmentation tool. The sequence length in the sentence is selected to be 16 words. The text sequence exceeding the word length is truncated, and the text sequence shorter than the sequence length is padded by padding. It should also be noted that the analysis of proper nouns needs to be combined with the proper noun vocabulary to segment the word to avoid internal segmentation of the proper nouns. For the position encoding in the transformer mechanism in ERNIE, if the position of the word in the text is an even number, it is used , if the word is in an odd position in the base Position indicates the position of a word in a sentence, and i is the dimension range of the word vector, which ranges from 0 to 64.

[0128] The word vector of each word can be obtained by training the ERNIE model based on the MLM (Masked Language Model) method. A sentence has multiple words. The feature vector of the sentence vector is obtained by adding multiple words, and all sentence vectors are concatenated to obtain the text vector. The length of the text vector is selected as 500, that is, 500 sentences are selected, and sentences exceeding this length are truncated, so that a sentence vector with a length of 500 and a dimension of 64 based on the word vector can be obtained. .Will Input into Bi-LSTM to get text vector .

[0129] The second processing module is used to input the first case text and the second case text into the network model of the text vector based on the WordGCN graph for processing to obtain the second processing features of the first case text and the second case text.

[0130] In one embodiment, the second processing module includes an encoding submodule, a construction submodule and a second processing submodule.

[0131] The encoding submodule is used to encode the words of the first case text and the second case text through the relationship between words at the sentence level and the corpus level in the WordGCN model to obtain word vectors.

[0132] The construction submodule is used to construct sentence vectors based on word vectors.

[0133] The second processing submodule is used to input the sentence vector into the Bi-GRU for processing to obtain the second processing features of the first case text and the second case text.

[0134] For the encoding submodule, the construction submodule and the second processing submodule, in this embodiment, the WordGCN model is selected to represent the sentence model. The words are encoded by the relationship between words at the sentence level and the corpus level. The sentence encoding is performed by word segmentation and fixed sentence length. The sentence length is set to 16 words. If the sentence length exceeds the length, it is truncated. If it does not exceed the length, it is padded by panning. The sentence vector is still obtained by adding word vectors. The length of the text vector is 500, and sentences exceeding this length are truncated. In this way, a sentence vector with a length of 500 and a dimension of 64 based on the word vector can be obtained. .Will Input into Bi-GRU to get text vector .

[0135] The third processing module is used to input the first case text and the second case text into the network model based on the text vector of the subject word for processing, so as to obtain the third processing features of the first case text and the second case text.

[0136] In one embodiment, the third processing module includes a filtering submodule, a first extracting submodule, a first recording submodule, a second extracting submodule, a second recording submodule, and a calculating submodule.

[0137] The filtering submodule is used to filter the stop words in the first case text and the second case text through a stop word vocabulary library.

[0138] The first extraction submodule is used to extract the subject words of the filtered text.

[0139] The first recording submodule is used to record the position index and importance degree corresponding to the extracted subject words.

[0140] The second extraction submodule is used to extract proper nouns from the first case text and the second case text through a proper word vocabulary.

[0141] The second recording submodule is used to record the position index and importance degree corresponding to the extracted proper noun.

[0142] The calculation submodule is used to perform an addition operation on the importance degree of the subject word and the importance degree of the proper noun to obtain a third processing feature.

[0143] For the filtering submodule, the first extraction submodule, the first recording submodule, the second extraction submodule, the second recording submodule and the calculation submodule, in this embodiment, the stop words in the text are first filtered through the stop word vocabulary library, and the case subject words are extracted using the subject word model based on the records after the above word segmentation to obtain the subject words in the case. The subject word vocabulary adopts BERTopic, and c-tf-idf is used internally. It is based on the number of case categories rather than the number of documents for keyword extraction, and the LDA model is also used to extract subject words from the case content. Based on the subject words extracted by the two methods, the position index corresponding to the subject word and the importance of the vocabulary are recorded, and the importance range is 0 to 1. Then, the proper nouns in the case text are extracted through the case proper word vocabulary library, and the position index corresponding to the proper nouns is recorded. The importance of the proper nouns is uniformly set to 0.5. The special word position index is generated by the union of the subject word position index and the proper noun position index. The attention weight matrix is ​​obtained by adding these subject word importances. , the matrix size is 16x500.

[0144] The merging module is used to concatenate and merge the first processing features of the first case text and the second case text and the second processing features of the first case text and the second case text to obtain the merged features of the first case text and the second case text.

[0145] In this embodiment, and Concatenate to get features .

[0146] The fourth processing module is used to input the combined features of the first case text and the second case text into the fully connected layer for processing to obtain the fully connected layer processed features of the first case text and the second case text.

[0147] In this embodiment, Input to the fully connected layer to get features .

[0148] The operation module is used to multiply the fully connected layer processing features of the first case text and the second case text with the third processing features of the first case text and the second case text to obtain the text semantic representation features of the first case text and the second case text.

[0149] In this embodiment, Matrix and Attention Matrix Multiply to get the final text semantic representation .

[0150] The fifth processing module is used to perform full connection layer and activation function processing on the text semantic representation features of the first case text and the second case text to obtain the text abstract semantic representation of the first case text and the second case text.

[0151] In this embodiment, the semantic representation Connect to a fully connected layer and activation function and then connect to another fully connected layer to get the abstract semantic representation of the text .

[0152] The sixth processing module is used to process the text abstract semantic representations of the first case text and the second case text through a matrix of a fully connected layer with a dimension of 1 and a sigmoid activation function to obtain a similarity probability value between the first case text and the second case text.

[0153] In this embodiment, the text abstract semantic representation obtained by the left and right sub-networks After passing through the matrix of dimension 1 of the fully connected layer, it is connected to the sigmoid activation function and finally outputs a similarity probability value from 0 to 1.

[0154] The determination unit 150 is configured to determine that the first case text and the second case text are similar cases if the similarity probability values ​​of the first case text and the second case text meet a set similarity threshold.

[0155] In this embodiment, the similarity threshold is 0.5. If the similarity probability value between the second case text and the first case text is greater than 0.5, the case texts of the two cases are considered similar. If it is less than 0.5, the case contents of the two cases are considered dissimilar.

[0156] By adopting ERNIE technology, the present invention can better understand the meaning of polysemous words in the text by combining the context, perform case similarity analysis based on the twin neural network, and combine the attention mechanism to perform key feature analysis on nouns in the field of case particularity, thereby enhancing the model's understanding of the case content and improving the effectiveness and accuracy of case similarity matching.

[0157] The case similarity matching device 100 can be implemented in the form of a computer program. The computer program can be implemented in Figure 3 Runs on the computer device shown.

[0158] See also Figure 3 , Figure 3 5 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a server, wherein the server may be an independent server or a server cluster composed of multiple servers.

[0159] like Figure 3 As shown, the computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of the case similarity matching method as described above are implemented.

[0160] The computer device 700 may be a terminal or a server. The computer device 700 includes a processor 720 , a memory, and a network interface 750 connected via a system bus 710 , wherein the memory may include a non-volatile storage medium 730 and an internal memory 740 .

[0161] The non-volatile storage medium 730 may store an operating system 731 and a computer program 732. When the computer program 732 is executed, the processor 720 may execute any case similarity matching method.

[0162] The processor 720 is used to provide computing and control capabilities and support the operation of the entire computer device 700.

[0163] The internal memory 740 provides an environment for the operation of the computer program 732 in the non-volatile storage medium 730. When the computer program 732 is executed by the processor 720, the processor 720 can execute any case similarity matching method.

[0164] The network interface 750 is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will appreciate that Figure 3 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 700 to which the solution of the present application is applied. The specific computer device 700 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components. The processor 720 is used to run the program code stored in the memory to implement the following steps:

[0165] Obtain the case judgment text from the case database;

[0166] Collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary and a special word vocabulary;

[0167] Selecting a first case text and a second case text to be matched for similarity from the case judgment text;

[0168] Inputting the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text;

[0169] If the similarity probability values ​​of the first case text and the second case text meet the set similarity threshold, the first case text and the second case text are determined to be similar cases.

[0170] In one embodiment: the first case text and the second case text are input into the twin network for processing to obtain similarity probability values ​​of the first case text and the second case text, and the twin network includes a network model of text vectors based on ERNIE, a network model of text vectors based on WordGCN graphs, and a network model of text vectors based on keywords.

[0171] In one embodiment: the step of inputting the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text includes:

[0172] Inputting the first case text and the second case text into the network model of the text vector based on ERNIE for processing, so as to obtain the first processing features of the first case text and the second case text;

[0173] Inputting the first case text and the second case text into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text;

[0174] Inputting the first case text and the second case text into a network model based on a text vector of a subject word for processing, so as to obtain a third processing feature of the first case text and the second case text;

[0175] Perform concatenation processing on the first processing feature of the first case text and the second case text and the second processing feature of the first case text and the second case text to obtain a combined feature of the first case text and the second case text;

[0176] Inputting the combined features of the first case text and the second case text into the fully connected layer for processing to obtain fully connected layer processed features of the first case text and the second case text;

[0177] Performing a multiplication operation on the fully connected layer processed features of the first case text and the second case text and the third processed features of the first case text and the second case text to obtain text semantic representation features of the first case text and the second case text;

[0178] Performing full connection layer and activation function processing on the text semantic representation features of the first case text and the second case text to obtain the text abstract semantic representation of the first case text and the second case text;

[0179] The text abstract semantic representations of the first case text and the second case text are processed by a matrix of a fully connected layer with a dimension of 1 and a sigmoid activation function to obtain similarity probability values ​​between the first case text and the second case text.

[0180] In one embodiment, the step of inputting the first case text and the second case text into a network model based on an ERNIE text vector for processing to obtain first processing features of the first case text and the second case text includes:

[0181] Sentence segmentation is performed according to the sentence segmentation symbols of the text content in the first case text and the second case text;

[0182] Segment the sentences using a word segmentation tool combined with a stop word vocabulary and a proprietary word vocabulary to obtain word segmentation data;

[0183] The word segmentation data is processed by ERNIE based on MLM to obtain the word vector of each word;

[0184] Sum the word vectors of each word in each sentence to get the feature vector of the sentence vector;

[0185] The feature vectors of all sentence vectors of the text content are concatenated and fused through Bi-LSTM to obtain the first processing features of the first case text and the second case text.

[0186] In one embodiment, the step of inputting the first case text and the second case text into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text includes:

[0187] Encode the words of the first case text and the second case text through the relationship between words at the sentence level and the corpus level in the WordGCN model to obtain word vectors;

[0188] Construct sentence vectors based on word vectors;

[0189] The sentence vector is input into Bi-GRU for processing to obtain the second processing features of the first case text and the second case text.

[0190] In one embodiment, the step of inputting the first case text and the second case text into a network model based on a text vector of a subject word for processing to obtain a third processing feature of the first case text and the second case text includes:

[0191] The stop words in the texts of the first case text and the second case text are filtered using a stop word vocabulary library;

[0192] Extract the subject words from the filtered text;

[0193] Record the position index and importance of the extracted keywords;

[0194] Extracting proper nouns from the first case text and the second case text using a proper word vocabulary;

[0195] Record the position index and importance level of the extracted proper nouns;

[0196] The importance degree of the subject word and the importance degree of the proper noun are added together to obtain the third processing feature.

[0197] In one embodiment, the topic words of the filtered text are extracted by combining the BERTopic model with the LDA model.

[0198] It should be understood that in the embodiment of the present application, the processor 720 may be a central processing unit (CPU), and the processor 720 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0199] Those skilled in the art will understand that Figure 3 The structure of the computer device 700 shown in the figure does not constitute a limitation on the computer device 700, and the computer device 700 may include more or less components than shown in the figure, or combine some components, or arrange the components differently.

[0200] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the case similarity matching method disclosed in the embodiment of the present invention is implemented.

[0201] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.

Claims

1. A case similarity matching method, characterized in that: include: Obtain the case judgment text from the case database; Collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary and a special word vocabulary; Selecting a first case text and a second case text to be matched for similarity from the case judgment text; Inputting the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text; If the similarity probability values ​​of the first case text and the second case text meet the set similarity threshold, the first case text and the second case text are determined to be similar cases; The first case text and the second case text are input into the twin network for processing to obtain a similarity probability value of the first case text and the second case text, wherein the twin network includes a network model of a text vector based on ERN IE, a network model of a text vector based on a WordGCN graph, and a network model of a text vector based on a keyword; The step of inputting the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text includes: Inputting the first case text and the second case text into a network model of a text vector based on ERN IE for processing to obtain first processing features of the first case text and the second case text; Inputting the first case text and the second case text into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text; Inputting the first case text and the second case text into a network model based on a text vector of a subject word for processing, so as to obtain a third processing feature of the first case text and the second case text; Perform concatenation processing on the first processing feature of the first case text and the second case text and the second processing feature of the first case text and the second case text to obtain a combined feature of the first case text and the second case text; Inputting the combined features of the first case text and the second case text into the fully connected layer for processing to obtain fully connected layer processed features of the first case text and the second case text; Performing a multiplication operation on the fully connected layer processed features of the first case text and the second case text and the third processed features of the first case text and the second case text to obtain text semantic representation features of the first case text and the second case text; Performing full connection layer and activation function processing on the text semantic representation features of the first case text and the second case text to obtain the text abstract semantic representation of the first case text and the second case text; The text abstract semantic representations of the first case text and the second case text are processed by a matrix of a fully connected layer with a dimension of 1 and a si gmo id activation function to obtain the similarity probability value between the first case text and the second case text.

2. The case similarity matching method according to claim 1, characterized in that: The step of inputting the first case text and the second case text into a network model of a text vector based on ERN IE for processing to obtain first processing features of the first case text and the second case text includes: Sentence segmentation is performed according to the sentence segmentation symbols of the text content in the first case text and the second case text; Segment the sentences using a word segmentation tool combined with a stop word vocabulary and a proprietary word vocabulary to obtain word segmentation data; The word segmentation data is processed based on MLM through ERN IE to obtain the word vector of each word; Sum the word vectors of each word in each sentence to get the feature vector of the sentence vector; The feature vectors of all sentence vectors of the text content are concatenated and fused through Bi-LSTM to obtain the first processing features of the first case text and the second case text.

3. The case similarity matching method according to claim 1, characterized in that: The step of inputting the first case text and the second case text into a network model of a text vector based on a WordGCN graph for processing to obtain second processing features of the first case text and the second case text includes: Encode the words of the first case text and the second case text through the relationship between words at the sentence level and the corpus level in the WordGCN model to obtain word vectors; Construct sentence vectors based on word vectors; The sentence vector is input into Bi-GRU for processing to obtain the second processing features of the first case text and the second case text.

4. The case similarity matching method according to claim 1, characterized in that: The step of inputting the first case text and the second case text into a network model based on a text vector of a subject word for processing to obtain a third processing feature of the first case text and the second case text includes: The stop words in the texts of the first case text and the second case text are filtered using a stop word vocabulary library; Extract the subject words from the filtered text; Record the position index and importance of the extracted keywords; Extracting proper nouns from the first case text and the second case text using a proper word vocabulary; Record the position index and importance level of the extracted proper nouns; The importance degree of the subject word and the importance degree of the proper noun are added together to obtain the third processing feature.

5. The case similarity matching method according to claim 4, characterized in that: The subject words of the filtered text are extracted by combining the BERTopic model with the LDA model.

6. A case similarity matching device, which executes the case similarity matching method according to any one of claims 1 to 5 when running, characterized in that: It includes an acquisition unit, a generation unit, a selection unit, a processing unit and a determination unit; The acquisition unit is used to acquire the case judgment text from the case database; The generating unit is used to collect stop words and special nouns from the case judgment text, and generate a stop word vocabulary library and a special word vocabulary library; The selection unit is used to select a first case text and a second case text that need to be matched for similarity from the case judgment text; The processing unit is used to input the first case text and the second case text into the twin network for processing to obtain a similarity probability value between the first case text and the second case text; The determination unit is configured to determine that the first case text and the second case text are similar cases if the similarity probability values ​​of the first case text and the second case text meet a set similarity threshold.

7. A computer device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method steps of case similarity matching as claimed in any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the case similarity matching method according to any one of claims 1 to 5.