A Chinese named entity recognition method and system based on graph attention network
By adopting a method based on graph attention network in Chinese named entity recognition, integrating word segmentation and character features, and using cardinality-preserving graph attention network calculation, the problem of inconsistent boundaries and single features in the BiLSTM-CRF model is solved, and the naming efficiency is improved. Entity recognition accuracy.
Patent Information
- Application Number
- CN202210083152.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-25
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-01-25
AI Technical Summary
The word boundaries and entity boundaries in the existing BiLSTM-CRF model are inconsistent, the model input features are single, and the traditional graph attention calculation in the collaborative graph network model based on the graph attention network damages the expressive ability.
A Chinese named entity recognition method based on graph attention network is adopted. By constructing a word vector set and a word-character interaction graph, a cardinality-preserving graph attention network calculation method is used to integrate word segmentation features and character features, and calculate graph attention to improve expression. ability.
It solves the problem of inconsistency between word boundaries and entity boundaries, enhances the feature fusion ability of the model, and improves the accuracy of named entity recognition.
Smart Images

Figure CN114417874B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of entity recognition, and more specifically, relates to a Chinese named entity recognition method and system based on a graph attention network. Background Art
[0002] Named Entity Recognition (NER) is a basic problem in natural language processing and the first step in a series of downstream tasks, such as relation extraction, knowledge graph construction, and intent detection. The main goal of NER is to identify entities with specific meanings in unstructured text, including names of people, places, institutions, proper nouns, etc., as well as time, quantity, currency, ratio, and other text.
[0003] Early named entity recognition revolved around rule-based and dictionary-based methods, but these methods were inefficient, costly, and required a lot of expertise. Currently, the models that perform well in NER are based on deep learning or statistical learning methods. Among them, BiLSTM-CRF is a widely used architecture for English NER. It uses word-level representation and uses words as the basic unit for predicting labels. Compared with English NER, Chinese named entity recognition is more difficult, so a word segmentation tool is used first, and then a tagging model based on word sequences is derived like English. In addition, the collaborative graph network model based on the graph attention network introduced the graph attention mechanism into NER for the first time, and incorporated vocabulary knowledge such as self-matching words and recent context words into the encoding layer to further improve the effect of named entity recognition.
[0004] The traditional BiLSTM-CRF model still has the following problems after being improved by adding the Chinese word segmentation tool, which leads to its poor performance: First, word boundaries are not necessarily entity boundaries: for example, "Beijing Palace Museum" should be an entity location type as a whole, but it will be divided into three words "Beijing", "Forbidden City" and "Museum" by the word segmentation tool; Second, although Chinese word segmentation has made great progress due to the introduction of neural networks, the existing model is far from perfect, and the features considered by the model are relatively single, which will inevitably lead to the propagation of errors.
[0005] When the collaborative graph network model based on graph attention network uses the traditional graph attention network to calculate attention, due to continuous linear calculations, static attention is obtained, which damages the expressive power of graph attention. Summary of the invention
[0006] In view of the above defects or improvement needs of the prior art, the present invention provides a Chinese named entity recognition method and system based on a graph attention network, which aims to solve the technical problems of inconsistency between word boundaries and entity boundaries and single model input features in the existing BiLSTM-CRF model, as well as the technical problem that the traditional graph attention calculation method in the existing collaborative graph network model based on the graph attention network damages the graph attention expression ability.
[0007] To achieve the above object, according to one aspect of the present invention, a Chinese named entity recognition method based on a graph attention network is provided, comprising the following steps:
[0008] (1) Obtain Chinese sentences to be recognized by Chinese named entities.
[0009] (2) Based on the Chinese sentences obtained in step (1), construct a character vector set X corresponding to the Chinese sentences.
[0010] (3) Input the character vector set X corresponding to the Chinese sentence obtained in step (2) into the trained Chinese named entity recognition model based on graph attention network to obtain the Chinese named entity annotation corresponding to the Chinese sentence.
[0011] Preferably, step (2) firstly represents the Chinese sentence as a character sequence s={s 1 ,s 2 ,…,s m}, where s m represents the mth character in the Chinese sentence, where m∈[1, the total number of characters in the Chinese sentence M]; then, for each character in the character sequence, the character is represented as a word vector x by looking up the character embedding matrix m =f(s m ), all word vectors constitute the word vector set X corresponding to the Chinese sentence, where f is a character embedding lookup table trained by the continuous bag of words model CBOW.
[0012] Preferably, the Chinese named entity recognition model based on the graph attention network in step (3) is trained by the following steps:
[0013] (3-1) Obtain a Chinese named entity recognition dataset annotated with the BIOES tagging scheme, map the text of each Chinese sentence in the Chinese named entity recognition dataset into a character vector, and obtain a character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset.
[0014] (3-2) Input the character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) into the bidirectional long short-term memory BiLSTM model to obtain the preliminary feature vector of the character vector, and then input the preliminary feature vector of the character vector into the improved graph attention network GAT model to obtain the final feature vector corresponding to the Chinese sentence.
[0015] (3-3) The final feature vector corresponding to the Chinese sentence obtained in step (3-2) is input into the conditional random field model for decoding to obtain the Chinese named entity annotation corresponding to the Chinese sentence. The annotation result is used to calculate the loss function of the Chinese named entity recognition model based on the graph attention network and train the parameters of the BiLSTM model and the GAT model to obtain a trained Chinese named entity recognition model based on the graph attention network, which includes the BiLSTM model and the GAT model in step (3-2) and the conditional random field model in step (3-3).
[0016] Preferably, step (3-1) comprises the following steps:
[0017] (3-1-1) Obtain Chinese named entity recognition datasets in multiple fields, and annotate the Chinese named entity recognition datasets using the BIOES tagging scheme to obtain annotated Chinese named entity recognition datasets;
[0018] (3-1-2) Based on the annotated Chinese named entity recognition dataset obtained in step (3-1-1), construct a character vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset.
[0019] Preferably, step (3-2) specifically includes the following sub-steps:
[0020] (3-2-1) For each word vector in the word vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), a BiLSTM model is used to perform preliminary modeling to obtain two different feature representations, forward and backward, and the two feature representations are concatenated to obtain a Chinese sentence feature vector corresponding to the word vector containing context features. The Chinese sentence feature vectors corresponding to the word vector set corresponding to the Chinese sentence constitute a Chinese sentence feature vector set H corresponding to the Chinese sentence = {h 1 ,h 2 ,…,h m}, where m∈[1, the total number of characters in the Chinese sentence M];
[0021] (3-2-2) Use the character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) to construct the word-character interaction graph G = (V, E) corresponding to the Chinese sentence.
[0022] Where V is a node set, which includes all characters and self-matching words in the word vector set corresponding to the Chinese sentence; E is an edge set, which includes the connection relationship between characters in the word vector set, the inclusion relationship between characters and self-matching words, and the connection relationship between self-matching words;
[0023] (3-2-3) Obtain the word information fusion correlation coefficient matrix e corresponding to the Chinese sentence based on the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) and the word-character interaction graph G corresponding to the Chinese sentence constructed in step (3-2-2).
[0024] (3-2-4) For each element e(h i ,h j ) is normalized to obtain the attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence ij ;
[0025] (3-2-5) The attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-4) ij , using the cardinality-preserving graph attention network calculation method to obtain the feature vector k of each node in the word-character interaction graph G corresponding to the Chinese sentence i , the feature vector k of all nodes in the word-character interaction graph G corresponding to the Chinese sentence i The feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence;
[0026] (3-2-6) Perform a weighted summation of the feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-5) and the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) to obtain the final feature vector R=W corresponding to the Chinese sentence 1 H+W 2 K, where W 1 With W 2 is a trainable matrix.
[0027] Preferably, the Chinese sentence feature vector h corresponding to the mth word vector in the Chinese sentence in step (3-2-1) m Given by:
[0028]
[0029]
[0030]
[0031] in, represents the hidden layer output of the forward LSTM at time t, represents the hidden layer output of the reverse LSTM at time t, h m express and The splicing result, x m Represents the mth word vector in a Chinese sentence;
[0032] The element in the i-th row and j-th column of the word information fusion correlation coefficient matrix e in step (3-2-3), that is, the word information fusion correlation coefficient e(h) between nodes i and i in the word-character interaction graph G i ,h j ) is given by:
[0033] e(h i ,h j )=a T Leaky ReLU(Wh i ||Wh j )
[0034] where Leaky ReLU is the activation function, a and W are learnable parameter matrices, and i and j are both ∈ [1, the total number of nodes N in the word-character interaction graph G].
[0035] The attention coefficient α between node i and node j in graph G in step (3-2-4) ij Normalization uses the soft max normalization function method:
[0036] α ij =soft max(e(h i ,h j ))
[0037] Preferably, the feature vector k of the i-th node in the word-character interaction graph G in step (3-2-5) is i is calculated using the following formula:
[0038]
[0039] Where N is the total number of nodes in the word-character interaction graph G, w is the learnable parameter matrix, ⊙ represents element-by-element multiplication, and k j Represents the feature vector of the jth node in the word-character interaction graph G.
[0040] Preferably, step (3-3) specifically includes the following sub-steps:
[0041] (3-3-1) The final feature vector R corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-2) is decoded using CRF to obtain the labeling result corresponding to the Chinese sentence;
[0042] (3-3-2) For the labeling results Y of each entity of the Chinese sentence obtained in step (3-3-1), calculate the loss function of the Chinese named entity recognition model based on the graph attention network, iteratively train the model, and obtain the trained Chinese named entity recognition model based on the graph attention network.
[0043] Preferably, for the final feature vector R corresponding to each Chinese sentence, the entity annotation result of the Chinese sentence obtained after decoding is Y={y 1 ,y 2 ,…,y m}, and label the result as y m The probability P(y m |s m ), where y m Indicates the labeling result of the mth character in the Chinese sentence;
[0044] The training process of the model in step (3-3-2) uses L2 regularization to minimize the log-likelihood loss to optimize the model. The loss function is defined as:
[0045]
[0046] Among them, γ is the regularization parameter of L2, preferably with a value of 0.5, and θ is the parameter of all trainable sets.
[0047] According to another aspect of the present invention, a Chinese named entity recognition system based on a graph attention network is provided, comprising:
[0048] The first module is used to obtain Chinese sentences to be recognized by Chinese named entities.
[0049] The second module is used to construct a character vector set X corresponding to the Chinese sentence based on the Chinese sentence obtained in the first module.
[0050] The third module is used to input the character vector set X corresponding to the Chinese sentence obtained in the second module into the trained Chinese named entity recognition model based on the graph attention network to obtain the Chinese named entity annotation corresponding to the Chinese sentence.
[0051] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0052] 1. Since the present invention adopts step (3-1), it uses a labeled Chinese named entity recognition data set, so it can solve the technical problem of inconsistency between word boundaries and entity boundaries in the existing BiLSTM-CRF model.
[0053] 2. Since the present invention adopts step (3-1) and step (3-2), it integrates the word segmentation features and character features of Chinese sentences, and thus can solve the technical problem of single model input features existing in the existing BiLSTM-CRF model.
[0054] 3. Since the present invention adopts step (3-2), it uses a cardinality-preserving graph attention network calculation method to calculate graph attention, and thus can solve the problem that the traditional graph attention calculation method in the existing collaborative graph network model based on the graph attention network damages the graph attention expression ability. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 It is a flow chart of a Chinese named entity recognition method based on a graph attention network of the present invention;
[0056] Figure 2 It is a schematic diagram of the working process of the Chinese named entity recognition model based on the graph attention network of the present invention. DETAILED DESCRIPTION
[0057] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0058] like Figure 1 As shown, the present invention provides a Chinese named entity recognition method based on a graph attention network, comprising the following steps:
[0059] (1) Obtain Chinese sentences to be recognized by Chinese named entities.
[0060] (2) Based on the Chinese sentences obtained in step (1), construct a character vector set X corresponding to the Chinese sentences.
[0061] Specifically, this step first represents the Chinese sentence as a character sequence s={s 1 ,s 2 ,…,s m}, where s mrepresents the mth character in the Chinese sentence, where m∈[1, the total number of characters in the Chinese sentence M]; then, for each character in the character sequence, the character is represented as a word vector x by looking up the character embedding matrix m =f(s m ), all word vectors constitute the word vector set X corresponding to the Chinese sentence, where f is a character embedding lookup table trained by the Continuous Bag-of-Word Model (CBOW).
[0062] (3) Input the word vector set X corresponding to the Chinese sentence obtained in step (2) into the trained Chinese named entity recognition model based on graph attention network (such as Figure 2 As shown), the Chinese named entity annotation corresponding to the Chinese sentence is obtained.
[0063] The Chinese named entity recognition model based on graph attention network in step (3) is trained by the following steps:
[0064] (3-1) Obtain a Chinese named entity recognition dataset annotated with the BIOES (B-begin, I-inside, O-outside, E-end, S-single, referred to as BIOES) marking scheme, and map the text of each Chinese sentence in the Chinese named entity recognition dataset into a character vector to obtain a set of character vectors corresponding to each Chinese sentence in the Chinese named entity recognition dataset.
[0065] (3-2) The character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) is input into the Bi-directional Long Short-Term Memory (BiLSTM) model to obtain a preliminary feature vector of the character vector, and then the preliminary feature vector of the character vector is input into the improved Graph Attention Network (GAT) model to obtain the final feature vector corresponding to the Chinese sentence (which contains richer semantic information).
[0066] (3-3) The final feature vector corresponding to the Chinese sentence obtained in step (3-2) is input into the conditional random field model for decoding to obtain the Chinese named entity annotation corresponding to the Chinese sentence. The annotation result is used to calculate the loss function of the Chinese named entity recognition model based on the graph attention network and train the parameters of the BiLSTM model and the GAT model to obtain a trained Chinese named entity recognition model based on the graph attention network (which includes the BiLSTM model and the GAT model in step (3-2) and the conditional random field model in step (3-3)).
[0067] Preferably, the series of preprocessing of the Chinese named entity recognition dataset described in step (3-1) includes the following steps:
[0068] (3-1-1) Obtain Chinese named entity recognition datasets in multiple fields, and use the BIOES tagging scheme to annotate the Chinese named entity recognition datasets to obtain annotated Chinese named entity recognition datasets.
[0069] The Chinese named entity recognition dataset includes news, social media, and Chinese resumes, and its entity types include GPE (geopolitical entity), LOC (location), PER (person), ORG (organization), CONT (country), and EDU (educational background).
[0070] In the BIOES tagging scheme, the first character in an entity is marked as BX, where X is the entity type. Similarly, the last character and the characters inside the entity are marked as EX and IX respectively, SX indicates that the word itself is an entity X, and the remaining non-entity characters are marked as O.
[0071] (3-1-2) Based on the annotated Chinese named entity recognition dataset obtained in step (3-1-1), construct a character vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset.
[0072] Specifically, constructing the word vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset is to represent the Chinese sentence as a character sequence s = {s 1 ,s 2 ,…,s m}, where s m represents the mth character in the Chinese sentence, where m∈[1, the total number of characters in the Chinese sentence M]; then, for each character in the character sequence, the character is represented as a word vector x by looking up the character embedding matrix m =f(s m ), the word vectors corresponding to all characters in the Chinese sentence constitute the word vector set X corresponding to the Chinese sentence, where f is a character embedding lookup table trained by the Continuous Bag-of-Word Model (CBOW).
[0073] Preferably, step (3-2) specifically includes the following sub-steps:
[0074] (3-2-1) For each word vector in the word vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), a BiLSTM model is used to perform preliminary modeling to obtain two different feature representations, forward and backward, and the two feature representations are concatenated to obtain a Chinese sentence feature vector corresponding to the word vector containing context features. The Chinese sentence feature vectors corresponding to the word vector set corresponding to the Chinese sentence constitute a Chinese sentence feature vector set H corresponding to the Chinese sentence = {h 1 ,h 2 ,…,h m}, where m∈[1, the total number of characters in the Chinese sentence M].
[0075] The Chinese sentence feature vector h corresponding to the mth word vector in the Chinese sentence m Given by:
[0076]
[0077]
[0078]
[0079] in, represents the hidden layer output of the forward LSTM at time t, represents the hidden layer output of the reverse LSTM at time t, h m express and The splicing result, x m Represents the mth word vector in a Chinese sentence.
[0080] (3-2-2) Use the character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) to construct the word-character interaction graph G = (V, E) corresponding to the Chinese sentence.
[0081] Where V is a node set, which includes all characters and self-matching words in the word vector set corresponding to the Chinese sentence (that is, each word segment of the Chinese sentence. The Chinese named entity recognition dataset annotated with the BIOES tagging scheme can directly obtain the word segmentation results of the Chinese sentence); E is an edge set, which includes the connection relationship between characters in the word vector set, the inclusion relationship between characters and self-matching words, and the connection relationship between self-matching words.
[0082] (3-2-3) Obtain the word information fusion correlation coefficient matrix e corresponding to the Chinese sentence based on the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) and the word-character interaction graph G corresponding to the Chinese sentence constructed in step (3-2-2).
[0083] Specifically, the element in the i-th row and j-th column of the word information fusion correlation coefficient matrix e, that is, the word information fusion correlation coefficient e(h i ,h j ) is given by:
[0084] e(h i ,h j )=a T Leaky ReLU(Wh i ||Wh j )
[0085] where Leaky ReLU is the activation function, a and W are learnable parameter matrices, and i and j are both ∈ [1, the total number of nodes N in the word-character interaction graph G].
[0086] (3-2-4) For each element e(h i ,h j ) is normalized to obtain the attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence ij ;
[0087] The attention coefficient α between node i and node j in graph G ij Normalization uses the soft max normalization function method:
[0088] α ij =soft max(e(h i ,h j ))
[0089] (3-2-5) The attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-4) ij , using the cardinality-preserving graph attention network calculation method to obtain the feature vector k of each node in the word-character interaction graph G corresponding to the Chinese sentence i , the feature vector k of all nodes in the word-character interaction graph G corresponding to the Chinese sentence i The feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence;
[0090] Specifically, the cardinality-preserving graph attention network calculation method in this step can be found on page 4 of the paper "Improving Attention Mechanism in Graph Neural Networks via Cardinality Preservation" by Shuo Zhang.
[0091] The feature vector k of the i-th node in the word-character interaction graph G i is calculated using the following formula:
[0092]
[0093] Where N is the total number of nodes in the word-character interaction graph G, w is the learnable parameter matrix, ⊙ represents element-by-element multiplication, and k j Represents the feature vector of the jth node in the word-character interaction graph G.
[0094] (3-2-6) Perform a weighted summation of the feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-5) and the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) to obtain the final feature vector R=W corresponding to the Chinese sentence 1 H+W 2 K, where W 1 With W 2 is a trainable matrix;
[0095] Specifically, the final feature vector R is a feature vector of the Chinese sentence containing richer semantic information, which is used as the input vector of the conditional random field model.
[0096] Preferably, step (3-3) specifically includes the following sub-steps:
[0097] (3-3-1) The final feature vector R corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-2) is decoded using a conditional random field (CRF) model to obtain the labeling result corresponding to the Chinese sentence.
[0098] For the final feature vector R corresponding to each Chinese sentence, the entity annotation result of the Chinese sentence obtained after decoding is Y={y 1 ,y 2 ,…,y m}, and label the result as y m The probability P(y m |s m ), where y mIndicates the labeling result of the mth character in the Chinese sentence, s m Represents the mth character in a Chinese sentence, m∈[1, the total number of characters in the Chinese sentence M].
[0099] (3-3-2) For the labeling results Y of each entity of the Chinese sentence obtained in step (3-3-1), calculate the loss function of the Chinese named entity recognition model based on the graph attention network, iteratively train the model, and obtain the trained Chinese named entity recognition model based on the graph attention network.
[0100] The training process of the model uses L2 regularization to minimize the log-likelihood loss to optimize the model. The loss function is defined as:
[0101]
[0102] Among them, γ is the regularization parameter of L2, and its preferred value is 0.5. θ is the parameter of all trainable sets, which corresponds to all the trainable parameters and matrices mentioned in the above process.
[0103] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A Chinese named entity recognition method based on graph attention network, It is characterized in that The following steps are involved: (1) Obtaining Chinese sentences to be recognized by Chinese named entities; (2) constructing a word vector set X corresponding to the Chinese sentence based on the Chinese sentence obtained in step (1); (3) Input the word vector set X corresponding to the Chinese sentence obtained in step (2) into the trained Chinese named entity recognition model based on the graph attention network to obtain the Chinese named entity labeling corresponding to the Chinese sentence; the Chinese named entity recognition model based on the graph attention network in step (3) is trained by the following steps: (3-1) obtaining a Chinese named entity recognition dataset annotated with the BIOES tagging scheme, mapping the text of each Chinese sentence in the Chinese named entity recognition dataset into a word vector, so as to obtain a word vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset; step (3-1) comprises the following steps: (3-1-1) Obtain Chinese named entity recognition datasets in multiple fields, and annotate the Chinese named entity recognition datasets using the BIOES tagging scheme to obtain annotated Chinese named entity recognition datasets; (3-1-2) Based on the annotated Chinese named entity recognition dataset obtained in step (3-1-1), construct a character vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset; (3-2) Inputting the word vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) into the bidirectional long short-term memory BiLSTM model to obtain a preliminary feature vector of the word vector, and then inputting the preliminary feature vector of the word vector into the improved graph attention network GAT model to obtain the final feature vector corresponding to the Chinese sentence; step (3-2) specifically includes the following sub-steps: (3-2-1) For each word vector in the word vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), a BiLSTM model is used to perform preliminary modeling to obtain two different feature representations, forward and backward, and the two feature representations are concatenated to obtain a Chinese sentence feature vector corresponding to the word vector containing context features. The Chinese sentence feature vectors corresponding to the word vector set corresponding to the Chinese sentence constitute a Chinese sentence feature vector set H corresponding to the Chinese sentence = {h 1 ,h 2 ,…,h m }, where m∈[1, the total number of characters in the Chinese sentence M]; (3-2-2) Using the character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), construct a word-character interaction graph G = (V, E) corresponding to the Chinese sentence; Where V is a node set, which includes all characters and self-matching words in the word vector set corresponding to the Chinese sentence; E is an edge set, which includes the connection relationship between characters in the word vector set, the inclusion relationship between characters and self-matching words, and the connection relationship between self-matching words; (3-2-3) Obtaining the word information fusion correlation coefficient matrix e corresponding to the Chinese sentence according to the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) and the word-character interaction graph G corresponding to the Chinese sentence constructed in step (3-2-2); (3-2-4) For each element e(h i ,h j ) is normalized to obtain the attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence ij ; (3-2-5) The attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-4) ij , using the cardinality-preserving graph attention network calculation method to obtain the feature vector k of each node in the word-character interaction graph G corresponding to the Chinese sentence i , the feature vector k of all nodes in the word-character interaction graph G corresponding to the Chinese sentence i The feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence; (3-2-6) Perform a weighted summation of the feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-5) and the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) to obtain the final feature vector R=W corresponding to the Chinese sentence 1 H+W 2 K, where W 1 With W 2 is a trainable matrix; (3-3) The final feature vector corresponding to the Chinese sentence obtained in step (3-2) is input into the conditional random field model for decoding to obtain the Chinese named entity annotation corresponding to the Chinese sentence. The annotation result is used to calculate the loss function of the Chinese named entity recognition model based on the graph attention network and train the parameters of the BiLSTM model and the GAT model to obtain a trained Chinese named entity recognition model based on the graph attention network, which includes the BiLSTM model and the GAT model in step (3-2) and the conditional random field model in step (3-3).
2. According to the Chinese named entity recognition method based on graph attention network according to claim 1, It is characterized in that Step (2) is to first represent the Chinese sentence as a character sequence s={s 1 ,s 2 ,…,s m }, where s m represents the mth character in the Chinese sentence, where m∈[1, the total number of characters in the Chinese sentence M]; then, for each character in the character sequence, the character is represented as a word vector x by looking up the character embedding matrix m =f(s m ), all word vectors constitute the word vector set X corresponding to the Chinese sentence, where f is a character embedding lookup table trained by the continuous bag of words model CBOW.
3. According to claim 2, the Chinese named entity recognition method based on graph attention network, It is characterized in that The Chinese sentence feature vector h corresponding to the mth word vector in the Chinese sentence in step (3-2-1) m Given by: in, represents the hidden layer output of the forward LSTM at time t, represents the hidden layer output of the reverse LSTM at time t, h m express and The splicing result, x m Represents the mth word vector in a Chinese sentence; The element in the i-th row and j-th column of the word information fusion correlation coefficient matrix e in step (3-2-3), that is, the word information fusion correlation coefficient e(h) between nodes i and i in the word-character interaction graph G i ,h j ) is given by: e(h i ,h j )=a T Leaky ReLU(Wh i ||Wh j ) Where Leaky ReLU is the activation function, a and W are learnable parameter matrices, i and j are both ∈ [1, the total number of nodes N in the word-character interaction graph G]; The attention coefficient α between node i and node j in graph G in step (3-2-4) ij Normalization uses the soft max normalization function method: α ij =soft max(e(h i ,h j ))。 4. According to claim 3, the Chinese named entity recognition method based on graph attention network, It is characterized in that The feature vector k of the i-th node in the word-character interaction graph G in step (3-2-5) i is calculated using the following formula: Where N is the total number of nodes in the word-character interaction graph G, w is the learnable parameter matrix, ⊙ represents element-by-element multiplication, and k j Represents the feature vector of the jth node in the word-character interaction graph G.
5. According to claim 4, the Chinese named entity recognition method based on graph attention network, It is characterized in that Step (3-3) specifically includes the following sub-steps: (3-3-1) The final feature vector R corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-2) is decoded using CRF to obtain the labeling result corresponding to the Chinese sentence; (3-3-2) For the labeling results Y of each entity of the Chinese sentence obtained in step (3-3-1), calculate the loss function of the Chinese named entity recognition model based on the graph attention network, iteratively train the model, and obtain the trained Chinese named entity recognition model based on the graph attention network.
6. According to claim 5, the Chinese named entity recognition method based on graph attention network, It is characterized in that For the final feature vector R corresponding to each Chinese sentence, the entity annotation result of the Chinese sentence obtained after decoding is Y={y 1 ,y 2 ,…,y m }, and label the result as y m The probability P(y m ∣s m ), where y m Indicates the labeling result of the mth character in the Chinese sentence; The training process of the model in step (3-3-2) uses L2 regularization to minimize the log-likelihood loss to optimize the model. The loss function is defined as: Among them, γ is the regularization parameter of L2, preferably 0.5, and θ is the parameter of all trainable sets.
7. A Chinese named entity recognition system based on graph attention network, It is characterized in that include: The first module is used to obtain Chinese sentences to be recognized by Chinese named entities; The second module is used to construct a character vector set X corresponding to the Chinese sentence based on the Chinese sentence obtained in the first module; The third module is used to input the word vector set X corresponding to the Chinese sentence obtained in the second module into the trained Chinese named entity recognition model based on the graph attention network to obtain the Chinese named entity label corresponding to the Chinese sentence; the Chinese named entity recognition model based on the graph attention network in the third module is trained by the following steps: (3-1) obtaining a Chinese named entity recognition dataset annotated with the BIOES tagging scheme, mapping the text of each Chinese sentence in the Chinese named entity recognition dataset into a word vector, so as to obtain a word vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset; step (3-1) comprises the following steps: (3-1-1) Obtain Chinese named entity recognition datasets in multiple fields, and annotate the Chinese named entity recognition datasets using the BIOES tagging scheme to obtain annotated Chinese named entity recognition datasets; (3-1-2) Based on the annotated Chinese named entity recognition dataset obtained in step (3-1-1), construct a character vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset; (3-2) Inputting the word vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1) into the bidirectional long short-term memory BiLSTM model to obtain a preliminary feature vector of the word vector, and then inputting the preliminary feature vector of the word vector into the improved graph attention network GAT model to obtain the final feature vector corresponding to the Chinese sentence; step (3-2) specifically includes the following sub-steps: (3-2-1) For each word vector in the word vector set X corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), a BiLSTM model is used to perform preliminary modeling to obtain two different feature representations, forward and backward, and the two feature representations are concatenated to obtain a Chinese sentence feature vector corresponding to the word vector containing context features. The Chinese sentence feature vectors corresponding to the word vector set corresponding to the Chinese sentence constitute a Chinese sentence feature vector set H corresponding to the Chinese sentence = {h 1 ,h 2 ,…,h m }, where m∈[1, the total number of characters in the Chinese sentence M]; (3-2-2) Using the character vector set corresponding to each Chinese sentence in the Chinese named entity recognition dataset obtained in step (3-1), construct a word-character interaction graph G = (V, E) corresponding to the Chinese sentence; Where V is a node set, which includes all characters and self-matching words in the word vector set corresponding to the Chinese sentence; E is an edge set, which includes the connection relationship between characters in the word vector set, the inclusion relationship between characters and self-matching words, and the connection relationship between self-matching words; (3-2-3) Obtaining the word information fusion correlation coefficient matrix e corresponding to the Chinese sentence according to the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) and the word-character interaction graph G corresponding to the Chinese sentence constructed in step (3-2-2); (3-2-4) For each element e(h i ,h j ) is normalized to obtain the attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence ij ; (3-2-5) The attention coefficient α between each node in the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-4) ij , using the cardinality-preserving graph attention network calculation method to obtain the feature vector k of each node in the word-character interaction graph G corresponding to the Chinese sentence i , the feature vector k of all nodes in the word-character interaction graph G corresponding to the Chinese sentence i The feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence; (3-2-6) Perform a weighted summation of the feature vector set K corresponding to the word-character interaction graph G corresponding to the Chinese sentence obtained in step (3-2-5) and the Chinese sentence feature vector set H corresponding to the Chinese sentence obtained in step (3-2-1) to obtain the final feature vector R=W corresponding to the Chinese sentence 1 H+W 2 K, where W 1 With W 2 is a trainable matrix; (3-3) The final feature vector corresponding to the Chinese sentence obtained in step (3-2) is input into the conditional random field model for decoding to obtain the Chinese named entity annotation corresponding to the Chinese sentence. The annotation result is used to calculate the loss function of the Chinese named entity recognition model based on the graph attention network and train the parameters of the BiLSTM model and the GAT model to obtain a trained Chinese named entity recognition model based on the graph attention network, which includes the BiLSTM model and the GAT model in step (3-2) and the conditional random field model in step (3-3).
