# Forward-Looking Element Recognition Based on the LSTM-CRF Model with the Integrity Algorithm
## 3 LSTM-CRF Model with the Integrity Algorithm
### Integrity Algorithm
#### 3.3.3 Algorithm
\begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{1}{c}{**Rule\({}_{\text{id}}\)**} & **Description** & **Output** \\ \hline R1\({}_{1}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S}{\rightarrow}W_{j}\) s.t. \(W_{j}{\in}\)[context (\(W_{i}\))], DS = VOB, \\ POS (\(W_{i}\), \(W_{j}\)) = {(v, v), (v, m), (v, n)} \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{i}\) -\(W_{j}\)) \\ \end{tabular} \\ \hline R1\({}_{2}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S}{\rightarrow}W_{j}\) s.t. \(W_{j}{\in}\)[context (\(W_{i}\))], DS = ADV, \\ POS (\(W_{j}\), \(W_{i}\)) = {(d, v), (a, v), (d, v), (d, a)} \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{j}\) -\(W_{i}\)) \\ \end{tabular} \\ \hline R1\({}_{3}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S}{\rightarrow}W_{j}\) s.t. \(W_{j}{\in}\)[context (\(W_{i}\))], DS = ATT, \\ POS (\(W_{i}\), \(W_{j}\)) = {(a, n), (m, q), (m, m), (b, n)} \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{i}\) -\(W_{j}\)) \\ \end{tabular} \\ \hline R2\({}_{1}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S1}{\rightarrow}W_{j}{\rightarrow}D_{S2}{\rightarrow}W_{k}\) s.t. \(W_{j}\), \(W_{k}{\in}\)[context (\(W_{i}\))], \\ DS1 = VOB, DS2 = ADV, POS (\(W_{i}\), \(W_{k}\), \(W_{j}\)) = (v, d, v) \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{i}\)–\(W_{k}\)–\(W_{j}\)) \\ \end{tabular} \\ \hline R2\({}_{2}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S1}{\rightarrow}W_{j}\) and \(W_{j}{\rightarrow}D_{S2}{\rightarrow}W_{k}\) s.t. \(W_{j}\), \(W_{k}{\in}\)[context (\(W_{i}\))], \\ DS1 = VOB, DS2 = RAD, POS (\(W_{i}\), \(W_{j}\), \(W_{k}\)) = (v, m, m) \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{i}\)–\(W_{j}\) –\(W_{k}\)) \\ \end{tabular} \\ \hline R2\({}_{3}\) & \begin{tabular}{c} \(W_{i}{\rightarrow}D_{S1}{\rightarrow}W_{j}\) and \(W_{j}{\rightarrow}D_{S2}{\rightarrow}W_{k}\) s.t. \(W_{j}\), \(W_{k}{\in}\)[context (\(W_{i}\))], \\ DS1 = VOB, DS2 = ATT, POS (\(W_{i}\), \(W_{k}\), \(W_{j}\)) = (v, b, n) \\ \end{tabular} & \begin{tabular}{c} Con (\(W_{i}\) -\(W_{k}\) –\(W_{j}\)) \\ \end{tabular} \\ \hline R2\({}_{4}\) & \
\begin{tabular}{c} \(W_{i}{\rightarrow}D_{S1}{\rightarrow}W_{j}\) and \(W_{i}{\rightarrow}D_{S2}{\rightarrow}W_{k}\) s.t. \(W_{j}\),\(W_{k}{\in}\)[context (\(W_{i}\))], \\ DS1 = ADV, DS2 = CMP, POS (\(W_{j}\), \(W_{i}\), \(W_{k}\)) = (d, v, a) \\ \end{tabular} &
\begin{tabular}{c} Con (\(W_{j}\) -\(W_{i}\) –\(W_{k}\)) \\ \end{tabular} \\ \hline \hline \end{tabular}
\end{table} 
Table 3: POS syntactic rules based on the contextual rules of attributes. The main idea of the algorithm is to utilize the tags generated by the POS syntactic rules to correct the tags generated by the LSTM-CRF model. The algorithm can be divided into three steps. First, \(\mathbf{R}_{\text{tag}}\) is traversed to find B-Attr, the current position is set as the superscript, and look for the subscript is obtained from the current label position [\(\mathbf{R}_{\text{tag\_begin}}\): \(\mathbf{R}_{\text{tag\_end}}\)]. Second, \(\mathbf{L}\mathbf{S}_{\text{tag}}\) [\(\mathbf{R}_{\text{tag\_begin}}\): \(\mathbf{R}_{\text{tag\_end}}\)] is traversed to determine whether the label of the interval only includes O and the label; if it does, then \(\mathbf{L}\mathbf{S}_{\text{tag}}\) is covered with \(\mathbf{R}_{\text{tag}}\) in the interval, and otherwise, it will not be replaced. Third, the next set of annotations after \(\mathbf{R}_{\text{tag\_end}}\) is searched until \(\mathbf{R}_{\text{tag}}\) is traversed. By correcting the recognition strategy, the integrity of the elements will be guaranteed as much as possible. The LSTM-CRF model with integrity algorithm is shown in Algorithm 1.