# A Local Information Perception Enhancement-Based Method for Chinese NER
## 3 Approach
### Encoder Layer
#### 3.1.2 GAT Layer  
We first build the required graph. The GAT layer analyzes the correlations among matching words and their adjacent characters and adjacent matching words. Thus, each character and its matching word serve as the graph's vertex, represented as\(G_{\rm h}=\left[x_{1}^{c},x_{2}^{c},\ldots x_{m}^{c},x_{1}^{w},x_{2}^{w},\ldots,x_ {m}^{w}\right]\), where \(n\) and \(m\) denote the count of characters and matching words, respectively. The adjacency matrix is shown in Figure 7. If matching word \(i\) or character \(v\) is associated with adjacent pre- and postmatching words of character \(j\), the correspondence of \((i,j)\) or \((v,j)\) of the corresponding position of the adjacency matrix \(M\) is then filled with \(1\). Similarly, if matching word \(i\) and another word \(k\) are adjacent pre- and postmatching words, sign \"\(M_{ik}=1\)\". Since this adjacency matrix is symmetric, only its upper triangular region is stored to achieve compressed storage.  
We take the node features \(GF=\{f_{1},f_{2},\ldots,f_{N}\}\) and the adjacency matrix \(M\) feed into the GAT layer. \(\mathsf{f}_{i}\in\mathbb{R}^{F}\), \(M\in\mathbb{R}^{N\times N}\), where \(F\) and \(N\) are the characteristic dimension and number of nodes, respectively. Then a new set of node characteristics can be obtained, that is,  
\[GF^{{}^{\prime}}=\left\{f_{1}^{{}^{\prime}},f_{2}^{{}^{\prime}},\ldots,f_{N}^{ {}^{\prime}}\right\} \tag{10}\]  
The following output feature representation is obtained using K-independent attention mechanisms:  
\[\mathsf{f}_{i}^{{}^{\prime}}=\left|\sum\limits_{K=1}^{K}\sigma\left(\sum \limits_{j\in N_{i}}\alpha_{ij}^{k}W^{k}f_{j}\right)\right. \tag{11}\]  
\[\alpha_{ij}^{k}=\frac{\exp\left(LeakyReLU\left(a^{T}\left[W^{k}f_{i}||W^{k}f_{ j}\right]\right)\right)}{\sum\
olimits_{k\in N_{i}}\exp\left(LeakyReLU\left(a^{T}\left[W^{k}f_{i}||W^{k}f_{ k}\right]\right)\right)} \tag{12}\]  
where \(||\) indicates a connection operation, \(\sigma\) is the nonlinear activation function, \(N_{i}\) in the network is the node next to node \(i\), \(\alpha_{ij}^{k}\) is an attention factor, and \(W^{k}\in\mathbb{R}^{F^{{}^{\prime}}\times F}\), \(a\in\mathbb{R}^{2F^{{}^{\prime}}}\) is a single-layer feedforward neural network. At this layer, the output dimension of \(f_{i}\) is \(KF^{{}^{\prime}}\). The averaging operation obtains the final output feature \(F^{{}^{\prime}}\) in the last layer.  
Through the computations on the \(i\)-th vertex and its associated vertices, we can achieve the terminal representation for the \(i\)-th vertex. The corresponding coefficients calculated according to the attention mechanism are  
\[\mathsf{f}_{i}^{final}=\sigma\left(\frac{1}{K}\sum\limits_{k=1}^{K}\sum \limits_{j\in N_{i}}\alpha_{ij}^{k}W^{k}f_{j}\right) \tag{13}\]  
Figure 7: Optimal storage is used to hold the adjacency matrix, which depicts the connections between graph nodes: (**a**) original adjacency matrix and (**b**) optimized adjacency matrix.  
GAT's inputs are the vertex set \(G_{\text{h}}\) and the adjacency matrix \(M\), then the characteristics of the node can be obtained:  
\[G=GAT(G_{\text{h}},M),G\in\mathbb{R}^{F^{\prime}\times(n+m)} \tag{14}\]  
\[G^{{}^{\prime}}=G[:,0,n] \tag{15}\]  
Here, we retain the top \(n\) columns of these matrices since only the character representation serves to decode the labels. It is shown in Equation (15). Here is a new sentence representation that integrates semantic knowledge between characters and their adjacent character-matching words.