A named entity recognition method for breaking news text
The binary Pelican optimization algorithm is used to undersample news data, combined with the BiLSTM-CRF model, to solve the problem of news data class imbalance, improve the efficiency and performance of named entity recognition, and achieve a more efficient recognition effect.
Patent Information
- Application Number
- CN202211112641.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-14
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2042-09-14
AI Technical Summary
In massive news domain data, the number of truly useful entities is far less than insignificant entities, leading to class imbalance problems and affecting the efficiency of named entity extraction tasks.
The binary pelican optimization algorithm is used to perform under-sampling processing of data, and the optimal under-sampling ratio is determined through BiLSTM-CRF model training and verification to improve the efficiency of named entity recognition.
It effectively solves the imbalance problem of breaking news text data, improves the efficiency and performance of named entity recognition, and achieves more streamlined, efficient, and high-precision recognition results.
Smart Images

Figure CN115544251B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of news data processing, and in particular relates to a named entity recognition method for breaking news texts. Background Art
[0002] Media reports and comments on various natural disasters, social accidents and other sudden events. The basic elements of these news events can be extracted using named entity recognition methods, which is of great significance for accurate content mining and efficient content supervision. As people pay more and more attention to society, it is particularly important to more effectively extract key information from sudden news in order to achieve the purpose of correct guidance and education.
[0003] Currently, there are many mature named entity recognition technologies based on deep learning and machine learning. However, in the massive amount of news data, the number of truly useful entities is often far less than the number of insignificant entities, which easily causes class imbalance problems and directly affects subsequent entity extraction tasks. Summary of the invention
[0004] In order to solve the above problems, the present invention proposes a named entity recognition method for breaking news texts, improves the original Pelican optimization algorithm, and proposes a binary Pelican optimization algorithm to perform data undersampling to solve the problem of data imbalance in breaking news texts and improve the efficiency of named entity recognition.
[0005] The technical solution of the present invention is as follows:
[0006] A method for named entity recognition of breaking news texts includes the following steps:
[0007] Step 1: Obtain text data in the field of breaking news, build a historical data set, and perform entity classification;
[0008] Step 2: Perform heuristic undersampling on the data based on the binary Pelican optimization algorithm;
[0009] Step 3: Train the BiLSTM-CRF model using a training set of data from breaking news texts, determine the optimal undersampling ratio based on the values of relevant evaluation indicators, and obtain the corresponding algorithm model;
[0010] Step 4: Use the validation set to validate the trained BiLSTM-CRF model to obtain a BiLSTM-CRF model with good performance.
[0011] Step 5: Obtain text data in the field of breaking news in real time. First, use the Binary Pelican Optimization Algorithm to heuristically undersample the data. Then, identify the named entity types of the current text data based on the trained and well-performing BiLSTM-CRF model.
[0012] Furthermore, the specific process of step 1 is as follows:
[0013] Step 1.1: Acquire text data in the field of breaking news from the Internet and books to construct a historical data set, including crawling from Baidu Encyclopedia, major news websites, and obtaining from relevant books in the field of news; both parts of data obtained are knowledge related to natural disasters, accidents and disasters, public health events, and social security events;
[0014] Step 1.2: Classify the entity information in the data set; the entity information is used as the subject. Through the analysis of text data in the field of breaking news, the entity part is divided into seven categories according to the application of knowledge graph: time, place, person, event type, emergency mechanism, technical equipment, and education and training. In the subsequent recognition process, the entity is distinguished into the corresponding category;
[0015] Step 1.3: Use the BIO annotation method to annotate the data obtained in step 1.1 according to the entity type in step 1.2. The annotation is divided into three parts: "BX", "IX", and "O". Among them, "BX" represents the first character of entity type X, "IX" represents the middle character of entity type X, and "O" represents non-entity.
[0016] Furthermore, the specific process of step 2 is as follows:
[0017] Step 2.1: Record the non-entity "O" as a negative sample and the rest as a positive sample. Count the number of negative samples N for each sentence i. neg and the number of positive samples N pos , calculate the imbalance ratio IB of each sentence; select the smallest IB as the incremental step s, calculate IB∈[IB i , IB i +s], add them up to get the original imbalance rate OIB of the whole text;
[0018] Step 2.2: Use the binary pelican optimization algorithm and the result in step 2.1 to mark each negative sample in the sentence as 0 and the positive sample as 1 to select negative samples; each sentence is represented as a sample vector T i =[t 1 ,t 2 ,…,t m], i∈[1,n], n is the number of sentences in the text, m is the total number of positive and negative sample vectors in each sentence of the text, t g =0 / 1,g∈[1,m];
[0019] Step 2.3, input the sample vector into the binary Pelican optimization algorithm model to select the sample;
[0020] The binary Pelican optimization algorithm uses a V-type transfer function to map the solution of the continuous space to the discrete space, and obtains the corresponding 0 / 1 string, thereby selecting the desired solution. The modeling process is formula (5) and formula (6); in the original sample vector T i In the above example, the positive sample 1 remains unchanged, and all negative samples 0 participate in the operation, converting the original sample vector T i Assign to the population individual vector X i , select the negative samples that finally become 1 after operation, so as to realize undersampling processing of sample data;
[0021]
[0022]
[0023] Among them, the sample vector T i As the initial population position vector of the pelicans; is a V-type transfer function, tanh() is the hyperbolic tangent function x i,j Indicates the current position of the individual; X i,j represents the final position of the i-th individual in the j-th dimension, and rand is a random number between 0 and 1. The final result of the undersampling process is that after the operation of formula (6), all X i,j =1 samples.
[0024] Furthermore, the specific process of step 3 is as follows:
[0025] Step 3.1: Use distributed representation to obtain the vector representation H = {h 1 ,h 2 ,…,h m}∈R m*d , where h represents a single sample vector, R m*d represents the real number space, m is the total number of positive and negative sample vectors in each sentence of the text, and d represents the vector dimension;
[0026] Step 3.2: Use the undersampling result of step 2.3 and the vector representation of step 3.1 as input to the BiLSTM model to obtain the score of each sample corresponding to each entity type;
[0027] Among them, the undersampling result is combined with the vector representation, including using all the imbalance ratios OIB=[s,OIB] in step 2.1 and the binary Pelican optimization algorithm for iterative testing in turn, using F1 as the evaluation index, and F1 is a global index obtained by calculating the precision and recall rate; the combined form is H={h 1 ,h 2 ,…,h m}∈R m*d ;
[0028] In the iterative test, the maximum OIB is set to the maximum value of the iteration number l, and the current iteration number l is defined as l; the classifier is trained with the samples selected by the binary Pelican optimization algorithm, and the classifier is tested with the validation set, and the iteration number is increased by 1; this process is repeated until the loop condition 'l<=OIB' is not satisfied, then the loop is exited; the highest F1 is found, and the classifier with the best test result and the corresponding imbalance rate OIB=l are selected as the final result; the calculation method of F1 is shown in formula (7):
[0029]
[0030]
[0031]
[0032] Among them, P represents the accuracy of entity type recognition, that is, the score of each sample corresponding to the correct entity type, R represents the recall rate; TP represents the number of samples with positive samples and positive prediction results; FP represents the number of samples with negative samples but positive prediction results; MP represents the total number of samples after undersampling, that is, the number of samples input into the BiLSTM model;
[0033] Step 3.3: Input the scores obtained in step 3.2 into the CRF model, which adds constraints to the final predicted labels. Finally, select the model with the label sequence with the highest prediction score as the current optimal BiLSTM-CRF model output.
[0034] Furthermore, in step 3.3, the constraints added include: the label of the first word in the sentence should start with "BX" or "O", and the "OI-X" sequence is invalid.
[0035] Furthermore, the specific process of step 4 is as follows:
[0036] The model trained in step 3 is used to perform named entity recognition on the validation set of breaking news text data. The test samples are undersampled using the optimal undersampling ratio obtained, and the results are combined with the vector representation and sent to the BiLSTM-CRF model. The recognized entity sequence is compared with the validation set. If they are consistent, it proves that the model performance is good. Otherwise, the undersampling rate is selected from [s, OIB] in turn and retrained.
[0037] Beneficial technical effects brought by the present invention:
[0038] The binary method is integrated into the Pelican optimization algorithm, and a binary Pelican optimization algorithm is constructed. The algorithm is used to under-sample the sample data, which not only solves the imbalance problem of breaking news text data and enables the system to more easily obtain the breaking news entity types of interest; but also the efficiency of named entity recognition based on the BiLSTM-CRF model is high, which can constrain and promote each other with the under-sampling process, improves the overall performance of named entity recognition, is more targeted, and has the advantages of being more streamlined, efficient, and high-precision. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A schematic diagram of a process flow of a named entity recognition method for breaking news texts according to the present invention;
[0040] Figure 2 It is a schematic diagram of the process of heuristic undersampling based on the binary Pelican optimization algorithm of the present invention;
[0041] Figure 3 This is a structural diagram of a model instance for named entity recognition for breaking news text based on the BiLSTM-CRF model of the present invention. DETAILED DESCRIPTION
[0042] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0043] like Figure 1 and Figure 2 As shown, a named entity recognition method for breaking news text includes the following steps:
[0044] Step 1: Obtain text data in the field of breaking news, build a historical data set, and perform entity classification; the specific process is as follows:
[0045] Step 1.1: Acquire text data in the field of breaking news from the Internet and books to construct a historical data set, including crawling from Baidu Encyclopedia, major news websites, and obtaining from relevant books in the field of news; both parts of data obtained are knowledge related to natural disasters, accidents and disasters, public health events, and social security events;
[0046] Step 1.2: Classify the entity information in the data set; entity information is usually a subject, such as drought, earthquake, sandstorm, infectious disease, etc. Through the analysis of text data in the field of breaking news, the entity part is divided into seven categories according to the application of knowledge graph: time, place, person, event type, emergency mechanism, technical equipment, and education and training. In the subsequent recognition process, the entity is distinguished into the corresponding category;
[0047] Step 1.3: The data obtained in step 1.1 are annotated using the BIO annotation method according to the entity type in step 1.2. The annotation is divided into three parts: "BX", "IX", and "O". Among them, "BX" represents the first character of entity type X, "IX" represents the middle character of entity type X, and "O" represents non-entity.
[0048] Step 2: Perform heuristic undersampling on the data based on the binary Pelican optimization algorithm; the specific process is as follows:
[0049] Step 2.1: In most text information, non-entities are often much more than entities. Therefore, "O" is recorded as a negative sample and the rest as a positive sample. The number of negative samples N for each sentence i is counted separately. neg and the number of positive samples N pos , calculate the imbalance ratio IB for each sentence. Select the smallest IB as the incremental step size s and calculate IB∈[IB i , IB i +s], add them up to get the original imbalance rate OIB of the whole text;
[0050] Step 2.2: Use the Binary Pelican Optimization Algorithm and the results in Step 2.1 to mark each negative sample in the sentence as 0 and the positive sample as 1 to select negative samples. Each sentence can be represented as a sample vector T i =[t 1 ,t 2 ,…,t m ], i∈[1,n], n is the number of sentences in the text, m is the total number of positive and negative sample vectors in each sentence of the text, t g =0 / 1,g∈[1,m];
[0051] Step 2.3, input the sample vector into the binary pelican optimization algorithm model to select samples. The pelican optimization algorithm simulates the behavior and strategy of pelicans when attacking and hunting prey, which is divided into two stages: approaching prey (global exploration) and flying on the water surface (local development). In the first stage, the pelican determines the location of the prey and then moves to this determined area. To model this pelican strategy, a search space scan can be performed, which is modeled as formula (1) and formula (2). In the second stage, after the pelican reaches the water surface, it spreads its wings on the water surface, moves the fish upward, and then collects the prey in the throat bag, which is modeled as formula (3) and formula (4). The modeling process of the pelican optimization algorithm is implemented in a continuous search space. The binary pelican optimization algorithm uses a V-type transfer function to map the solution of the continuous space to the discrete space, obtain the corresponding 0 / 1 string, and then select the desired solution. The modeling process is formula (5) and formula (6). In the original sample vector T i In the above example, the positive sample 1 remains unchanged, and all negative samples 0 participate in the operation, converting the original sample vector T i Assign to the population individual vector X i , select the negative samples that finally become 1 after operation, so as to realize undersampling processing of sample data.
[0052]
[0053]
[0054]
[0055]
[0056]
[0057]
[0058] Among them, the sample vector T i As the initial population position vector of the pelicans. represents the position of the i-th individual in the j-th dimension in the first stage, represents the position of the i-th individual in the j-th dimension in the second stage, x i,j represents the current position of the individual, F p represents the fitness value of the prey's position, represents the fitness value of the first stage, Represents the fitness value of the second stage, F i Represents the fitness value of the current position; X i represents the position of the i-th individual in the new round, rand is a random number between 0 and 1; I is a random number equal to 1 or 2; p jis the position of the prey in the jth dimension. i is the objective function value. It is a V-type transfer function, tanh() is the hyperbolic tangent function, R=0.2, which is a constant; t is the current number of iterations, and T represents the total number of iterations. represents the overall position of the i-th individual in the first stage, represents the overall position of the i-th individual in the second stage, X i,j represents the final position of the i-th individual in the j-th dimension. The final result of undersampling is that after the operation of formula (6), all X i,j =1 samples.
[0059] Step 3: Train the BiLSTM-CRF model using the training set of data from breaking news texts, determine the optimal undersampling ratio based on the values of relevant evaluation indicators, and obtain the corresponding algorithm model; the specific process is as follows:
[0060] Step 3.1: Use distributed representation to obtain the vector representation H = {h 1 ,h 2 ,…,h m}∈R m*d , where h represents a single sample vector, R m*d represents the real number space, m is the total number of positive and negative sample vectors in each sentence of the text, and d represents the vector dimension;
[0061] Step 3.2: Use the undersampling result of step 2.3 and the vector representation of step 3.1 as input to the BiLSTM model to obtain the score of each sample corresponding to each entity type;
[0062] Among them, the undersampling result is combined with the vector representation, including using all the imbalance ratios OIB=[s,OIB] in step 2.1 and the binary Pelican optimization algorithm for iterative testing, using F1 as the evaluation index, and F1 is the global index obtained by calculating the precision and recall rate. The combined form is H={h 1 ,h 2 ,…,h m}∈R m*d .
[0063] like Figure 2As shown, in the iterative test, the maximum OIB is set to the maximum value of the iteration number l, and the current iteration number l is defined as l; the classifier is trained with the samples selected by the binary Pelican optimization algorithm, and the classifier is tested with the validation set, and the number of iterations is increased by 1; this process is repeated until the loop condition 'l<=OIB' is not satisfied, then the loop is exited; the highest F1 is found, and the classifier with the best test result and the corresponding imbalance rate OIB=l are selected as the final result. The calculation method of F1 is shown in formula (7):
[0064]
[0065]
[0066]
[0067] Among them, P represents the accuracy of entity type recognition, that is, the score of each sample corresponding to the correct entity type, and R represents the recall rate. TP represents the number of samples with positive samples and positive prediction results; FP represents the number of samples with negative samples but positive prediction results; MP represents the total number of samples after undersampling, that is, the number of samples input into the BiLSTM model.
[0068] Step 3.3: Input the scores obtained in step 3.2 into the CRF model. The CRF model can add some constraints to the final predicted labels, such as the label of the first word in the sentence should start with "BX" or "O", not "IX"; the "OI-X" sequence is invalid, etc. Finally, select the model with the highest predicted label sequence as the current optimal BiLSTM-CRF model output.
[0069] Step 4: Use the validation set to validate the trained BiLSTM-CRF model to obtain a BiLSTM-CRF model with good performance.
[0070] Use the model trained in step 3 to perform named entity recognition on the validation set of breaking news text data. Use the optimal undersampling ratio to undersample the test samples. Combine the results with the vector representation and feed them into the BiLSTM-CRF model. Compare the recognized entity sequence with the validation set. If they are consistent, it proves that the model has good performance. Otherwise, select the undersampling ratio from [s, OIB] in turn and retrain.
[0071] Step 5: Obtain text data in the field of breaking news in real time. First, use the Binary Pelican Optimization Algorithm to heuristically undersample the data. Then, identify the named entity types of the current text data based on the trained and well-performing BiLSTM-CRF model.
[0072] Figure 3This is an example of the operation of the BiLSTM-CRF model. The text content is "An explosion occurred in Chuxiong City yesterday". The location type is recorded as Loc, the time type is recorded as Tim, and the event type is recorded as Typ. According to the BIO annotation method, the correct annotation sequence should be "B-Loc" "I-Loc" "I-Loc" "B-Tim" "I-Tim" "O" "O" "B-Typ" "I-Typ"". Therefore, the input of the model is the content "An explosion occurred in Chuxiong City yesterday", and then the distributed representation is used for word embedding to obtain the word vector representation of the text. Then, these vector representations are input into the BiLSTM model, and the scores of each word corresponding to the seven entity types of "B-Loc", "I-Loc", "B-Tim", "I-Tim", "B-Typ", "I-Typ", and "O" are obtained. For example, the word "Chu" may be recognized as "B-Loc", "I-Loc", "B-Tim", "I-Tim", "B-Typ", "I-Typ", and "O" with scores of 1.3, 0.9, 0.04, 0.02, 0.08, 0.06, and 0.2 respectively. All these scores are input into the CRF model, and constraints are added to the predicted labels. Finally, the label sequence with the highest score "B-Loc", "I-Loc", "I-Loc", "B-Tim", "I-Tim", "O", "O", "B-Typ", "I-Typ"" is selected as the optimal entity recognition sequence, and the result is consistent with the correct annotation sequence. This shows that the performance of the model is good and can be used to solve the named entity recognition problem of breaking news text.
[0073] Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by technicians in this technical field within the essential scope of the present invention should also fall within the protection scope of the present invention.
Claims
1. A named entity recognition method for breaking news text, characterized in that: The following steps are involved: Step 1: Obtain text data in the field of breaking news, build a historical data set, and perform entity classification; Step 2: Perform heuristic undersampling on the data based on the binary Pelican optimization algorithm; The specific process is as follows: Step 2.1: Record the non-entity "O" as a negative sample and the rest as a positive sample. Count the number of negative samples N for each sentence i. neg and the number of positive samples N pos , calculate the imbalance ratio IB of each sentence; select the smallest IB as the incremental step s, calculate IB∈[IB i , IB i +s], add them up to get the original imbalance rate OIB of the whole text; Step 2.2: Use the binary pelican optimization algorithm and the result in step 2.1 to mark each negative sample in the sentence as 0 and the positive sample as 1 to select negative samples; each sentence is represented as a sample vector T i =[t1,t2,…,t m ], i∈[1,n], n is the number of sentences in the text, m is the total number of positive and negative sample vectors in each sentence of the text, t g =0 / 1,g∈[1,m]; Step 2.3, input the sample vector into the binary Pelican optimization algorithm model to select the sample; The binary Pelican optimization algorithm uses a V-type transfer function to map the solution of the continuous space to the discrete space, and obtains the corresponding 0 / 1 string, thereby selecting the desired solution. The modeling process is formula (5) and formula (6); in the original sample vector T i In the above example, the positive sample 1 remains unchanged, and all negative samples 0 participate in the operation, converting the original sample vector T i Assign to the population individual vector X i , select the negative samples that finally become 1 after operation, so as to realize undersampling processing of sample data; Among them, the sample vector T i As the initial population position vector of the pelicans; is a V-type transfer function, tanh() is a hyperbolic tangent function; x i,j Indicates the current position of the individual; X i,j represents the final position of the i-th individual in the j-th dimension, and rand is a random number between 0 and 1. The final result of the undersampling process is that after the operation of formula (6), all X i,j =1 samples; Step 3: Train the BiLSTM-CRF model using the training set of data from breaking news texts, determine the optimal undersampling ratio based on the values of relevant evaluation indicators, and obtain the corresponding algorithm model; the specific process is as follows: Step 3.1: Use distributed representation to obtain the vector representation of text data H = {h1,h2,…,h m }∈R m*d , where h represents a single sample vector, R m*d represents the real number space, m is the total number of positive and negative sample vectors in each sentence of the text, and d represents the vector dimension; Step 3.2: Use the undersampling result of step 2.3 and the vector representation of step 3.1 as input to the BiLSTM model to obtain the score of each sample corresponding to each entity type; Among them, the undersampling result is combined with the vector representation, including using all the imbalance ratios OIB=[s,OIB] in step 2.1 and the binary Pelican optimization algorithm for iterative testing in turn, using F1 as the evaluation index, and F1 is the global index obtained by calculating the precision and recall rate; the combined form is H={h1,h2,…,h m }∈R m*d ; In the iterative test, the maximum OIB is set to the maximum value of the iteration number l, and the current iteration number l is defined as l; the classifier is trained with the samples selected by the binary Pelican optimization algorithm, and the classifier is tested with the validation set, and the iteration number is increased by 1; this process is repeated until the loop condition 'l<=OIB' is not satisfied, then the loop is exited; the highest F1 is found, and the classifier with the best test result and the corresponding imbalance rate OIB=l are selected as the final result; the calculation method of F1 is shown in formula (7): Among them, P represents the accuracy of entity type recognition, that is, the score of each sample corresponding to the correct entity type, R represents the recall rate; TP represents the number of samples with positive samples and positive prediction results; FP represents the number of samples with negative samples but positive prediction results; MP represents the total number of samples after undersampling, that is, the number of samples input into the BiLSTM model; Step 3.3: Input the scores obtained in step 3.2 into the CRF model, which adds constraints to the final predicted labels. Finally, select the model with the highest predicted label sequence as the current optimal BiLSTM-CRF model output. Step 4: Use the validation set to validate the trained BiLSTM-CRF model to obtain a BiLSTM-CRF model with good performance. Step 5: Obtain text data in the field of breaking news in real time. First, use the Binary Pelican Optimization Algorithm to heuristically undersample the data. Then, identify the named entity types of the current text data based on the trained and well-performing BiLSTM-CRF model.
2. The method for named entity recognition for breaking news text according to claim 1, characterized in that: The specific process of step 1 is as follows: Step 1.1: Acquire text data in the field of breaking news from the Internet and books to construct a historical data set, including crawling from Baidu Encyclopedia, major news websites, and obtaining from relevant books in the field of news; both parts of data obtained are knowledge related to natural disasters, accidents and disasters, public health events, and social security events; Step 1.2: Classify the entity information in the data set; the entity information is used as the subject. Through the analysis of text data in the field of breaking news, the entity part is divided into seven categories according to the application of knowledge graph: time, place, person, event type, emergency mechanism, technical equipment, and education and training. In the subsequent recognition process, the entity is distinguished into the corresponding category; Step 1.3: Use the BIO annotation method to annotate the data obtained in step 1.1 according to the entity type in step 1.
2. The annotation is divided into three parts: "BX", "IX", and "O". Among them, "BX" represents the first character of entity type X, "IX" represents the middle character of entity type X, and "O" represents non-entity.
3. The method for named entity recognition for breaking news text according to claim 1, characterized in that: In step 3.3, the added constraints include: the label of the first word in the sentence should start with "BX" or "O", and the "OI-X" sequence is invalid.
4. The method for named entity recognition for breaking news text according to claim 1, characterized in that: The specific process of step 4 is as follows: The model trained in step 3 is used to perform named entity recognition on the validation set of breaking news text data. The test samples are undersampled using the optimal undersampling ratio obtained, and the results are combined with the vector representation and sent to the BiLSTM-CRF model. The recognized entity sequence is compared with the validation set. If they are consistent, it proves that the model performance is good. Otherwise, the undersampling rate is selected from [s, OIB] in turn and retrained.
