# OEQA: Knowledge- and Intention-Driven Intelligent Ocean Engineering Question-Answering Framework
## 3 The Method of OEQA
### Answer Recommendation Based on Intent Recognition
#### 3.4.1 Intent Recognition  
The efficacy of answer recommendation depends on its ability to cater to the requirements and goals of users. We adopt a user-centric approach by discerning the inquiry intentions of users and subsequently seeking answers that match the intentions.  
Intent recognition is commonly regarded as a text classification task [29]. UIUC [30] is a widely used standard for question classification, which classifies questions into six categories and fifty subcategories based on the answer types. Building on UIUC and concerning real user QA scenarios in the ocean engineering field, we predefine 11 user intention types, including Project-Overview, Project-Location, Project-Zonghai, SeaUse-Location, SeaUse-Type, SeaUse-Mode, ConfirmRight-Way, UseRight-Holder, SeaUse-Nature, SeaArea-Class, and SeaUse-Area, based on the ocean engineering knowledge graph.  
We implement the BERT-TextCNN model to identify the user intentions and guide subsequent answer recommendations. As illustrated in Figure 6, the user question is input into the BERT layer to represent each token in the text as a vector. The vectors are then fed into TextCNN [31], which comprises a convolutional layer, a pooling layer, and a fully connecting layer. Ultimately, the model outputs the intent category to which the user's question belongs.  
We obtain the semantic vector representation of the question through BERT. Given a question \(q\) with length \(L\), for \(i=1,2,3,\ldots,L\), each token in \(q\) is represented by \(x_{i}\). We represent the question \(q\) as a sequence \(q^{\prime}=[CLS],x_{1},x_{2},x_{3},\ldots,x_{i},[SEP],x_{i+1},\ldots,x_{L},[ SEP]\), which is input to BERT. Based on this, we obtain the final output of the last hidden layer of BERT(\(H\)), where \(h_{i}\in\mathbb{R}^{1\times k}\) is a \(k\)-dimension vector and \(H=(h_{1},h_{2},h_{3},\ldots,h_{L})\),  
\[H=BERT(q^{\prime}) \tag{13}\]  
We concatenate \(j\) hidden states \(h_{i},h_{i+1},h_{i+2},\ldots,h_{i+j-1}\) and represent them with \(h_{i:i+j}\). For \(t=1,2,3,\ldots,m\), a \(filter_{t}\in\mathbb{R}^{j\times k}\) is used to convolve with a window of \(j\) hidden states. Here, \(b\) is a bias term and \(f\) is an activation function. A feature \(v_{t}^{j}\) is generated from a window of \(h_{i:i+j-1}\) by:  
\[v_{t}^{j}=f(filter_{t}\cdot h_{i:i+j-1}+b) \tag{14}\]  
To learn the relation and characteristics between the context of different dimensions in the question, this filter is applied to each possible window of hidden states \(\{h_{1:j},h_{2:j+1},h_{3:j+2},\ldots,h_{L-j+1:L}\}\) to produce a feature map:  
\[V_{t}=[v_{1}^{1},v_{t}^{2},v_{t}^{3},\ldots,v_{t}^{L-j+1}] \tag{15}\]  
Figure 6: BERT-TextCNN-based intent recognition model.  
where \(V_{t}\in\mathbb{R}^{L-j+1}\). For each feature map, we capture the maximum value as the most obvious feature locally by applying a max-pooling operation. For \(t=1,2,3,\ldots,m\),  
\[c_{t}=\max(V_{t}) \tag{16}\]  
\[C=[c_{1},c_{2},c_{3},\ldots,c_{m}] \tag{17}\]  
Finally, we implement the classification through an MLP layer.