# Joint Extraction of Entities and Relations Based on Enhanced Span and Gate Mechanism
## 1 Introduction
While the span-based Transformer model successfully addresses nested entity and relation overlap issues, it may encounter entity redundancy during the relation classification process. These studies demonstrate the efforts made to address relation overlap and nested entity challenges in entity and relation extraction. Each approach tackles specific aspects of the problem and contributes to advancing the field of relation extraction. Despite the significant progress made in entity and relation extraction with the aforementioned methods, there are several areas that require improvement. The challenge of accurately extracting the subject arises from the complexity of sentence structures, semantic diversity, and contextual ambiguity. Traditional rules-based or pattern-matching methods have limitations when faced with these challenges. With the rapid advancement of deep learning, neural network-based approaches have achieved notable performance improvements in entity and relation extraction tasks. However, current deep learning methods have limitations in subject extraction. This becomes particularly challenging in complex sentence  
Figure 1: Examples of normal, SEO, EPO, and nested entities. structures, long-distance dependencies, and sentences with nested structures. Accurately extracting the subject is crucial for the successful execution of entity and relation extraction tasks and the reliability of downstream applications. Additionally, relation extraction encounters the issue of class imbalance. Many entity pairs in the extraction do not form valid relations, resulting in a vast quantity of negative samples. Moreover, the classifier may become confused when an entity is associated with multiple relations, further affecting the accurate extraction of relations. In scenarios where there is an insufficient volume of training data, the model's ability to extract complete and precise triplets may be compromised. Consequently, our research is dedicated to enhancing subject extraction accuracy, thereby improving the overall quality and reliability of both entity and relation extraction processes. In addition, this paper focuses on modeling relations and mitigating the impact of class imbalance in relation extraction. This study presents an innovative joint extraction model called \"Joint Extraction of Entities and Relations based on Enhanced Span and Gate Mechanism\" (ESGM), which treats relations as a function mapping from subject to object and utilizes a pointer network labeler for the extraction of entities and relations. The model we propose utilizes the pretrained BERT language model as the encoder for sentence encoding, enabling it to capture informative representations. For each relation, the model constructs a function that serves as the condition for mapping from subjects to objects. To address nested entities and improve entity extraction accuracy, the model adopts a span-based approach for entity extraction. Unlike traditional fragment-based methods in relation extraction, this model integrates the span selection technique from Machine Reading Comprehension [10] (MRC). This paper predicts the start and end positions of spans using two binary classifiers and proposes a one-to-many matching strategy to form spans by matching predicted start and end positions. A classifier model is utilized to determine whether a span represents a subject. Before matching the object, a gate mechanism is designed to fuse the features of the subject with the sentence encoding vector. This improves the model's capacity to capture information and dependencies between subjects and objects throughout the extraction process. Ultimately, using the relation function mapping, the model sequentially pairs each subject with its respective object. This model mainly consists of five modules: a BERT encoding module, span extraction module, subject extraction prediction module, subject feature and sentence vector fusion module, and object relation extraction prediction module.