Small sample judicial trial document entity extraction method, system and storage medium
Through data enhancement and feature fusion technology, using BiLSTM and CRF models, the problem of insufficient training samples in judicial trial documents was solved, and high-accuracy entity and entity type extraction was achieved.
Patent Information
- Application Number
- CN202411779498.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2044-12-05
AI Technical Summary
There are insufficient training samples in judicial trial documents and the accuracy of entity and entity type extraction is low.
Enhanced data is generated through data augmentation technology, combined with the BERT language model and Word2Vec word vector model, and BiLSTM and CRF models for feature fusion and label prediction to generate entity and entity type sequences.
It improves the accuracy of entity and entity type recognition in the absence of training samples, and achieves accurate recognition of various entities in judicial documents.
Smart Images

Figure CN119647476B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing technology, and in particular to a method, system and storage medium for extracting entities from judicial trial documents using a small number of samples. Background Art
[0002] During civil, criminal, and administrative trials, judges review a variety of materials, such as indictment documents, evidence materials, and prosecutorial documents, to understand case information. This material primarily consists of structured and semi-structured data. Extracting the essential elements of a legal case requires significant manpower, which is not only inefficient but also susceptible to subjective judgment.
[0003] With the continuous advancement of technologies such as natural language processing and big data analysis, relevant technicians have developed a number of tools that can extract case elements, which provides convenience for judicial personnel. For example, Chinese invention patent application publication number CN118364047A provides an entity relationship extraction model training, entity relationship extraction method, device, and equipment. This method collects text data and labels each text unit as an entity and the relationship between entities; uses the labeled text samples to train the entity relationship extraction model so that it learns to identify entities and their relationships; uses a feature mapping network to convert text units into feature vectors; and uses a global pointer network to analyze the feature vector sequence, predict entity relationships, and generate an entity relationship prediction matrix. Although this solution can identify entity information and logical relationships between entities from text data, it does not take into account the insufficient number of training samples and the diverse features of each module in the file, resulting in low accuracy in entity and entity type recognition. Summary of the Invention
[0004] Based on this, it is necessary to provide a retrieval system and method for extracting entities and entity types from civil complaints in judicial trial documents with a small number of samples to address the problems of insufficient training samples and low accuracy of entity and entity type extraction in existing judicial trial documents and civil complaints.
[0005] A method for extracting entities from judicial trial documents using a small number of samples is disclosed. In the absence of training samples, all models are trained, and entities and entity types from judicial trial documents are extracted using the trained models. The method for training the models includes the following steps:
[0006] Performing data augmentation on training samples to generate augmented data; the data augmentation method includes: retaining the entity category label, masking the entity and context, and generating augmented data; changing the entity category label to mask the predicted entity and context, and generating augmented data; adding an entity category, performing masked prediction of the entity and context, and generating augmented data;
[0007] Screening the generated enhanced data: deleting the enhanced data whose entity category does not match the specific entity, and retaining the enhanced data whose entity category matches the specific entity;
[0008] Mixing the filtered enhanced data with the training samples and inputting them together as training samples for the model;
[0009] Extracting entities and entity types from judicial trial documents involves the following steps:
[0010] The judicial trial document consists of L sentences, each of which consists of M words. The sentence is input into the language processing model to generate three embedding vectors: context-dependent embedding feature vector Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector The three embedding vectors are combined into a feature fusion vector t i ;
[0011] The feature fusion vector t i Input into the BiLSTM model to obtain the feature fusion vector t containing bidirectional sequence information i ';
[0012] The feature fusion vector t i ′ is input into the feedforward neural network for BIEOU tag prediction and generates the prediction sequence Y of the word BIEOU tag in all sentences L ={y1,y2,…,y M}, where Y L Represents the BIEOU tag sequence of the sentence, y M Indicates the type of BIEOU label to which the Mth word in the sentence belongs;
[0013] The feature fusion vector t i ′ is input into the CRF model to calculate the possible probability distribution of the entity type of each word, and then the entity type with the highest probability is selected as the entity type of the word to generate the entity type sequence z of the word in each sentence L ={z1,z2,…,z M}, where z L The entity type sequence representing the sentence, z MIndicates the entity type of the Mth word in the sentence;
[0014] According to the prediction sequence Y L ={y1,y2,…,y M} Extract entities from all sentences in judicial trial documents; according to entity type sequence z L ={z1,z2,…,z M} Extract the entity's type.
[0015] As a preferred example, the formula for mixing the enhanced data with the original training samples is:
[0016]
[0017] a~U(1,A) b~U(1,B) x~U(1,C) y~U(1,C)
[0018] Where s aug represents the mixed training samples, represents the kth sentence randomly selected from the training sample, represents the qth sentence randomly extracted from the augmented data, x represents the number of sentences randomly extracted from the original training sample, y represents the number of sentences randomly extracted from the original training sample, A is the number of sentences in the original training sample, B is the number of sentences in the augmented dataset, C represents the maximum number of sentences that can be connected, U(1, A), U(1, B) and U(1, C) represent randomly selecting a number from 1 to A, 1 to B and 1 to C respectively, a is the sequence number of the sentence randomly extracted from the original training sample, and b is the sequence number of the sentence randomly extracted from the augmented dataset.
[0019] As a preferred example, the language processing model includes a BERT language model and a Word2Vec word vector model; the sentence generates an embedded feature vector through the BERT language model The sentence generates an embedded feature vector through the Word2Vec word vector model
[0020] As a preferred example, the sentence introduces pattern features, which are used to capture the intrinsic word shape of entity mentions at the subword level; the pattern features are encoded and sequentially input into CNN and BiLSTM models to obtain the pattern feature embedding feature vector
[0021] As a preferred example, the feature fusion vector t containing bidirectional sequence information is obtained i 'The method comprises the following steps:
[0022] The feature fusion vector t iInput into the BiLSTM model to get the forward hidden state and the backward hidden state
[0023]
[0024] The forward hidden state and the backward hidden state Splicing to obtain feature fusion vector t i ′:
[0025]
[0026] Where, [t1,t2,…,t M ] is a sentence sequence after feature fusion, and ⊕ represents a vector connection operation.
[0027] As a preferred example, generate the predicted sequence Y L ={y1,y2,…,y M The method comprises the following steps:
[0028] Calculate the probability P of each word in the sentence with respect to the BIEOU label i :
[0029] P i =softmax(FFN(t i ′))
[0030] In the formula, softmax is the softmax function, FFN is the feedforward neural network;
[0031] Choose the word with probability P i The largest BIEOU tag is used as the BIEOU tag of the word:
[0032] y i =argmax(P i )
[0033] Where y i represents the BIEOU label of the i-th word in the sentence, and argmax is the argmax function;
[0034] Get the predicted sequence Y based on the BIEOU tag results of the word L ={y1,y2,…,y M}.
[0035] As a preferred example, generate entity type sequence z L ={z1,z2,…,z M The method comprises the following steps:
[0036] Calculate the probability Q of each word in the sentence belonging to each predefined entity type i :
[0037] Q i =CRF(t i ′)
[0038] Where, CRF is the CRF model;
[0039] Choose the word with probability Q i The largest entity type is used as the entity type of the word:
[0040] z i =Viterbi(Q i )
[0041] Where z i Indicates the entity type of the i-th word in the sentence, and Viterbi is the Viterbi algorithm;
[0042] Get the entity type sequence z according to the entity type result of the word L ={z1,z2,…,z M}.
[0043] As a preferred example, the entity type of the word is a predefined entity type, which includes: court, business entity, government agency, regulations, suspect, victim, crime tool, stolen items, item value, legal name, judge, plaintiff, defendant, political entity, employer, individual business owner and job position.
[0044] A system for extracting entities from a small number of judicial trial documents, which uses the above-mentioned method for extracting entities from a small number of judicial trial documents; the entity extraction system includes:
[0045] A training module is used to perform data augmentation on training samples to generate augmented data, and then filter the generated augmented data; the filtered augmented data is mixed with the training samples to train the model together;
[0046] The vectorization module is used to generate three embedding vectors for each sentence in the judicial trial document, which are the context-related embedding feature vectors Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector Then the three embedding vectors are combined into a feature fusion vector t i ;
[0047] Entity extraction module, which is used to fusion vector t according to the feature i Generate a prediction sequence Y for the word BIEOU label in all sentencesL ={y1,y2,…,y M};
[0048] Entity type extraction module, which is used to fusion vector t according to the feature i Generate entity type sequence z for each word in the sentence L ={z1,z2,…,z M}.
[0049] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the entity extraction method in a few-sample judicial trial document as described above.
[0050] The beneficial effects of the present invention are:
[0051] 1. This paper uses data augmentation technology to expand the training dataset by retaining entity class label mask entities, changing entity class label predicted entities, and adding new entity class mask predictions. The augmented data is then mixed with the original data and fed into a language model for training, thus addressing the problem of insufficient training samples in civil complaints in judicial trial documents.
[0052] 2. The present invention uses a language model to generate embedding vectors of context-related, part-of-speech and pattern features. These vectors are fused into feature fusion vectors. Subsequently, the feature fusion vectors are input into the Bi-LSTM network to capture bidirectional information, and combined with the feedforward neural network FFN to predict the BIEOU label to generate a prediction sequence. At the same time, the output of the Bi-LSTM is also input into the conditional random field (CRF) layer to select the most likely entity type based on probability. Finally, entities are extracted according to the prediction sequence, and the label frequency output by the CRF is used to determine the entity type, such as a person's name, place, etc., to achieve accurate recognition of various entities in judicial documents. Compared with existing solutions, the solution of the present invention can accurately identify entity information and entity types from semi-structured text data. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1 Flowchart for data augmentation;
[0054] Figure 2 This is an overall flow chart of a small sample entity extraction method for judicial trial documents;
[0055] Figure 3 Flowchart for entity and entity type extraction in a few-sample entity extraction method for judicial trial documents. DETAILED DESCRIPTION
[0056] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only 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 making creative efforts are within the scope of protection of the present invention.
[0057] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this invention pertains. The terms used herein in the specification of the present invention are for the purpose of describing specific embodiments only and are not intended to limit the present invention. The term "or / and" as used herein includes any and all combinations of one or more of the associated listed items.
[0058] This embodiment provides a method for extracting entities from a small number of judicial trial documents. In the absence of training samples, all models are trained, and then the entities and entity types in the case information based on the trial materials are identified and extracted through the trained models. First, the models involved need to be pre-trained. However, since a certain type of judicial trial document may have too few samples, the pre-training lacks a large amount of data (i.e., training samples) to train the model. Therefore, this solution uses a data enhancement method to train our model. The method for training the model includes the following steps:
[0059] Performing data enhancement on the training samples to generate enhanced data; screening the generated enhanced data; and mixing the screened enhanced data with the training samples to input the two data sets as training samples for the model.
[0060] Please refer to Figure 1 , when performing data augmentation, three methods are used simultaneously for data augmentation. The first is to retain the entity type label, mask the entity and context, and generate augmented data. The second is to change the entity category label to mask the predicted entity and context, and generate augmented data. The third is to add an entity category, perform mask prediction of the entity and context, and generate augmented data. The following example is a detailed explanation: randomly select an entity segment from a sentence. When using the first method, mask the entity and part of the context segment around it. By masking and regenerating the entity and its context, the entity diversity is increased while maintaining the consistency of the entity type. For example: [Zhang SAN|person]and[li Si|person] <mask> [ <mask>|person] <mask>The enhanced data generated by the first method is: [Zhang SAN|person]and[li Si|person]robed[LiuBei|person]'s phone. The enhanced data generated by the second method is: [Zhang SAN|person]and[li Si|person]looted[phone|thing]from <liubei>The third method randomly selects an entity segment from the sentence and adds an entity category to generate the entity mask prediction. By adding new entities and contexts to the sentence, the entity diversity and context diversity are increased. For example, [Zhang SAN|person]and[li Si|person]stole[LiuBei|person] <mask> [ <mask>|thing] <mask>The enhanced data generated by the third method is [Zhang SAN|person]and[li Si|person]stole[LiuBei|person]'s[watch|thing]and phone. Delete the enhanced data whose entity category does not match the specific entity, and retain the enhanced data whose entity category matches the specific entity. It is best to mix the filtered enhanced data with the original data (original training samples). The purpose of mixing is to prevent the model from being biased towards short sequences, making the final trained model results inaccurate. The mixing formula is as follows:
[0061]
[0062] a~U(1,A) b~U(1,B) x~U(1,C) y~U(1,C)
[0063] Where s aug Represents the mixed training samples. represents the kth sentence randomly selected from the training sample. represents the qth sentence randomly sampled from the augmented data. x represents the number of sentences randomly sampled from the original data. y represents the number of sentences randomly sampled from the original data. A is the number of sentences in the original dataset. B is the number of sentences in the augmented dataset. C is a hyperparameter representing the maximum number of sentences that can be concatenated. U(1, A), U(1, B), and U(1, C) all represent uniform distributions, i.e., randomly selecting a number from 1 to A, 1 to B, and 1 to C, respectively. a is the sequence number of the sentence randomly sampled from the original dataset. b is the sequence number of the sentence randomly sampled from the augmented dataset.
[0064] The above data enhancement method is used to pre-train the model used later. After training, the model is used to extract entities and entity types in judicial trial documents, such as Figure 2 and Figure 3 As shown, the extraction method comprises the following steps:
[0065] S1. Input a judicial trial document containing L sentences into the language processing model. Each sentence consists of M words. The language processing model is fed with sentences as units, and three embedding vectors are extracted for each sentence: the context-dependent embedding feature vector Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector The three embedding vector sets are then concatenated into a feature fusion vector ⊕ represents a vector connection operation, such as connecting these vectors end to end. In this step, It can be generated by the pre-trained BERT language model. The BERT language model can provide context-sensitive embeddings based on large amounts of text data, capturing the complex relationships between words. It can be generated by the pre-trained Word2Vec word vector model. The Word2Vec word vector model is trained on a large amount of text to obtain a vector representation of each word, which is used to capture the semantic information of the word.
[0066] The key point in the above embedding vector is to embed the pattern feature into the feature vector Introduction of . A civil complaint in a judicial trial typically consists of four parts: plaintiff, defendant, claim, facts, and grounds. For example, Plaintiff: xx, male / female, x-ethnic group, born on xx / xx / xx, currently residing at Room xx, Building xx, xx Community, xx Road, xx District, xx City, Citizen ID number: xx, Contact number: xx. Defendant 1: xx, male / female, x-ethnic group, born on xx / xx / xx, currently residing at Room xx, Building xx, xx Community, xx Road, xx District, xx City, Citizen ID number: xx, Contact number: xx. Defendant 2: xx, male / female, x-ethnic group, born on xx / xx / xx, currently residing at Room xx, Building xx, xx Community, xx Road, xx District, xx City, Citizen ID number: xx, Contact number: xx. Because the plaintiff and defendant's content includes phone numbers, ID numbers, ages, and residential addresses, and contains a large number of numbers and region names, the writing of this content has fixed characteristics, so pattern features are introduced. The purpose of introducing this feature is to capture specific forms such as phone numbers, ID numbers, and home addresses, such as mobile phone numbers, ID numbers, and regions. Map all uppercase tokens to a single character 'U'. Map all lowercase tokens to 'L'. Map all numeric tokens to 'D'. If a token contains a mixture of uppercase, lowercase, and numeric characters, map each lowercase letter to 'l', uppercase letters to 'u', and numeric characters to 'd'. After encoding, it enters a three-layer CNN model with convolution kernels ranging from 1 to 3, and then is fed into a BiLSTM model to generate the above-mentioned pattern feature embedding feature vector. The CNN model (Convolutional Neural Network) is a deep learning model. At the core of a CNN is the convolutional layer, which captures local features of the input data through filters, or convolution kernels. A CNN uses three one-dimensional convolutional neural networks with kernel sizes ranging from 1 to 3. These CNNs are used to learn pattern features from the mapped tags. The BiLSTM model is a variant of a recurrent neural network (RNN) that is very effective at processing sequential data, such as text and time series. At the core of the BiLSTM model is the LSTM unit, which is able to capture long-term dependencies in sequential data.
[0067] S2, feature fusion vector t i Input into the BiLSTM model to obtain the feature fusion vector t containing bidirectional sequence information i ′.
[0068] In this step, the feature fusion vector t i Input into the BiLSTM model to get the forward hidden state and the backward hidden state
[0069]
[0070] The forward hidden state and the backward hidden state Splicing to obtain feature fusion vector t i ′:
[0071]
[0072] Where, [t1,t2,…,t M ] is a sentence sequence after feature fusion. ⊕ represents a vector concatenation operation.
[0073] S3, then the feature fusion vector t i ′ is input into the feedforward neural network for BIEOU tag prediction and generates the prediction sequence Y of the word BIEOU tag in all sentences L ={y1,y2,…,y M }. At the same time, the feature fusion vector t i ′ is input into the CRF model to calculate the possible probability distribution of the entity type of each word, and then the entity type with the highest probability is selected as the entity type of the word to generate the entity type sequence z of the word in each sentence L ={z1,z2,…,z M }, where z L The entity type sequence representing the sentence, z M Represents the entity type of the Mth word in the sentence.
[0074] The BIEOU tag used in this step is a tagging system used for named entity recognition tasks in natural language processing. This system expands the traditional BIE tagging method to better handle nested and overlapping named entities and can also tag single-word entities. Among them, B represents the beginning of the named entity. The outer layer of each entity begins with B. I represents the inner part of the named entity, but does not include the beginning and end. It is used for the middle part of consecutive named entities. E represents the end of the named entity. For nested entities, the end of the outer entity is marked with E. O represents the non-entity part in the text. U is used to tag single-word entities.
[0075] Specifically, generate the prediction sequence Y L ={y1,y2,…,y M The method comprises the following steps:
[0076] Calculate the probability P of each word in the sentence with respect to the BIEOU label i :
[0077] P i =softmax(FFN(t i ′))
[0078] Where softmax is the softmax function, which is a function that converts a real vector into a probability distribution. FFN is a feedforward neural network that is used to predict the label probability of each tag from the hidden state of LSTM. The probability P i It represents the use of FFN and softmax to convert the hidden state into a probability distribution to predict the probability that a word in a sentence belongs to one of the five types of entity BIEOU.
[0079] Choose the word with probability P i The largest BIEOU tag is used as the BIEOU tag of the word:
[0080] y i =argmax(P i )
[0081] Where y i The BIEOU label for the i-th word in the sentence is a fixed value. argmax is the argmax function, which returns the argument that maximizes the function.
[0082] Get the predicted sequence Y based on the BIEOU tag results of the word L ={y1,y2,…,y M },y M Represents the BIEOU label type of the Mth word in the sentence.
[0083] In addition, the entity type sequence z is generated L ={z1,z2,…,z M The method comprises the following steps:
[0084] Calculate the probability Q of each word in the sentence belonging to each predefined entity type i :
[0085] Q i =CRF(t i ′)
[0086] Where CRF is a CRF model, which is often used to process sequence data, especially in the field of natural language processing (NLP) for sequence labeling tasks such as part-of-speech tagging and named entity recognition. The CRF model considers dependencies to predict the probability distribution of which type of entity each word in a sentence belongs to.
[0087] Choose the word with probability Q i The largest entity type is used as the entity type of the word:
[0088] Z i =Viterbi(Q i )
[0089] Where z i Represents the entity type of the i-th word in the sentence, and Viterbi is the Viterbi algorithm, which is a dynamic programming algorithm used to find the entity type with the maximum probability for each word in the CRF model.
[0090] Get the entity type sequence z according to the entity type result of the word L ={z1,z2,…,z M }, z M Represents the entity type of the Mth word in the sentence. All standard entity types are predefined in the system. Predefined entity types include court (CT), business entity (BUS), government agency (GOVER), law (LS), suspect (SUS), victim (VICT), instrument of crime (INST), stolen item (SI), item value (VALUE), legal name (LN), judge (JN), plaintiff (PLAT), defendant (DEAT), political entity (GPE), employer (UU), individual business owner (IBO), and job position (WORK-OF-ART).
[0091] S4, according to the predicted sequence Y L ={y1,y2,…,y M } Extract entities from all sentences in judicial trial documents; according to entity type sequence z L ={z1,z2,…,z M } Extract the entity's type.
[0092] In this step, the predicted sequence Y of each sentence is known L ={y1,y2,…,y M } and entity type sequence z L ={z1,z2,…,z M}, and then according to the standard rules of the BIEOU tagging system: when encountering a B tag, a new entity begins; when encountering an I tag, the current word is added to the current entity; when encountering an E tag, the current entity ends; when encountering an O tag, the current entity ends and a new entity begins. For U tags, the entire word is considered a single entity. For example, take the sentence "The University of Science and Technology of China is located in Hefei." The BIEOU tagging system is annotated as follows:
[0093] middle country division technology big study Bit At combine Fat B I I I I E O O B E
[0094] This sequence is the predicted sequence Y L , we can know that "University of Science and Technology of China" and "Hefei" are both entities. Prediction sequence Y L Each word in will generate an entity type, which is consistent with the predicted sequence Y L One-to-one correspondence, that is, the entity type sequence z L ={z1,z2,…,z M In this sentence, since there are 10 Chinese characters (or each word in English), the value of M is 10. At this time, in the entity "University of Science and Technology of China", the entity type corresponding to the Chinese characters is the entity type sequence z L Count the first six entity types in the table, and use the entity type with the highest number of occurrences as the entity type for the entity "University of Science and Technology of China". Similarly, assign an entity type to the entity "Hefei" using the same method.
[0095] In another embodiment, a system for extracting entities from a small number of judicial trial documents is provided, which uses the above-mentioned method for extracting entities from a small number of judicial trial documents. The entity extraction system includes:
[0096] A training module is used to perform data augmentation on training samples to generate augmented data, and then filter the generated augmented data; the filtered augmented data is mixed with the training samples to train the model together;
[0097] The vectorization module is used to generate three embedding vectors for each sentence in the judicial trial document, which are the context-related embedding feature vectors Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector Then the three embedding vectors are combined into a feature fusion vector t i ;
[0098] Entity extraction module, which is used to fusion vector t according to the feature i Generate a prediction sequence Y for the word BIEOU label in all sentences L ={y1,y2,…,y M };
[0099] Entity type extraction module, which is used to fusion vector t according to the feature i Generate entity type sequence z for each word in the sentence L ={z1,z2,…,z M }.
[0100] In other embodiments, a computer device is also provided. The computer device provided in this embodiment can take various forms, such as an intelligent terminal, a tablet computer, a laptop computer, a desktop computer, a rack server, a blade server, a tower server or a cabinet server (including an independent server, or a server cluster composed of multiple servers) that can execute a program. The computer device of this embodiment includes at least but is not limited to: a memory and a processor that can be interconnected through a system bus. The memory stores a computer program. When the computer program is executed by the processor, the steps of the entity extraction method in the small sample judicial trial document as described above are implemented.
[0101] In this embodiment, the memory (i.e., readable storage medium) includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device.
[0102] In other embodiments, the memory may also be an external storage device of a computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc., equipped on the computer device. Of course, the memory may also include both an internal storage unit of the computer device and its external storage device. In this embodiment, the memory stores a computer program. When the computer program is executed by the processor, the steps of the entity extraction method in the small sample judicial trial document as described above are implemented.
[0103] In some embodiments, the processor may be a central processing unit (CPU), a graphics processing unit (GPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
[0104] The technical features of the above-mentioned embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above-mentioned embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0105] The above-described embodiments merely illustrate several implementations of the present invention, and while their descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present invention. Therefore, the scope of protection of the patent for this invention shall be determined by the appended claims.< / mask> < / mask> < / mask> < / liubei> < / mask> < / mask> < / mask>
Claims
1. A method for extracting entities from a small number of judicial trial documents, characterized in that: In the absence of training samples, all models are trained, and entities and entity types in judicial trial documents are extracted through the trained models. The method for training the models includes the following steps: Performing data augmentation on training samples to generate augmented data; the data augmentation method includes: retaining the entity category label, masking the entity and context, and generating augmented data; changing the entity category label to mask the predicted entity and context, and generating augmented data; adding an entity category, performing masked prediction of the entity and context, and generating augmented data; Screening the generated enhanced data: deleting the enhanced data whose entity category does not match the specific entity, and retaining the enhanced data whose entity category matches the specific entity; Mixing the filtered enhanced data with the training samples and inputting them together as training samples for the model; Extracting entities and entity types from judicial trial documents involves the following steps: The judicial trial document consists of L sentences, each of which consists of M words. The sentence is input into the language processing model to generate three embedding vectors: context-dependent embedding feature vector Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector The three embedding vectors are combined into a feature fusion vector t i Among them, the sentence introduction pattern feature is used to capture the specific form of the content with fixed features such as telephone number, ID number, home address, etc.; the pattern feature is encoded and input into the CNN and BiLSTM models in turn to obtain The feature fusion vector t i Input into the BiLSTM model to obtain the feature fusion vector t containing bidirectional sequence information i '; The feature fusion vector t i ′ is input into the feedforward neural network for BIEOU tag prediction and generates the prediction sequence Y of the word BIEOU tags in all sentences L ={y1,y2,…,y M }, where Y L Represents the BIEOU tag sequence of the sentence, y M Indicates the type of BIEOU label to which the Mth word in the sentence belongs; The feature fusion vector t i ′ is input into the CRF model to calculate the possible probability distribution of the entity type of each word, and then the entity type with the highest probability is selected as the entity type of the word to generate the entity type sequence z of the word in each sentence L ={z1,z2,…,z m }, where z L The entity type sequence representing the sentence, z M Indicates the entity type of the Mth word in the sentence; According to the prediction sequence Y L ={y1,y2,…,y M } Extract entities from all sentences in judicial trial documents; according to entity type sequence z L ={z1,z2,…,z M } Extract the entity's type.
2. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: The formula for mixing the enhanced data with the original training samples is: a~U(1,A)b~U(1,B)x~U(1,C)y~U(1,C) Where s aug represents the mixed training samples, represents the kth sentence randomly selected from the training sample, represents the qth sentence randomly extracted from the augmented data, x represents the number of sentences randomly extracted from the original training sample, y represents the number of sentences randomly extracted from the augmented data, A is the number of sentences in the original training sample, B is the number of sentences in the augmented dataset, C represents the maximum number of sentences that can be connected, U(1, A), U(1, B) and U(1, C) represent randomly selecting a number from 1 to A, 1 to B and 1 to C respectively, a is the sequence number of the sentence randomly extracted from the original training sample, and b is the sequence number of the sentence randomly extracted from the augmented data.
3. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: The language processing model includes the BERT language model and the Word2Vec word vector model; the sentence is embedded in the feature vector generated by the BERT language model The sentence generates an embedded feature vector through the Word2Vec word vector model 4. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: Get the feature fusion vector t containing bidirectional sequence information i 'The method comprises the following steps: The feature fusion vector t i Input into the BiLSTM model to get the forward hidden state and the backward hidden state The forward hidden state and the backward hidden state Splicing to obtain feature fusion vector t i ′: Where, [t1,t2,…,t M ] is a sentence sequence after feature fusion, Represents a vector concatenation operation.
5. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: Generate prediction sequence Y L ={y1,y2,…,y M The method comprises the following steps: Calculate the probability P of each word in the sentence with respect to the BIEOU label i : <h2 style=";text-align:left;direction:ltr">P<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> =softmax(FFN(t<h2 style=";text-align:left;direction:ltr"> i <h2 style=";text-align:left;direction:ltr"> ′)) In the formula, softmax is the softmax function, FFN is the feedforward neural network; Choose the word with probability P i The largest BIEOU tag is used as the BIEOU tag of the word: y i =argmax(P i ) Where y i represents the BIEOU label of the i-th word in the sentence, and argmax is the argmax function; Get the predicted sequence Y based on the BIEOU tag results of the word L ={y1,y2,…,y M }.
6. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: Generate entity type sequence z L ={z1,z2,…,z M The method comprises the following steps: Calculate the probability Q of each word in the sentence belonging to each predefined entity type i : Q i =CRF(t i ′) Where, CRF is the CRF model; Choose the word with probability Q i The largest entity type is used as the entity type of the word: z i =Viterbi(Q i ) Where z i Indicates the entity type of the i-th word in the sentence, and Viterbi is the Viterbi algorithm; Get the entity type sequence z according to the entity type result of the word L ={z1,z2,…,z M }.
7. The entity extraction method from a small number of judicial trial documents according to claim 1 is characterized in that: The entity type of a word is a predefined entity type, which includes: court, business entity, government agency, regulation, suspect, victim, crime tool, stolen item, item value, legal name, judge, plaintiff, defendant, political entity, employer, individual business owner, and job position.
8. A system for extracting entities from a small number of judicial trial documents, characterized by: The method for extracting entities from a small number of judicial trial documents according to any one of claims 1 to 7 is used; the entity extraction system comprises: A training module is used to perform data augmentation on training samples to generate augmented data, and then filter the generated augmented data; the filtered augmented data is mixed with the training samples to train the model together; The vectorization module is used to generate three embedding vectors for each sentence in the judicial trial document, which are the context-related embedding feature vectors Part-of-speech embedding feature vector of a word and pattern feature embedding feature vector Then the three embedding vectors are combined into a feature fusion vector t i ; Entity extraction module, which is used to fusion vector t according to the feature i Generate a prediction sequence Y for the word BIEOU label in all sentences l ={y1,y2,…,y M }; Entity type extraction module, which is used to fusion vector t according to the feature i Generate entity type sequence z for each word in the sentence L ={z1,z2,…,z M }.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the entity extraction method from a small number of judicial trial documents according to any one of claims 1 to 7.
Citation Information
Patent Citations
Entity relationship extraction model training method, entity relationship extraction method, entity relationship extraction device and equipment
CN118364047A
Entity relationship recognition method and system based on improved graph attention network
CN113010683A
Identifying entities in electronic medical records
WO2019137562A2