# Domain Knowledge Graph Question Answering Based on Semantic Analysis and Data Augmentation
## 4 Question Answering System
### Semantic Parsing  
#### 4.2.1 Question Intention Classification  
We conducted a statistical analysis on the question corpus dataset and found that the question intentions in the dataset correspond to five relationships in the KG, as well as some ambiguous and unrelated expressions. Therefore, we classified the question intentions into seven categories, including the five intention categories corresponding to relationships and two special cases. Table 2 lists the seven question intention categories. Figure 4: Flowchart of QA system. In this paper, recognizing the intention of the question was considered a text classification task. We constructed the RBMA model as a classifier that parses and classifies the intention of the question. The model classifies the question process by: encoding input texts semantically using the Robustly Optimized BERT Pretraining Approach (RoBERTa) to obtain the word vector representations of each word; inputting the word vector sequence into a bidirectional long short-term memory (BiLSTM) to capture the contextual semantic information of the sentence; and then using a multi-head attention mechanism (MHA) to extract the essential information from the text [37]. Finally, the classification (CLS) vector representing the entire sentence's semantic is concatenated, and a fully connected layer maps the CLS vector to a predefined set of labels to obtain the text's classification result [38]. The model structure is shown in Figure 5, and the intention category \(intention\) is ultimately obtained through question parsing. \begin{table}
\begin{tabular}{c c} \hline \hline
**Category** & **Definition** \\ \hline Class 1 & Application method and processing time limit \\ Class 2 & Processing location \\ Class 3 & Application conditions \\ Class 4 & Required materials \\ Class 5 & Processing procedures \\ Class 6 & Intention unclear \\ Class 7 & Not related to household registration \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Question intention category and definition. Figure 5: Model structure graph. (1) RoBERTa Layer  
RoBERTa [39] is an improved version of the Bidirectional Encoder Representation from Transformers (BERT) [40] pretraining model, representing a more robust and fine-tuned version of BERT. The RoBERTa model employs a Transformer-based encoder-decoder structure to represent input text as vectors. Specifically, the model converts each input word into its corresponding word vector and feeds them into the encoder in a particular order. The encoder consists of multiple Transformer blocks, each containing multi-headed attention mechanisms and feedforward neural network layers. By iterating through these blocks, the RoBERTa model can gradually convert the input text into a fixed-dimensional vector representation, serving as the output of the model. The vector representation, \(E=\left(E_{t}^{d},E_{2}^{d},\cdots,E_{n}^{d}\right)\), of an input text query is generated by a combination of tokenization and encoding procedures. The length of the tokenized query is denoted by \(n\), while the dimensionality of individual word vectors is denoted by \(d\). The extraction of feature vectors through decoder processing, using vector \(E\), yields the output vector \(X=(X_{1},X_{2},\cdots,X_{n})\). (2) BiLSTM Layer  
The bidirectional long short-term memory network (BiLSTM) consists of a forward LSTM that processes a sequence and a backward LSTM that processes the sequence in reverse, enabling deep feature extraction of the input context. This allows for effective capture of the position relationships and semantic information between words, which better accommodates longer text sequences while retaining semantic information. Thus, a BiLSTM layer is introduced after the RoBERTa layer to extract features from the context of the input query, in order to more accurately capture global feature information of the input text statement. This compensates for the RoBERTa layer's tendency to forget contextual information.