## 5 Results and Discussion
### Semantic-Matching Models  
The assessment metrics for this experiment were relevance and precision. We used a pre-trained RoBERTa-based model to generate embeddings for template questions and for each answer. For the template question (Text1) and answers (Text2...n) in the dataset, corresponding vector representations v1 and v1..n were generated. The relevance between these vectors was measured by calculating the Manhattan Distance, Euclidean Distance, and Cosine Similarity between them. The formulas for these calculations are as follows: (4)-(6), where \(P\) and \(Q\) represent two points and \(p_{i}\) and \(q_{i}\) are their coordinates on the ith dimension. Manhattan Distance sums the absolute differences in each dimension, reflecting the cumulative difference between two points; the larger the value, the greater the difference. Euclidean Distance calculates the \"straight-line\" distance between two points, representing the spatial distance; the larger the value, the further apart the points. Cosine Similarity calculates the angle between vectors, with a larger value indicating greater similarity. \[D_{\text{manhattan}}(P,Q)=\sum_{i=1}^{n}|p_{i}-q_{i}| \tag{4}\]  
\[D_{\text{euclidean}}(P,Q)=\sqrt{\sum_{i=1}^{n}{(p_{i}-q_{i})^{2}}} \tag{5}\]  
\[\text{Cosine}(\overrightarrow{v_{1}},\overrightarrow{v_{2}})=\frac{ \overrightarrow{v_{1}}\cdot\overrightarrow{v_{2}}}{\parallel \overrightarrow{v_{1}}\parallel\times\parallel\overrightarrow{v_{2}}\parallel} \tag{6}\]  
Precision is the ratio of correctly retrieved relevant Q&A pairs (\(U1\)) to all retrieved Q&A pairs (\(U2\)). A Q&A pair is defined as correctly retrieved if its cosine similarity with the template question is greater than 0.85, calculated using Formula (7):  
\[\text{Accuracy}(U1,U2)=\frac{U1}{U2} \tag{7}\]  
The candidate data obtained from the keyword-weight-matching step are further processed using the semantic-matching model, significantly enhancing the precision and quality of answers. For instance, with the template question \"[Gender: female, age: 24], suffering from [depression] with symptoms of [insomnia, low spirits, loss of appetite, motor inhibition], what treatment should be taken? What medication? Any suggestions?\",  
Figure 11: Weight-matching score. we conducted comparative experiments on several advanced models with 15 different template questions and their corresponding candidate answer datasets. The average results are presented in Table 5.  
Figures 12-14 illustrate the line graphs showing the scores of various models across 15 sets of data for different metrics. From Figure 14, it is clear that RoBERTa's cosine similarity score (0.88) is the closest to XLNet's (0.87), and both significantly outperform BERT (0.84) and ALBERT (0.73). Figures 12 and 13 show that RoBERTa maintains lower scores for Manhattan distance (52) and Euclidean distance (4.62), while XLNet's scores for Manhattan distance (767) and Euclidean distance (69.72) remain extremely high. Based on these analyses, we conclude that RoBERTa outperforms the other models in terms of both vector similarity and spatial distance when processing our dataset, demonstrating its superior performance. This further indicates that RoBERTa exhibits higher precision and robustness in capturing semantic similarity. Specifically, RoBERTa's deeper pre-training and more optimized training strategies enable it to better understand and represent complex medical question-answer pairs, leading to higher relevance and accuracy in semantic-matching tasks. Furthermore, the method employed in this study, which incorporates a keyword-weight-matching algorithm, not only significantly reduces computational costs compared to previous semantic retrieval models but also enhances the focus and accuracy of the matching process. This strategy prioritizes highly relevant question-answer pairs during the initial candidate data screening, providing more precise input for subsequent semantic matching. This is one of the key reasons behind the superior overall performance of our approach.