Non-continuous disease entity extraction method, device and electronic equipment
Through vector coding and hollow convolution technology, the problem of non-continuous disease entity extraction in insurance pre-underwriting is solved, and a more fine-grained disease label extraction is achieved, which improves the efficiency of disease combination analysis and product matching, and improves the professionalism of consultants. and product recommendation accuracy.
Patent Information
- Application Number
- CN202210459157.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-04-26
Smart Images

Figure CN114820212B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software technology, and more specifically, to a method, device and electronic equipment for extracting non-continuous disease entities. Background Art
[0002] Underwriting data in the insurance field is mostly in text form, which makes it difficult to structure and conduct probability analysis of insurance companies, diseases, and insurance conclusions. For example, different policyholders have different disease record methods and different disease combinations, which requires structuring to the smallest disease granularity for underwriting analysis.
[0003] At present, the disease extraction in the insurance pre-underwriting field is basically focused on the extraction of continuous disease entities, and has not considered the extraction of discontinuous disease entities. For example, "mitral and tricuspid stenosis" is a discontinuous disease segment, and the insurance pre-underwriting field aims to extract more fine-grained disease labels "mitral stenosis" and "tricuspid stenosis". Therefore, how to achieve the extraction of discontinuous disease entities in the insurance pre-underwriting field has become an urgent problem to be solved at this stage. Summary of the invention
[0004] In view of this, in order to solve the above problems, the present invention provides a method, device and electronic device for extracting non-continuous disease entities, and the technical solution is as follows:
[0005] A method for extracting non-continuous disease entities, the method comprising:
[0006] Get the target text to be processed;
[0007] Performing vector encoding on the target text to obtain a character vector of each character in the target text, wherein the character vector is integrated with relative position information between the corresponding character and other characters;
[0008] Processing the character vector of each character in the target text by a first prediction model to determine a candidate disease segment in the target text, wherein the first prediction model is obtained by pre-training a corresponding first basic model by defining a first label matrix of training samples, and the candidate disease segment is composed of a plurality of consecutive characters in the target text;
[0009] Performing feature extraction on the character vector of each character in the candidate disease segment by using dilated convolution to obtain the feature vector of each character in the candidate disease segment under different dilated conditions;
[0010] The feature vectors of each character in the candidate disease fragment under different holes are processed by a second prediction model to determine the non-continuous disease entity in the candidate disease fragment. The second prediction model is obtained by pre-training the corresponding second basic model by defining a second label matrix of training samples. The non-continuous disease entity is composed of multiple non-continuous characters in the candidate disease fragment.
[0011] Preferably, the vector encoding of the target text includes:
[0012] Processing the target text through a pre-trained encoding model to obtain a first character vector of each character in the target text;
[0013] The first character vector of each character in the target text is processed by a bidirectional long short-term memory network to integrate the relative position information between the characters in the target text into the first character vector of the corresponding character, thereby obtaining the second character vector of each character in the target text.
[0014] Preferably, the process of pre-training the corresponding first basic model by defining a first label matrix of training samples to obtain the first prediction model includes:
[0015] Obtain sample text as training sample;
[0016] Define a first label matrix C corresponding to the sample text, wherein the first label matrix C is an n*n two-dimensional matrix, and the value of the element C(i,j) is used to indicate whether the index i to the index j of the sample text is a candidate disease segment, wherein n is the character length of the sample text;
[0017] Performing vector encoding on the sample text to obtain a character vector of each character in the sample text;
[0018] Taking the character vector of each character in the sample text as input and the value of each element in the first label matrix C as the target, the corresponding first basic model is iteratively trained multiple times to adjust the parameter matrix in the first basic model, and the adjusted first basic model is used as the first prediction model.
[0019] Preferably, the performing multiple iterations of training on the corresponding first basic model comprises:
[0020] A bilinear attention mechanism is introduced to perform multiple iterative training on the first basic model.
[0021] Preferably, the process of pre-training the corresponding second basic model by defining a second label matrix of training samples to obtain the second prediction model includes:
[0022] Obtaining sample candidate disease fragments as training samples;
[0023] Define a second label matrix T corresponding to the sample candidate disease segment, wherein the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to represent whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment;
[0024] Performing vector encoding on the sample candidate disease segment to obtain a character vector of each character in the sample candidate disease segment;
[0025] Perform feature extraction on the character vector of each character in the sample candidate disease segment by using dilated convolution to obtain the feature vector of each character in the sample candidate disease segment under different dilated conditions;
[0026] Taking the feature vector of each character in the candidate disease fragment of the sample under different holes as input and the value of each element in the second label matrix T as the target, the corresponding second basic model is iteratively trained for multiple times to adjust the weight matrix in the second basic model, and the adjusted second basic model is used as the second prediction model.
[0027] Preferably, the step of taking the feature vectors of each character in the candidate disease segments of the samples under different holes as input includes:
[0028] Processing the feature vectors of each character in the sample candidate disease segment under different holes, so as to add the feature vector of the second character to the feature vector of the first character under different holes, wherein the first character and the second character are two characters in consecutive positions, and the distance between the first character and the first character of the sample candidate disease segment is greater than the distance between the second character and the first character of the sample candidate disease segment;
[0029] Taking the processed feature vectors of each character in the candidate disease fragments of the sample under different holes as input;
[0030] Accordingly, the feature vectors of each character in the candidate disease segment under different cavities are processed by the second prediction model, including:
[0031] Processing the feature vectors of each character in the candidate disease segment under different holes, so as to add the feature vector of the fourth character to the feature vector of the third character under different holes, wherein the third character and the fourth character are two characters in consecutive positions, and the distance between the third character and the first character of the candidate disease segment is greater than the distance between the fourth character and the first character of the candidate disease segment;
[0032] The processed feature vectors of each character in the candidate disease segment under different cavities are processed by the second prediction model.
[0033] A non-continuous disease entity extraction device, comprising:
[0034] A vector encoding module is used to obtain a target text to be processed; vector encoding is performed on the target text to obtain a character vector of each character in the target text, wherein the character vector is integrated with relative position information between the character and other characters;
[0035] A segment extraction module is used to process the character vector of each character in the target text through a first prediction model to determine a candidate disease segment in the target text, wherein the first prediction model is obtained by training a corresponding first basic model in advance by defining a first label matrix of training samples, and the candidate disease segment is composed of a plurality of continuous characters in the target text;
[0036] The entity distillation module is used to extract features from the character vectors of each character in the candidate disease segment through hole convolution to obtain the feature vectors of each character in the candidate disease segment under different holes; the feature vectors of each character in the candidate disease segment under different holes are processed through a second prediction model to determine the non-continuous disease entities in the candidate disease segment, wherein the second prediction model is obtained by pre-training the corresponding second basic model through a second label matrix defining training samples, and the non-continuous disease entity is composed of multiple non-continuous characters in the candidate disease segment.
[0037] Preferably, the process of the segment extraction module pre-training the corresponding first basic model by defining a first label matrix of training samples to obtain the first prediction model includes:
[0038] Acquire a sample text as a training sample; define a first label matrix C corresponding to the sample text, wherein the first label matrix C is an n*n two-dimensional matrix, and the value of the element C(i,j) is used to characterize whether the index i to the index j of the sample text is a candidate disease fragment, wherein n is the character length of the sample text; vector encode the sample text to obtain a character vector of each character in the sample text; with the character vector of each character in the sample text as input and the value of each element in the first label matrix C as the target, perform multiple iterative training on the corresponding first basic model to adjust the parameter matrix in the first basic model, and use the adjusted first basic model as the first prediction model.
[0039] Preferably, the entity distillation module pre-trains the corresponding second basic model by defining a second label matrix of training samples to obtain the second prediction model, including:
[0040] Obtain sample candidate disease segments as training samples; define a second label matrix T corresponding to the sample candidate disease segments, wherein the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to characterize whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment; perform vector encoding on the sample candidate disease segment to obtain the character vector of each character in the sample candidate disease segment; perform feature extraction on the character vector of each character in the sample candidate disease segment through hole convolution to obtain the feature vector of each character in the sample candidate disease segment under different holes; take the feature vector of each character in the sample candidate disease segment under different holes as input and the value of each element in the second label matrix T as the target, perform multiple iterative training on the corresponding second basic model to adjust the weight matrix in the second basic model, and use the adjusted second basic model as the second prediction model.
[0041] An electronic device comprises: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the non-continuous disease entity extraction method.
[0042] Compared with the prior art, the present invention has the following beneficial effects:
[0043] The present invention provides a method, device and electronic device for extracting non-continuous disease entities, which can vector encode the target text, obtain the character vector of each character in the target text that incorporates the relative position information, and then process the character vector of each character in the target text through a first prediction model to determine the candidate disease segment in the target text, and further perform feature extraction on the character vector of each character in the candidate disease segment through a dilated convolution to obtain the feature vector of each character in the candidate disease segment under different dilated holes, and finally process the feature vector of each character in the candidate disease segment under different dilated holes through a second prediction model to determine the disease entity in the candidate disease segment. Based on the present invention, the extraction of non-continuous disease entities can be realized, thereby obtaining finer-grained disease labels, in order to realize the analysis of diseases, matching diseases with products, and provide more data support for the sales end, thereby improving the professionalism of consultants and the accuracy of product recommendations. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0045] Figure 1 A method flow chart of a method for extracting non-continuous disease entities provided by an embodiment of the present invention;
[0046] Figure 2 A partial method flow chart of a method for extracting non-continuous disease entities provided by an embodiment of the present invention;
[0047] Figure 3 A schematic diagram of a scenario for extracting non-continuous disease entities provided by an embodiment of the present invention;
[0048] FIG4 is an example of a convolution field provided by an embodiment of the present invention, wherein FIG4(a) is a convolution field with a hole of 1, and FIG4(b) is a convolution field with a hole of 2;
[0049] Figure 5 Examples of feature vectors of each character in candidate disease segments under different cavities provided by an embodiment of the present invention;
[0050] Figure 6 An example of integrating the feature vectors of each character in the candidate disease segment under different cavities provided by the embodiment of the present invention;
[0051] Figure 7 A schematic diagram of the structure of a discontinuous disease entity extraction device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0052] 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 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 creative work are within the scope of protection of the present invention.
[0053] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0054] For ease of understanding, firstly, the relevant concepts in the present invention are explained:
[0055] Non-continuous disease entity: multiple disease entities share some text. For example, in the underwriting data, "urethra, bladder, renal colic" has three disease entities "urethra pain", "bladder pain" and "renal colic", and "urethra, bladder, renal colic" cannot be regarded as one disease entity.
[0056] Continuous disease entities: Different disease entities do not share any common characters. For example, in the underwriting data, "urethral pain, bladder pain, renal colic" can directly extract three disease entities "urethral pain", "bladder pain" and "renal colic", without separating characters between "urethra" and "pain", and between "bladder" and "pain" as in the above "urethra, bladder, renal colic".
[0057] Nested disease entities: Multiple disease entities have an inclusion relationship, and there are no separating characters between disease entities. For example, in the underwriting data, "pregnancy-induced hypertension" has two disease entities, "pregnancy-induced hypertension" and "hypertension", and the two are in an inclusion relationship.
[0058] Underwriting data in the insurance field is mostly in text form, which makes it difficult to conduct structured probability analysis of insurance companies, diseases, and insurance conclusions. For example, different policyholders have different disease record methods and disease combinations, resulting in low accuracy in consultants' responses to underwriting inquiries and underwriting product recommendations, which does not demonstrate the consultants' professionalism. Disease analysis is purely manual by underwriting teachers, which is inefficient. Consultants' underwriting inquiries and underwriting teachers' responses are inefficient, and underwriting product recommendations are inaccurate due to disease information.
[0059] In this regard, the present invention supports the digital pre-underwriting function, automatic structured disease extraction and pre-labeling of pre-underwriting conclusions across all channels, and analyzes the types of diseases after disease extraction from a large amount of underwriting data through algorithms to match diseases with products: historical underwriting data is output to the sales end, more data support is provided to assist business development, and the professionalism of consultants and the accuracy of product recommendations are improved.
[0060] See also Figure 1 , Figure 1 The non-continuous disease entity extraction method provided by the embodiment of the present invention comprises the following steps:
[0061] S10, obtaining the target text to be processed.
[0062] In the embodiment of the present invention, the target text belongs to pre-underwriting data in the insurance field. The pre-underwriting data mainly comes from the underwriting opinions of underwriters. Different from ordinary spoken or written texts, the underwriting opinion text has strong domain characteristics, and there are nested disease entities and non-continuous disease entities. The following table is an example of common non-continuous disease entities, where the type represents a variety of non-continuous situations:
[0063]
[0064] S20, performing vector encoding on the target text to obtain a character vector of each character in the target text, wherein the character vector is integrated with relative position information between the corresponding character and other characters.
[0065] In an embodiment of the present invention, since different disease entities in a non-continuous disease entity may share some text, continuing to use "urethra, bladder, renal colic" as an example, there are multiple characters between "urethra" and "pain", and there are also multiple characters between "bladder" and "pain". Therefore, in order to extract the non-continuous disease entity, it is necessary to consider the relative position information between characters. For this purpose, the present invention integrates the relative position information between characters in the target text into the character vector in a vector encoding manner.
[0066] In the specific implementation process, the "vector encoding of the target text" in step S20 can be performed using the following steps, and the method flow chart is as follows: Figure 2 As shown:
[0067] S201, processing the target text through a pre-trained encoding model to obtain a first character vector of each character in the target text.
[0068] See also Figure 3 , Figure 3 Schematic diagram of the scenario of non-continuous disease entity extraction provided by the embodiment of the present invention. Assuming the target text input is "the customer's mitral and tricuspid valves are slightly stenotic", it is denoted as L, where "cls" and "sep" are the start and end markers of the target text respectively. During the vector encoding process, the encoding model (encoder) is first used to generate an encoding vector, that is, the first character vector of each character. The encoding model in the present invention can be a different pre-trained model, such as BERT (Bidirectional Encoder Representation Text), XLNet, etc., which is not limited by the embodiment of the present invention. The first character vector after the encoding model is denoted as F, then:
[0069] F = encoder (L)
[0070] Among them, F∈R a*d , a is the character length of the target text, and d is the vector dimension of the encoding model.
[0071] S202, processing the first character vector of each character in the target text through a bidirectional long short-term memory network to integrate the relative position information between the characters in the target text into the first character vector of the corresponding character, and obtaining the second character vector of each character in the target text.
[0072] In the embodiment of the present invention, since the current encoding model only has absolute position information, and relative position information needs to be integrated for the task of non-continuous disease entity extraction, only the first character vector output by the encoding model is used, which may lead to fine-grained disease entity misidentification in the subsequent model recognition process. For example, when identifying "the customer's examination revealed thyroid and lung nodules", the subsequent model will identify "thyroid and lung nodules" as one disease entity.
[0073] For this, see Figure 3 , the present invention uses a bidirectional long short-term memory network (abbreviated as BILSTM) to further process the first character vector output by the encoding model. This is because the bidirectional long short-term memory network is a recursive network structure, which can integrate the relative position information into the first character vector of each character in the target text. The second character vector after the bidirectional long short-term memory network is denoted as H, then:
[0074] H = BILSTM(F).
[0075] S30, processing the character vector of each character in the target text through the first prediction model to determine the candidate disease fragments in the target text, the first prediction model is obtained by pre-training the corresponding first basic model by defining the first label matrix of the training sample, and the candidate disease fragments are composed of multiple consecutive characters in the target text.
[0076] Continue to see Figure 3 , in order to extract the candidate disease segment "slightly stenotic mitral and tricuspid valves" from the target text input "the customer's mitral and tricuspid valves are slightly stenotic", the embodiment of the present invention processes the result of vector encoding of the target text through the first prediction model to realize the extraction of candidate disease segments, which serves as the basis for subsequent entity extraction. In order to enable the first prediction model to handle nested disease entities and non-continuous disease entities, the embodiment of the present invention defines a two-dimensional candidate disease segment label matrix, namely, the first label matrix, to train the parameter matrix of the first prediction model, namely, to realize the extraction of global pointer candidate disease segments through the first prediction model.
[0077] In the specific implementation process, the process of training the corresponding first basic model to obtain the first prediction model by pre-defining the first label matrix of the training samples can adopt the following steps:
[0078] Obtain sample text as training samples; define a first label matrix C corresponding to the sample text, where the first label matrix C is a two-dimensional matrix of n*n, and the value of the element C(i,j) is used to characterize whether the text segment from index i to index j of the sample text is a candidate disease segment, where n is the character length of the sample text; perform vector encoding on the sample text to obtain character vectors of each character in the sample text; use the character vectors of each character in the sample text as input and the values of each element in the first label matrix C as the target, and perform multiple iterative trainings on the corresponding first basic model to adjust the parameter matrix in the first basic model, and use the adjusted first basic model as the first prediction model.
[0079] In the embodiments of the present invention, for the convenience of understanding, the sample text is taken as an example of "the client has mild tricuspid and mitral stenosis" for illustration. First, define a two-dimensional matrix of n*n as the first label matrix C. The value of the element C(i,j) in the matrix represents whether the text segment from index i to index j of the sample text is a candidate disease segment, and n is the character length in the sample text. Then, for "the client has mild tricuspid and mitral stenosis", n is 10. For example, in "the client has mild tricuspid and mitral stenosis", "mild tricuspid and mitral stenosis" is a candidate disease segment. Refer to Figure 3 the label matrix in the candidate disease segment extraction part in, which is the first label matrix. The value of the element C(2,9) in this matrix is 1, and the values of other elements are 0. This indicates that there is a candidate disease segment in "the client has mild tricuspid and mitral stenosis" with "two" as the starting character and "narrow" as the ending character, that is, "mild tricuspid and mitral stenosis".
[0080] Similar to step S20, perform vector encoding on the sample text to obtain character vectors of each character in the sample text. The specific implementation solution can refer to the corresponding public part at step S20 and will not be elaborated here.
[0081] In the process of training the first prediction model, use the first label matrix as the label for model training, use the character vectors of each character in the sample text as input, and use the values of each element in the first label matrix as the target. Perform multiple iterative trainings on the first basic model. During each iterative training, calculate the loss function value according to the prediction result of the first basic model and the first label matrix, and use this to reversely adjust the parameter matrix of the first basic model until the loss function value converges and the prediction result of the first basic model approaches the first label matrix, then end the iterative training and output the first prediction model. Specifically:
[0082] In order to calculate all possible candidate disease segments, the first basic model can calculate the scores of different text segments in the sample text as candidate disease segments through the parameter matrix using the character vectors of each character in the sample text. This score represents the probability that the所属 text segment is a candidate disease segment, and the starting characters or ending characters of different text segments are different.
[0083] The scores of different text segments as candidate disease segments C-score = H start H end , C-score is the score matrix, and C-score∈R n*n , the element values in the matrix represent the scores of different text fragments as candidate disease fragments:
[0084]
[0085] Where W∈R n*n is the parameter matrix of the first basic model, and b is the bias parameter of the first basic model, which is learned together with the parameter matrix. start represents the score of the candidate disease segment for the first character in the text segment, W start represents the parameter value of the first character in the text segment in the parameter matrix, b start Indicates the offset parameter corresponding to the beginning character in the text segment, H end represents the score of the ending character in the text segment belonging to the candidate disease segment, W end Indicates the parameter value of the ending character in the text segment in the parameter matrix, b end Indicates the offset parameter corresponding to the end character in the text segment.
[0086] In some embodiments, in order to accurately calculate the score of each candidate disease segment, a bilinear attention mechanism can be introduced when the first basic model is iteratively trained multiple times, and the scores of different text segments as candidate disease segments can be learned through a parameter matrix:
[0087] C-score=H start W s H end
[0088] Among them, W s is the attention matrix of the first basic model, and W s ∈R n*n , the element values in the matrix represent the attention values of different text fragments, and different attention matrices can be set in different scenarios.
[0089] S40, extracting features from the character vectors of each character in the candidate disease segment through dilated convolution to obtain feature vectors of each character in the candidate disease segment under different dilated conditions.
[0090] Since the above steps only extract candidate disease segments in the target text, the candidate disease segments where the non-continuous disease entities are located have not been processed to generate the final fine-grained disease entities. In this regard, an embodiment of the present invention proposes an entity distillation solution based on dilated convolution to extract the final non-continuous disease entities from the candidate disease segments in the target text. The reason for using dilated convolution is that dilated convolution can extract features through spaced convolution fields, and the spaced convolution fields just correspond to the cross-character extraction of disease entities in entity distillation. See Figure 4, which is an example of a convolution field provided by an embodiment of the present invention, wherein Figure 4 (a) is a convolution field with a dilation of 1, and Figure 4 (b) is a convolution field with a dilation of 2.
[0091] Continue to see Figure 3 , since entity distillation is only processed on candidate disease segments, and the character vectors of each character in the target text are obtained during vector encoding, mask processing is first performed based on the candidate disease segments, and a mask matrix mask∈R with all zeros is first generated n*d According to the two-dimensional matrix index (i, j) whose element value in the candidate disease segment in the score matrix C-score is 1, the elements from the i-th row to the j-th row in the mask matrix mask are replaced with 1 to obtain the mask matrix M. For example, the target text is "The customer's mitral and tricuspid valves are slightly narrowed", and the extracted candidate disease segment is "The mitral and tricuspid valves are slightly narrowed". Corresponding to the character vector H, the character vectors of the two characters "customer" need to be set to zero to obtain the mask character vector M, M=mask(H).
[0092] After obtaining the above mask character vector, the dilated convolution is further used for feature extraction. In the present invention, dilation 1 to k can be used. For example, when k = 5, the dilation [1, 2, 3, 4, 5] method can be used for convolution feature extraction to obtain the feature vector D of each character in the candidate disease segment under different dilations:
[0093] D = dilated_convolution(M)
[0094] Where D∈R n*d , dilated_convolution represents the dilated convolution function.
[0095] S50, the feature vectors of each character in the candidate disease fragment under different holes are processed by the second prediction model to determine the non-continuous disease entity in the candidate disease fragment. The second prediction model is obtained by pre-training the corresponding second basic model by defining a second label matrix of training samples. The non-continuous disease entity is composed of multiple non-continuous characters in the candidate disease fragment.
[0096] In the embodiment of the present invention, the feature vectors of each character in the candidate disease segment under different holes can be processed by the second prediction model to extract the non-continuous disease entities in the candidate disease segment. In order to extract the non-continuous disease entities from the candidate disease segment, the embodiment of the present invention defines a two-dimensional non-continuous disease entity label matrix, i.e., the second label matrix, to train the weight matrix of the second prediction model.
[0097] In the specific implementation process, the process of training the corresponding second basic model to obtain the second prediction model by pre-defining the second label matrix of the training samples can adopt the following steps:
[0098] Obtain sample candidate disease segments as training samples; define a second label matrix T corresponding to the sample candidate disease segments, the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to characterize whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment; perform vector encoding on the sample candidate disease segment to obtain the character vector of each character in the sample candidate disease segment; perform feature extraction on the character vector of each character in the sample candidate disease segment through dilated convolution to obtain the feature vector of each character in the sample candidate disease segment under different dilated conditions; take the feature vector of each character in the sample candidate disease segment under different dilated conditions as input and the value of each element in the second label matrix T as the target, perform multiple iterative training on the corresponding second basic model to adjust the weight matrix in the second basic model, and use the adjusted second basic model as the second prediction model.
[0099] In the embodiment of the present invention, for ease of understanding, the sample candidate disease segment "slight stenosis of the mitral and tricuspid valves" is used as an example for explanation. First, an m*m two-dimensional matrix is defined as the second label matrix T. The value of the element T(i,j) in the matrix represents whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j. m is the character length of the sample candidate disease segment. The m corresponding to "slight stenosis of the mitral and tricuspid valves" is 8. Figure 3 The label matrix of the entity extract part in the middle is the second label matrix, which represents the non-continuous disease entities that need to be extracted from the sample candidate disease segment "slight mitral and tricuspid stenosis", where 1 represents entity elements and 0 represents non-entity elements. For example, the text segment with "two" as the beginning character can delete the three characters "three", "slightly" and "micro" to obtain the (non-continuous) disease entity "mitral stenosis", and the text segment with "three" as the beginning character can delete the three characters "two", "slightly" and "micro" to obtain the (non-continuous) disease entity "tricuspid stenosis", while the text segment with "sharp", "valve" and other characters as the beginning characters does not have a (non-continuous) disease entity.
[0100] Similar to steps S20 and S30, the sample candidate disease fragment is vector encoded to obtain the character vector of each character in the sample candidate disease fragment, and the character vector of each character in the sample candidate disease fragment is feature extracted through void convolution to obtain the feature vector of each character in the sample candidate disease fragment under different voids. The specific implementation scheme can be found in the corresponding public part of steps S20 and S30, which will not be repeated here.
[0101] In the process of training the second prediction model, the second label matrix is used as the label for model training, the feature vector of each character in the sample candidate disease fragment is used as input, and the value of each element in the second label matrix is used as the target. The second basic model is iteratively trained multiple times. In each iterative training, the loss function value is calculated according to the prediction result of the second basic model and the second label matrix, and the weight matrix of the second basic model is adjusted in reverse until the loss function value converges. When the prediction result of the second basic model approaches the second label matrix, the iterative training is terminated and the second prediction model is output.
[0102] In some embodiments, in order for the second prediction model to better extract (non-continuous) disease entities starting with specific characters from the candidate disease segments, the disease entity starting element is introduced in the embodiment of the present invention. First, on the basis of the feature vector D, the feature vector of each element is added to the feature vector of the previous element. In the specific implementation process, the step "taking the feature vectors of each character in the sample candidate disease segments under different holes as input" can adopt the following steps:
[0103] The feature vectors of each character in the sample candidate disease fragments under different holes are processed to add the feature vector of the second character to the feature vector of the first character under different holes, the first character and the second character are two characters in consecutive positions, and the distance between the first character and the first character of the sample candidate disease fragment is greater than the distance between the second character and the first character of the sample candidate disease fragment; the processed feature vectors of each character in the sample candidate disease fragments under different holes are used as input.
[0104] Accordingly, the step of "processing the feature vectors of each character in the candidate disease segments under different cavities by the second prediction model" can be performed by the following steps:
[0105] Processing the feature vectors of each character in the candidate disease segment under different holes, so as to add the feature vector of the fourth character to the feature vector of the third character under different holes, the third character and the fourth character are two characters in consecutive positions, and the distance between the third character and the first character of the candidate disease segment is greater than the distance between the fourth character and the first character of the candidate disease segment;
[0106] Process the feature vectors of each character in the candidate disease segments under different holes through the second prediction model.
[0107] See Figure 5 , Figure 5 which is an example of the feature vectors of each character in the candidate disease segments under different holes provided by the embodiments of the present invention. Each row represents the feature vector of a character. For example, the feature vector of "two" is "1 1 2", and the feature vector of "three" is "2 1 1". See Figure 6 , Figure 6 which is an example of the incorporation of the feature vectors of each character in the candidate disease segments under different holes provided by the embodiments of the present invention. The feature vector of each character incorporates the feature vector of its previous character. For example, for two consecutive characters "three" and "sharp" in the candidate disease segment, the distance between the character "sharp" and the first character "two" of the candidate disease segment is farther than the distance between the character "three" and the first character "two" of the candidate disease segment. That is, the character "sharp" is the third character and the character "three" is the fourth character. Therefore, the feature vector of the character "three" can be added to the feature vector of the character "sharp". At this time, the feature vector of the character "sharp" changes from "3 2 1" to "3+2 2+1 1+1".
[0108] During the subsequent processing by the second prediction model, the processed feature vectors of each character in the candidate disease segments under different holes are used as the input of the model. The second prediction model obtains the scores of different text segments in the subsequent disease segment as non-continuous disease entities through matrix operations. This score represents the probability that the所属 text segment is a non-continuous disease entity, and the start characters or end characters of different text segments are different.
[0109] The score T-score of different text segments as non-continuous disease entities = W t D f , where T-score is the score matrix and T-score ∈ R m*m , and the element values in the matrix represent the scores of different text segments as non-continuous disease entities. Among them, W t ∈ R m*m is the weight matrix of each element in different text segments, and D f is the processing result of the feature vectors of each character in the candidate disease segments under different holes. D f = ADD(D), and ADD is the addition function of feature vectors.
[0110] It should be noted that the implementation process of "processing the feature vectors of each character in the sample candidate disease fragments under different holes to add the feature vector of the second character to the feature vector of the first character under different holes" can refer to the above-mentioned implementation process of "processing the feature vectors of each character in the candidate disease fragments under different holes to add the feature vector of the fourth character to the feature vector of the third character under different holes", and the embodiment of the present invention will not go into details about this.
[0111] The non-continuous disease entity extraction method provided in the embodiment of the present invention can realize the extraction of non-continuous disease entities, thereby obtaining more fine-grained disease labels, in order to realize the analysis of disease types and the matching of disease types with products, provide more data support for the sales end, and improve the professionalism of consultants and the accuracy of product recommendations.
[0112] Based on the non-continuous disease entity extraction method provided in the above embodiment, an embodiment of the present invention provides a device for executing the non-continuous disease entity extraction method. The structural diagram of the device is shown in FIG. Figure 6 As shown, including:
[0113] The vector encoding module 10 is used to obtain the target text to be processed; vector encoding is performed on the target text to obtain the character vector of each character in the target text, and the relative position information between the corresponding character and other characters is incorporated into the character vector;
[0114] A segment extraction module 20 is used to process the character vector of each character in the target text through a first prediction model to determine a candidate disease segment in the target text, wherein the first prediction model is obtained by training a corresponding first basic model in advance by defining a first label matrix of training samples, and the candidate disease segment is composed of a plurality of continuous characters in the target text;
[0115] The entity distillation module 30 is used to extract features from the character vectors of each character in the candidate disease fragment through hole convolution to obtain the feature vectors of each character in the candidate disease fragment under different holes; the feature vectors of each character in the candidate disease fragment under different holes are processed by the second prediction model to determine the non-continuous disease entities in the candidate disease fragment. The second prediction model is obtained by pre-training the corresponding second basic model by defining the second label matrix of the training samples. The non-continuous disease entity is composed of multiple non-continuous characters in the candidate disease fragment.
[0116] Optionally, the vector encoding module 10 performs vector encoding on the target text, including:
[0117] The target text is processed by a pre-trained encoding model to obtain the first character vector of each character in the target text; the first character vector of each character in the target text is processed by a bidirectional long short-term memory network to integrate the relative position information between the characters in the target text into the first character vector of the corresponding character, thereby obtaining the second character vector of each character in the target text.
[0118] Optionally, the process in which the segment extraction module 20 pre-trains the corresponding first basic model by defining a first label matrix of training samples to obtain the first prediction model includes:
[0119] Acquire a sample text as a training sample; define a first label matrix C corresponding to the sample text, wherein the first label matrix C is an n*n two-dimensional matrix, and the value of the element C(i,j) is used to characterize whether index i to index j of the sample text is a candidate disease fragment, wherein n is the character length of the sample text; vector encode the sample text to obtain a character vector of each character in the sample text; with the character vector of each character in the sample text as input and the value of each element in the first label matrix C as the target, perform multiple iterative training on the corresponding first basic model to adjust the parameter matrix in the first basic model, and use the adjusted first basic model as the first prediction model.
[0120] Optionally, the segment extraction module 20 performs multiple iterations of training on the corresponding first basic model, including:
[0121] A bilinear attention mechanism is introduced to perform multiple iterative training on the first basic model.
[0122] Optionally, the entity distillation module 30 pre-trains the corresponding second basic model by defining a second label matrix of training samples to obtain the second prediction model, including:
[0123] Obtain sample candidate disease segments as training samples; define a second label matrix T corresponding to the sample candidate disease segments, the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to characterize whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment; perform vector encoding on the sample candidate disease segment to obtain the character vector of each character in the sample candidate disease segment; perform feature extraction on the character vector of each character in the sample candidate disease segment through dilated convolution to obtain the feature vector of each character in the sample candidate disease segment under different dilated conditions; take the feature vector of each character in the sample candidate disease segment under different dilated conditions as input and the value of each element in the second label matrix T as the target, perform multiple iterative training on the corresponding second basic model to adjust the weight matrix in the second basic model, and use the adjusted second basic model as the second prediction model.
[0124] Optionally, the entity distillation module 30 takes the feature vector of each character in the sample candidate disease segment under different holes as input, including:
[0125] Processing the feature vectors of each character in the sample candidate disease segments under different holes, so as to add the feature vector of the second character to the feature vector of the first character under different holes, wherein the first character and the second character are two characters in consecutive positions, and the distance between the first character and the first character of the sample candidate disease segment is greater than the distance between the second character and the first character of the sample candidate disease segment; using the processed feature vectors of each character in the sample candidate disease segments under different holes as input;
[0126] Accordingly, the entity distillation module 30 processes the feature vectors of each character in the candidate disease segments under different cavities through the second prediction model, including:
[0127] The feature vectors of each character in the candidate disease fragments under different holes are processed to add the feature vector of the fourth character to the feature vector of the third character under different holes, the third character and the fourth character are two characters in consecutive positions, and the distance between the third character and the first character of the candidate disease fragment is greater than the distance between the fourth character and the first character of the candidate disease fragment; the processed feature vectors of each character in the candidate disease fragments under different holes are processed by the second prediction model.
[0128] It should be noted that the detailed functions of each module in the embodiment of the present invention can be found in the corresponding disclosed part of the above-mentioned non-continuous disease entity extraction method embodiment, and will not be repeated here.
[0129] Based on the non-continuous disease entity extraction method provided in the above embodiment, an embodiment of the present invention provides an electronic device, which includes: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the non-continuous disease entity extraction method.
[0130] The above is a detailed introduction to a non-continuous disease entity extraction method, device and electronic device provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
[0131] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0132] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device that includes a series of elements is inherent to the elements, or also includes elements inherent to these processes, methods, articles or devices. In the absence of further restrictions, the elements defined by the sentence "including a..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.
[0133] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for extracting non-continuous disease entities, characterized in that: The method comprises: Get the target text to be processed; Performing vector encoding on the target text to obtain a character vector of each character in the target text, wherein the character vector is integrated with relative position information between the corresponding character and other characters; Processing the character vector of each character in the target text by a first prediction model to determine a candidate disease segment in the target text, wherein the first prediction model is obtained by pre-training a corresponding first basic model by defining a first label matrix of training samples, and the candidate disease segment is composed of a plurality of consecutive characters in the target text; Perform feature extraction on the character vector of each character in the candidate disease segment by using dilated convolution to obtain the feature vector of each character in the candidate disease segment under different dilated conditions; Processing the feature vectors of each character in the candidate disease segment under different holes by a second prediction model to determine a non-continuous disease entity in the candidate disease segment, wherein the second prediction model is obtained by pre-training a corresponding second basic model by defining a second label matrix of training samples, and the non-continuous disease entity is composed of a plurality of non-continuous characters in the candidate disease segment; The process of pre-training the corresponding first basic model by defining a first label matrix of training samples to obtain the first prediction model includes: Obtain sample text as training sample; Define a first label matrix C corresponding to the sample text, wherein the first label matrix C is an n*n two-dimensional matrix, and the value of the element C(i,j) is used to indicate whether the index i to the index j of the sample text is a candidate disease segment, wherein n is the character length of the sample text; Performing vector encoding on the sample text to obtain a character vector of each character in the sample text; Taking the character vector of each character in the sample text as input and the value of each element in the first label matrix C as the target, performing multiple iterative training on the corresponding first basic model to adjust the parameter matrix in the first basic model, and using the adjusted first basic model as the first prediction model; The process of pre-training the corresponding second basic model by defining a second label matrix of training samples to obtain the second prediction model includes: Obtaining sample candidate disease fragments as training samples; Define a second label matrix T corresponding to the sample candidate disease segment, wherein the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to represent whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment; Performing vector encoding on the sample candidate disease segment to obtain a character vector of each character in the sample candidate disease segment; Perform feature extraction on the character vector of each character in the sample candidate disease segment by using dilated convolution to obtain the feature vector of each character in the sample candidate disease segment under different dilated conditions; Taking the feature vector of each character in the candidate disease fragment of the sample under different holes as input and the value of each element in the second label matrix T as the target, the corresponding second basic model is iteratively trained for multiple times to adjust the weight matrix in the second basic model, and the adjusted second basic model is used as the second prediction model.
2. The method according to claim 1, characterized in that The vector encoding of the target text includes: Processing the target text through a pre-trained encoding model to obtain a first character vector of each character in the target text; The first character vector of each character in the target text is processed by a bidirectional long short-term memory network to integrate the relative position information between the characters in the target text into the first character vector of the corresponding character, thereby obtaining the second character vector of each character in the target text.
3. The method according to claim 1, characterized in that The performing multiple iterations of training on the corresponding first basic model comprises: A bilinear attention mechanism is introduced to perform multiple iterative training on the first basic model.
4. The method according to claim 1, characterized in that: The method takes the feature vector of each character in the candidate disease segment of the sample under different holes as input, including: Processing the feature vectors of each character in the sample candidate disease segment under different holes, so as to add the feature vector of the second character to the feature vector of the first character under different holes, wherein the first character and the second character are two characters in consecutive positions, and the distance between the first character and the first character of the sample candidate disease segment is greater than the distance between the second character and the first character of the sample candidate disease segment; Taking the processed feature vectors of each character in the candidate disease fragments of the sample under different holes as input; Accordingly, the feature vectors of each character in the candidate disease segment under different cavities are processed by the second prediction model, including: Processing the feature vectors of each character in the candidate disease segment under different holes, so as to add the feature vector of the fourth character to the feature vector of the third character under different holes, wherein the third character and the fourth character are two characters in consecutive positions, and the distance between the third character and the first character of the candidate disease segment is greater than the distance between the fourth character and the first character of the candidate disease segment; The processed feature vectors of each character in the candidate disease segment under different cavities are processed by the second prediction model.
5. A non-continuous disease entity extraction device, characterized in that: The device comprises: A vector encoding module is used to obtain a target text to be processed; vector encoding is performed on the target text to obtain a character vector of each character in the target text, wherein the character vector is integrated with relative position information between the character and other characters; A segment extraction module is used to process the character vector of each character in the target text through a first prediction model to determine a candidate disease segment in the target text, wherein the first prediction model is obtained by training a corresponding first basic model in advance by defining a first label matrix of training samples, and the candidate disease segment is composed of a plurality of continuous characters in the target text; An entity distillation module is used to extract features from the character vectors of each character in the candidate disease segment through a dilated convolution to obtain feature vectors of each character in the candidate disease segment under different dilated conditions; the feature vectors of each character in the candidate disease segment under different dilated conditions are processed through a second prediction model to determine non-continuous disease entities in the candidate disease segment, wherein the second prediction model is obtained by pre-training a corresponding second basic model through a second label matrix defining training samples, and the non-continuous disease entity is composed of a plurality of non-continuous characters in the candidate disease segment; The process of the segment extraction module pre-training the corresponding first basic model by defining a first label matrix of training samples to obtain the first prediction model includes: Acquire a sample text as a training sample; define a first label matrix C corresponding to the sample text, wherein the first label matrix C is an n*n two-dimensional matrix, and the value of the element C(i,j) is used to characterize whether the index i to the index j of the sample text is a candidate disease segment, wherein n is the character length of the sample text; vector encode the sample text to obtain a character vector of each character in the sample text; take the character vector of each character in the sample text as input and the value of each element in the first label matrix C as a target, perform multiple iterative training on the corresponding first basic model to adjust the parameter matrix in the first basic model, and use the adjusted first basic model as the first prediction model; The process in which the entity distillation module pre-trains the corresponding second basic model by defining a second label matrix of training samples to obtain the second prediction model includes: Obtain sample candidate disease segments as training samples; define a second label matrix T corresponding to the sample candidate disease segments, wherein the second label matrix T is an m*m two-dimensional matrix, and the value of the element T(i,j) is used to characterize whether the disease entity starting with the character corresponding to index i in the sample candidate disease segment contains the character corresponding to index j, wherein m is the character length of the sample candidate disease segment; perform vector encoding on the sample candidate disease segment to obtain the character vector of each character in the sample candidate disease segment; perform feature extraction on the character vector of each character in the sample candidate disease segment through hole convolution to obtain the feature vector of each character in the sample candidate disease segment under different holes; take the feature vector of each character in the sample candidate disease segment under different holes as input and the value of each element in the second label matrix T as the target, perform multiple iterative training on the corresponding second basic model to adjust the weight matrix in the second basic model, and use the adjusted second basic model as the second prediction model.
6. An electronic device, characterized in that: The electronic device comprises: at least one memory and at least one processor; the memory stores a program, the processor calls the program stored in the memory, and the program is used to implement the non-continuous disease entity extraction method described in any one of claims 1-4.
Citation Information
Patent Citations
Text relation extraction model training method and device and readable storage medium
CN109522557A
Entity relationship joint extraction method, terminal and storage medium
CN112364650A