# An Open Relation Extraction System for Web Text Information
## 3 Methodology
### Few-Shot Relation Extraction Learning Framework  
As shown in Figure 3, ORES includes three parts: a data mining component, an open relation extraction component, and a real-time data management component. The data mining component is used to mine instances from Web text with the same relation as the seed set. The open relation extraction component trains a classifier based on few-shot learning to predict a new relation, r. It is a real-time data management component that stores and manages the output of new relational data. The working process of ORES is multiple iterations, and each iteration has two stages:  
* Phase 1 (a) Add sentences in the initial seed set to the coarse selection set. As shown in Figure 4: it put \"[PERSON] founded the theory of relativity\" into the coarse selection set from the seed set. (b) Using distant supervision, mine sentence pairs from Web text and add them to the coarse selection set and the selection set. At first, perform named-entity recognition, and extract the head and tail entities from the initial seed sentence X as entity pair \(\delta\). \[\delta=\{(e_{h},e_{t})|Ent(X)=(e_{h},e_{t}),X\in S_{i}\}\] (5)  
\(S_{i}\) is the initial seed set, \(Ent\) is the entity pair matching function, and \(X\) is the sentence in the initial seed set. Then mine all sentences containing entity pair \(\gamma\) in the Web text denoted as \(X^{\prime}\). \[Cs=\{(X^{\prime}|Ent(X^{\prime})\in\delta,X^{\prime}\in W_{t}\} \tag{6}\]  
\(Cs\) is a rough selection, and \(Wt\) is a Web text library. (c) Load sentences in the coarse selection set into instance selector 1. The tBERT encoder in instance selector 1 outputs the representation vectors of the embedding features of the sentence pair, denoted as em. The instance selector 1 through the Siamese network calculates the similarity of the two sentences and scores them. The similarity distance function is:  
\[S(X,Y)=\sigma(W_{s}^{T}(e_{m}(X)-e_{m}(Y))^{2}+b_{s}) \tag{7}\]  
where \(W_{s}^{T}\) and \(b_{s}\) are learnable parameters. (d) After the instance selector 1 filters out sentences that meet the threshold, add them to selection 1 and the seed set. The instance selector 1 and instance selector 2 are denoted as \(f\), and the threshold is set to 0.5, marked as \(\alpha\). Selection 1 is denoted as 51:  
\[S_{1}=\{X|f(X)>\alpha,X\in W_{t}\} \tag{8}\]  
where \(W_{t}\) represents Web text. (e) Train a relation classifier with a small amount of labeled data and instances in selection 1 as input to identify sentences with a new relation r.
* Phase 2 (a) Classifier g mines sentences in Web text that may belong to relation r. The confidence region \(\theta\) of g is set to 0.9. When the input instance meets the threshold condition, it is filtered out and added to the selection set. \[S_{s}=\{X|g(X)>\theta,X\in R^{r}\}\] (9)  
\(S_{s}\) is the sentence selection set. \(R^{r}\) is the large-scale annotated relation set. (b) Filter the selection set again to enhance the performance of the classifier. Then, load the sentences in the selection set to the instance selector 2. (c) After sentences are loaded into the coarse selection set, one iteration is complete. To further improve the accuracy, the instance selector 2 adopts the K-BERT encoder. K-BERT is a language model that can inject external knowledge. At the end of the first stage, the relation classifier can extract a new relation r. When mining new relational sentences based on relation r, entity pairs can change. As shown in Figure 3, when the classifier learns the new relation \"of_founder\", the sentence pair is matched: \"[PERSON] established the classical mechanics system\" and \"[PERSON] invented the alternating current system\". The first instance reflects the founder relationship. The second reflects the new relationship inventor. As shown in Figure 4, such instances, called query instances, will be expanded to the rough selection set in subsequent iterations. Query instances and seed sentences will perform similarity detection.