## 3 Materials and Methods
### Named Entity Recognition  
Named entity recognition mainly depends on the context in which the entity is located. Because of different contextual information, words with the same letter have different meanings. Therefore, in addition to introducing explicit semantic information to the word vector representation, we design a novel entity representation algorithm based on Bi-LSTM and Maxpooling.  
The entity representation algorithm has two advantages: (1) It enhances the implicit semantics of text sequences and the association between entities and contexts. (2) The algorithm mainly encodes the implicit semantics information of the entity. Except for entities, the rest of the vector representations are not shared between NER and RE. Entities and local contexts are encoded separately to extract richer context implicit features.  
Compared with the ordinary recurrent neural network, Bi-LSTM alleviates the problems of gradient vanishing and gradient exploding to a certain extent. Compared with LSTM, Bi-LSTM has the characteristics of capturing bidirectional sequence information.  
First, the word vector sequence \(\mathbf{X}^{w}\) is passed into Bi-LSTM to build the dependencies between entities and contexts. The Bi-LSTM responsible for obtaining the implicit semantic information of the entity is denoted as \(\text{Bi}-\text{LSTM}_{e}\).  
\[\mathbf{X}^{t}=\text{Bi}-\text{LSTM}_{e}(\mathbf{X}^{w}) \tag{7}\]  
Considering the identification of overlapping entities, we adopt the span-based method to construct candidate entity representations. The word vector representation from \(\mathbf{X}^{t}=(\mathbf{x}_{1}^{t},\mathbf{x}_{2}^{t},\ldots,\mathbf{x}_{i}^{t},\ldots,\mathbf{x}_ {n}^{t})\) is selected as the candidate entity representation according to any length. A candidate entity vector of length \(f\) represents:  
\[\mathbf{E}^{t}=(\mathbf{x}_{i}^{t},\mathbf{x}_{i+1}^{t},\mathbf{x}_{i+2}^{t},\ldots,\mathbf{x}_{i+ f-1}^{t}) \tag{8}\]  
Then, we use Maxpooling to obtain the aggregated entity representation:  
\[\mathbf{e}^{t}=\text{Maxpooling}(\mathbf{E}^{t}) \tag{9}\]  
Similar to SpERT, we take the length of candidate entity sequences as one of the features affecting entity classification. The entity length representation is searched from the entity length representation matrix according to different lengths. At the same time, the global representation vector CLS obtained by BERT contains rich contextual information, so CLS is also one of the influencing factors of candidate entity classification.  
Finally, the candidate entity representation is represented by the aggregation of three parts, which are the entity representation vector, the candidate entity sequence length representation vector, and the global semantic vector CLS.  
\[\mathbf{y}^{e}=\text{Softmax}(\mathbf{W}_{3}[\mathbf{e}^{t};\mathbf{w}_{f}^{mt};\mathbf{c}]+\mathbf{ b}_{3}) \tag{10}\]where \(\mathbf{e^{t}}\) is entity representation vector, \(\mathbf{w}_{f}^{ent}\) is a representation vector of sequence length \(f\), \(\mathbf{c}\) is the global semantic vector CLS, \(\mathbf{W}_{3}\) and \(\mathbf{b}_{3}\) are trainable parameter vectors, Softmax is the classification function.