A Chinese named entity recognition method based on boundary detection
Through the method of boundary detection and multi-granularity embedding vector fusion, the problems of entity boundary complexity and word segmentation errors in Chinese named entity recognition are solved, the accuracy and recall rate of named entity recognition are improved, and the performance of F1 value is enhanced.
Patent Information
- Application Number
- CN202210532724.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2042-05-11
AI Technical Summary
Research on Chinese named entity recognition is difficult. Existing technologies fail to effectively consider the complexity of Chinese text entity boundaries, resulting in incomplete named entity recognition and word segmentation errors that affect accuracy.
Named entity recognition is divided into two stages: entity recognition and entity naming. The entity boundaries are assembled into candidate entities through boundary detection, and BiGRU and neural networks are used for boundary detection and entity classification. Multi-granularity embedding vectors and greedy algorithms are combined to improve recognition accuracy. Rate.
It improves the accuracy and recall rate of Chinese named entity recognition, reduces the computational complexity, and enhances the performance of F1 value.
Smart Images

Figure CN114818713B
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of natural language processing, and specifically relates to a Chinese named entity recognition method based on boundary detection. Background Art
[0002] .In this era of big data, a lot of structured data is used for statistical analysis. With the rapid development of modern science and technology, various social software have emerged. The text information on the Internet is becoming more and more abundant. How to make good use of the massive text information is becoming more and more urgent. Named entity recognition is an important technology for extracting structured information from unstructured text. At present, the mainstream research object in the field of named entity recognition is English, but in recent years, research on Chinese has received more and more attention.
[0003] .Compared with English named entity recognition, Chinese named entity recognition is more difficult to study. In English text, words are the basic units of reading and are divided by spaces. In Chinese text, sentences are composed of closely arranged Chinese characters. Chinese characters are the basic units of Chinese reading, and people will actively segment sentences during reading. Compared with the word-granularity embedding vector of English, the word-granularity vector of Chinese needs to perform word segmentation tasks. Errors in word segmentation will lead to errors in named entity recognition. Different word segmentation methods will change the semantic expression of the text and there will be problems with unregistered words. Although the use of word-granularity embedding vectors in Chinese can avoid word segmentation problems, the information contained in the word-granularity embedding vector is not rich enough. For example, the Chinese patent (patent number: CN111310470B) uses the fusion of word features to improve the F1 value of Chinese named entity recognition.
[0004] The current mainstream Chinese named entity recognition model does not take into account the complex situation of fuzzy entity boundaries in Chinese text, and there is a problem of incomplete entity recognition. How to effectively improve the accuracy of named entity recognition based on the characteristics of Chinese entity boundaries is a problem that researchers in the field of information mining need to solve.
[0005] The present invention divides named entity recognition into two stages: entity recognition and entity naming. In the first stage, the entity boundary is detected, and the candidate entity is assembled from the entity boundary to complete the entity recognition task; in the second stage, the entity category is classified by a neural network to complete the entity naming work. The detection of entity boundaries is conducive to reducing the complexity of calculation, while ensuring the accuracy of named entity recognition and improving the recall rate, that is, improving the F1 value. Summary of the invention
[0006] .The technical problem solved by the present invention is to provide a Chinese named entity recognition method based on boundary detection to improve the F1 value of Chinese named entity recognition in view of the shortcomings of the prior art.
[0007] In a first aspect, an embodiment of the present invention includes a method for Chinese named entity recognition based on boundary detection, which adopts the following technical solutions:
[0008] Step 1: Process the target text and represent it in multiple granularities. The basic steps are as follows:
[0009] .Step 1.1: Segment the target text according to punctuation marks to obtain sentence-granular text.
[0010] Step 1.2: Perform word-granularity embedding vector representation on the processed sentence-granularity text to obtain the word-granularity embedding vector
[0011] Step 1.3: Segment the sentence-level text at the same time, and represent the segmentation results with word-level embedding vectors to obtain word-level embedding vectors.
[0012] Step 1.4: Fuse the character-granularity embedding vector and the word-granularity embedding vector to obtain a multi-granularity embedding vector e i .
[0013] Step 2: Embed the multi-granularity representation i Input BiGRU, which is composed of forward GRU and backward GRU, to obtain the context information at the i-th moment
[0014] .Step 3: Use the neural network to analyze the context information h at each moment i Decode and judge h i Whether the position i represented is the boundary position of the entity or other position, the basic steps are as follows:
[0015] .Step 3.1: The neural network refers to a multi-layer perceptron and a Sigmoid activation function, which is used to calculate the hidden information h at each position. i Decoding refers to using a multi-layer perceptron to extract hidden information h i The boundary information of , the decoding formula is as follows:
[0016] .P i =Sigmoid(MLP(h i ))
[0017] .Step 3.2: Sigmoid outputs the final result, that is, the possibility that the position is the start position or the end position of the entity, using P i B and P i E These two tag values represent respectively;
[0018] Step 3.3: Use the log likelihood function as the loss function for the two labels of the training start position and the end position, and use Represents the loss function at the starting position, and uses The loss function representing the end position;
[0019] .
[0020] .
[0021] Step 3.4: Formula joint and These two losses are used to optimize the final prediction results.
[0022] Step 4: Use the greedy algorithm to assemble candidate entities at each entity boundary position as much as possible, and share the context information in step 2 to represent the candidate entities. The basic steps are as follows:
[0023] Step 4.1: Using right greedy matching, each start boundary obtained by boundary detection is greedily matched with n end boundaries on the right to obtain multiple candidate entities;
[0024] Step 4.2: Share the context information from the BiGRU output in step 2 to represent the candidate entity, i.e., candidate entity E ij =[h i ,...,h j ].
[0025] Step 5: Use the entity classifier to perform fine-grained processing on the candidate entities, identify the entity type, and complete named entity recognition. The basic steps are as follows:
[0026] .Step 5.1: Use a multi-layer perceptron plus a Softmax activation function as an entity classifier and predict the category label of the entity, as shown in the formula:
[0027] .P E =Softmax(MLP(E ij ))
[0028] .Step 5.2: The loss during training is the sum of all label losses. The loss function is calculated using the cross entropy loss function. The loss function formula is as follows:
[0029] .
[0030] .Suppose a sentence consists of m entities, n entity types, y ij Indicates that entity i belongs to category j, P(y ij ) represents the probability that candidate entity i belongs to sample j.
[0031] As a further improvement of the present invention, in the steps 1.2 and 1.3, the following operations are also performed:
[0032] .Use the Word2Vec pre-trained model to embed vector representations of the characters and words in the sentence to obtain character-granularity and word-granularity embedding vector representations.
[0033] As a further improvement of the present invention, in the step 1.4, the following operations are also performed;
[0034] . Assume that the input sentence is T = {T1, T2, ..., T n}, we use Indicates the i-th word granularity marker, using The word granularity tag represents the Chinese word composed of the j-th to k-th characters.
[0035] .The multi-granularity embedding vector e of the i-th word i Depend on and The fusion is obtained by vector splicing. The fusion formula is as follows:
[0036] . BRIEF DESCRIPTION OF THE DRAWINGS
[0037] .In order to more clearly illustrate the technical solution of the present invention, a brief introduction is given to the drawings required for use in the present invention.
[0038] . Figure 1 A framework diagram of a Chinese named entity recognition method based on boundary detection proposed by the present invention;
[0039] . Figure 2 Figure 2 is a method diagram for extracting boundary features;
[0040] . Figure 3 This is a flow chart of the Chinese named entity recognition method based on boundary detection. DETAILED DESCRIPTION
[0041] .The present invention is further described below in conjunction with the accompanying drawings and specific embodiments. It should be understood that these examples are only used to illustrate the present invention and are not used to limit the scope of the present invention. After reading the present invention, various equivalent forms of modifications to the present invention by those skilled in the art should all fall within the scope defined by the claims attached to this application.
[0042] .A Chinese named entity recognition method based on boundary detection. For Chinese text prediction, first, the Word2Vec pre-training model is used to obtain the character granularity and word granularity embedding vectors. Then, we fuse the character granularity and word granularity semantic information to obtain a multi-granularity embedding representation as the feature representation of the text. The obtained multi-granularity embedding vector uses characters as the basic unit and obtains the implicit vocabulary information of the word granularity, which is convenient for the subsequent detection of the start and end positions of the entity. After obtaining the multi-granularity embedding vector, BiGRU is used to obtain the context information of each position. Figure 2 Based on the context information, we use the multi-layer perceptron MLP and Sigmoid activation function to detect whether each word is the start or end position of the entity. After obtaining the entity position, we assemble the start and end positions based on the greedy algorithm to obtain the candidate entity. Then, we share the context information of BiGRU based on the position to represent the entity features. Finally, the feature information of the entity is input into the MLP, and the final entity type label is obtained through Softmax to complete the named entity recognition.
[0043] .The technical problem solved by the present invention is to provide a Chinese named entity recognition method based on boundary detection to improve the accuracy of Chinese named entity recognition in view of the shortcomings of the prior art.
[0044] Since the innovation of the present invention lies in the extraction of boundary information, the present invention uses the BMEOS annotation method, in which:
[0045] .Label B indicates the start position of an entity, label I indicates the middle position of an entity, label O indicates characters outside the entity, label E indicates the end position of an entity, and label S indicates an entity containing only one character.
[0046] The present invention is a Chinese named entity recognition method based on boundary detection, comprising the following steps:
[0047] Step 1: Process the target text and represent it in multiple granularities, including the following operations:
[0048] .Step 1.1: Segment the target text according to punctuation marks to obtain sentence-granular text.
[0049] Step 1.2: Perform word-granularity embedding vector representation on the processed sentence-granularity text to obtain the word-granularity embedding vector
[0050] Step 1.3: Segment the sentence-level text at the same time, and represent the segmentation results with word-level embedding vectors to obtain word-level embedding vectors.
[0051] Step 1.4: Fuse the character-granularity embedding vector and the word-granularity embedding vector to obtain a multi-granularity embedding vector e i .
[0052] .like Figure 1 As shown, multi-granularity embedding vectors [e1, e2, e3, e4, e5, e6, e7, e8] are obtained to express text information.
[0053] Step 2: Embed the multi-granularity representation i Input BiGRU, where BiGRU is composed of forward GRU and backward GRU, that is, the contextual hidden information h of the i-th position i It is formed by concatenating the outputs of the forward GRU and the backward GRU, as expressed in the following formula:
[0054] .
[0055] .
[0056] .
[0057] .like Figure 1 As shown in the figure, the multi-granularity embedding vector [e1,e2,e3,e4,e5,e6,e7,e8] is represented by [h1,h2,h3,h4,h5,h6,h7,h8] after BiGRU captures the context information.
[0058] .Step 3: Use the neural network to analyze the context information h at each moment i Decode and judge h i Whether the position i represented is the boundary position of the entity or other position.
[0059] .This step is the boundary detection part, such as Figure 2 , the context information [h1,h2,h3,h4,h5,h6,h7,h8] is respectively input into two independent detectors A and B for detecting the start position and the end position. The boundary positions are uniformly marked as B or E, and the non-boundary positions are uniformly marked as O.
[0060] For the two detectors, there are only two types of positions: boundary position and non-boundary position. Therefore, the present invention uses the Sigmoid function which is good at binary classification as the activation function. We get two sequences, such as Figure 2 As shown, the start position tag B and the end position tag E are included respectively.
[0061] In step 3, the following operations are also performed:
[0062] .Step 3.1: The neural network refers to a multi-layer perceptron and a Sigmoid activation function, which is used to calculate the hidden information h at each position. i To decode, the decoding formula is as follows:
[0063] .P i =Sigmoid(MLP(h i ))
[0064] Step 3.2: Establish two decoders to detect each position in the sentence and determine whether the position is the start or end position of the entity. The detected position i can get two label values P i B and P i E ;
[0065] Step 3.3: Use the log likelihood function as the loss function for the two labels of the training start position and the end position. The formula is as follows:
[0066] End position of the body;
[0067] .Step 3.4: At the same time, as formula joint and To optimize the prediction results.
[0068] Step 4: Use the greedy algorithm to assemble candidate entities at each entity boundary position as much as possible, and share the context information in step 2 to represent the candidate entities, including the following operations:
[0069] Step 4.1: Using right greedy matching, each start boundary obtained through boundary detection greedily matches the n end boundaries on the right side of the sentence to obtain multiple candidate entities;
[0070] .like Figure 1 As shown, we identify the entity by assembling the start position tag B and the end position tag E.
[0071] If the starting position is i, the ending position is j, and i is less than j, then the candidate entity E can be assembled ij .
[0072] Step 4.2: Share the context information from the BiGRU output in step 2 to represent the candidate entity, i.e., candidate entity E ij =[h i ,...,h j ].
[0073] .Exhaust all entity possibilities through similar examples, and then represent the semantic information of candidate entities by sharing the context information output by BiGRU.
[0074] Step 5: Use the entity classifier to perform fine-grained processing on the candidate entities, identify the entity type, and complete named entity recognition, including performing the following operations:
[0075] .Step 5.1: Use a multi-layer perceptron plus a Softmax activation function as an entity classifier and predict the category label of the entity, as shown in the formula:
[0076] .P E =Softmax(MLP(E ij ))
[0077] .Step 5.2: The loss during training is the sum of all label losses. The loss function is calculated using the cross entropy loss function. The loss function formula is as follows:
[0078] .
[0079] .Suppose a sentence consists of m entities, n entity types, y ij Indicates that entity i belongs to category j, P(y ij ) represents the probability that candidate entity i belongs to category j.
[0080] .like Figure 1 ,We obtained three candidate entities in step 4, and predict the entity type through MLP and Softmax activation function.
[0081] Among them, the types of labels are diverse, and we can use activation functions like Softmax that are good at multi-classification to predict entity types.
[0082] .exist Figure 1 In the embodiment, we use the entity classifier to label the three candidate entities as person names, place names, and organization names respectively.
[0083] As a further improvement of the present invention, in the steps 1.2 and 1.3, the following operations are also performed:
[0084] .Use the Word2Vec pre-trained model to embed vector representations of the characters and words in the sentence to obtain character-granularity and word-granularity embedding vector representations.
[0085] As a further improvement of the present invention, in step 1.4, the following operations are also performed:
[0086] . Assume that the input sentence is T = {T1, T2, ..., T n}, we use Indicates the i-th word granularity marker, using The word granularity tag represents the Chinese word composed of the j-th to k-th characters.
[0087] .The multi-granularity embedding vector e of the i-th word i Depend on and The fusion is obtained by vector splicing. The fusion formula is as follows:
[0088] .
[0089] In this embodiment, the obtained multi-granularity embedding vector is as follows Figure 1 The [e1,e2,e3,e4,e5,e6,e7,e8] representation.
[0090] It should be noted that the above embodiments are only used to illustrate the technical solution of the present invention, rather than to limit it.
[0091] .It should be understood by those skilled in the art that, without departing from the concept of the present invention, any modification of the recorded technical solution or any equivalent replacement of some of the technologies therein should be deemed to fall within the scope of protection of the present invention.
Claims
1. A Chinese named entity recognition method based on boundary detection, characterized in that: The steps include: Step 1: Process the target text and represent it in multiple granularities. The basic steps are as follows: Step 1.1: segment the target text according to punctuation marks to obtain sentence-granular text; Step 1.2: Perform word-granularity embedding vector representation on the processed sentence-granularity text to obtain the word-granularity embedding vector Step 1.3: Segment the sentence-level text at the same time, and represent the segmentation results with word-level embedding vectors to obtain word-level embedding vectors. Step 1.4: Fuse the character-granularity embedding vector and the word-granularity embedding vector to obtain a multi-granularity embedding vector e i ; Step 2: Embed the multi-granularity representation i Input BiGRU to get the context information h of the i-th position i , Among them, BiGRU is composed of forward GRU and backward GRU, that is, the context hidden information h of the i-th position i It is composed of the output of forward GRU and backward GRU; Step 3: Use the neural network to learn the context information h at each moment i Decode and judge h i Whether the position i represented is the start position or the end position of the entity, the basic steps are as follows: Step 3.1: The neural network refers to a multi-layer perceptron and a Sigmoid activation function, which is used to calculate the hidden information h at each position. i Decoding refers to using a multi-layer perceptron to extract hidden information h i Boundary information; Step 3.2: Sigmoid outputs the final result, that is, the possibility that the position is the start position or the end position of the entity, using P i B and P i E These two tag values represent respectively; Step 3.3: Use the log likelihood function as the loss function for the two labels of the training start position and the end position, and use Represents the loss function at the starting position, and uses The loss function representing the end position; Step 3.4: Formula joint and These two losses are used to optimize the final prediction results; Step 4: Use the greedy algorithm to assemble candidate entities at each entity boundary position as much as possible, and share the context information in step 2 to represent the candidate entities. The basic steps are as follows: Step 4.1: Using right greedy matching, each start boundary obtained by boundary detection is greedily matched with n end boundaries on the right to obtain multiple candidate entities; Step 4.2: Share the contextual information from the BiGRU output in step 2 to represent the candidate entity, i.e., candidate entity E ij =[h i ,...,h j ]; Step 5: Use the entity classifier to perform fine-grained processing on the candidate entities, identify the entity type, and complete named entity recognition. The content is as follows: A multi-layer perceptron plus a Softmax activation function is used as an entity classifier to predict the category label of the entity; the loss during training is the sum of all label losses, and the loss function is calculated using the cross entropy loss function.
2. The target text processing and multi-granularity representation according to claim 1, characterized in that: The character-level embedding representation and word-level embedding representation include: The Word2Vec pre-trained model is used to embed vector representations of the characters and words in the sentence to obtain character-granularity and word-granularity embedding vector representations.
3. The target text processing and multi-granularity representation according to claim 1, characterized in that: In step 1.4, the embedding vectors of the character granularity and word granularity are fused by vector splicing to obtain a multi-granularity embedding vector, including: Assume that the input sentence is T = {T1, T2, ..., T n }, we use Indicates the i-th word granularity marker, using Represents the word granularity tag of the Chinese word composed of the jth to kth characters; the multi-granularity embedding vector e of the i-th character i Depend on and The fusion is obtained by vector splicing.
