Research and Application of the BMHA Model for Text Similarity Calculation Integrating BiLSTM and Attention Mechanism

YU Yan, CHEN De-tao, HE Wei, JI Wei-dong, NAN Shu-yin, FAN Xue-qin, ZHAO Wei

Computer & Telecommunication ›› 2026 ›› Issue (2) : 17-23.

Computer & Telecommunication ›› 2026 ›› Issue (2) : 17-23.

Research and Application of the BMHA Model for Text Similarity Calculation Integrating BiLSTM and Attention Mechanism

  • YU Yan, CHEN De-tao*, HE Wei, JI Wei-dong, NAN Shu-yin, FAN Xue-qin, ZHAO Wei
Author information +
History +

Abstract

In the C language knowledge question answering system, text similarity calculation is very important, but traditional methods, such as cosine similarity and editing distance, have problems such as inability to deeply understand semantics and difficulty in dealing with language complexity. To this end, this study proposes a C-knowledge text similarity calculation model (BMHA) that fuses bidirectional long short-term memory network (BiLSTM) and attention mechanism. The model takes advantage of the context-aware ability and attention mechanism of BiLSTM to focus on key information to dig deep into text semantics. Experimentally, on the platform built based on the TensorFlow framework, the F1 value of the BMHA model in the semantic matching task is 92.1%, which is 19.7% and 24.5% higher than that of the traditional LSTM and CNN benchmark models, respectively. It shows that its performance is excellent, which provides a new method for text similarity calculation in the field of programming education, and is expected to promote the development of related fields.

Key words

text similarity calculation / bidirectional long short-term memory network / attention mechanisms / C language knowledge question and answer system

Cite this article

Download Citations
YU Yan, CHEN De-tao, HE Wei, JI Wei-dong, NAN Shu-yin, FAN Xue-qin, ZHAO Wei. Research and Application of the BMHA Model for Text Similarity Calculation Integrating BiLSTM and Attention Mechanism[J]. Computer & Telecommunication. 2026(2): 17-23

References

[1] Liu Y,Han T,Ma S,et al.Summary of ChatGPT-Related Research and Perspective towards the Future of Large Language Models[J].Meta-Radiology,2023,1(2):100017.
[2] Angioni S,Salatino A,Osborne F,et al.AIDA:A Knowledge Graph about Research Dynamics in Academia and Industry[J].Quantitative Science Studies,2021,2(4):1356-1398.
[3] Zhou Y,Li C,Huang G.A Short-Text Similarity Model Combining Semantic and Syntactic Information[J].Electronics,2023,12(14):3126.
[4] 唐进君,庹昊南,刘佑,等.基于BERT-Bi-LSTM-CRF模型的自主式交通系统参与主体识别方法[J].交通信息与安全,2022,40(5):80-90.
[5] Sowa J F.Principles of Semantic Networks:Explorations in the Representation of Knowledge[M].San Mateo,Calif. Morgan Kaufmann,1991.
[6] Bollacker K,Evans C,Paritosh P,et al.Freebase:A Collaboratively Created Graph Database for Structuring Human Knowledge[C]//Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data.ACM,2008:1247-1250.
[7] Auer S,Bizer C,Kobilarov G,et al.DBpedia:A Nucleus for a Web of Open Data[C]//The Semantic Web.Berlin,Heidelberg:Springer,2007:722-735.
[8] Wu X,Duan J,Pan Y,et al.Medical Knowledge Graph:Data Sources,Construction,Reasoning,and Applications[J].Big Data Mining and Analytics,2023,6(2):201-217.
[9] 张焕丽. 基于BiLSTM和注意力机制的中文医疗问答研究[D].重庆:重庆理工大学,2023.
[10] 伍树书. 基于BiLSTM和注意力机制的短文本相似度算法研究[D].武汉:武汉科技大学,2021.
[11] Abu-Salih B,Alotaibi S.A Systematic Literature Review of Knowledge Graph Construction and Application in Education[J].Heliyon,2024,10(3):e25383.
[12] 步一,薛睿,孟凡,等.知识图谱的关键技术及其在情报学中的应用[J].情报学进展,2022,14(00):349-384.
[13] 文瀚冬. 基于提示学习的实体关系联合抽取和COVID19领域问答系统构建研究[D].广州:广东技术师范大学,2023.
[14] Wambsganss T,Janson A,Söllner M,et al.Improving Students’Argumentation Skills Using Dynamic Machine-Learning-Based Modeling[J].Information Systems Research,2024,36(1):474-507.
[15] Zhang Q,Zhang L,Qin C,et al.A Survey on Knowledge Graph-Based Recommender Systems[J].Scientia Sinica Informationis,2020,50(7):937-956.
[16] Wang J,Dong Y.Measurement of Text Similarity:A Survey[J].Information,2020,11(9):421.
[17] Chu S C,Xue X,Pan J,et al.Optimizing Ontology Alignment in Vector Space[J].Journal of Internet Technology,2020,21:15-22.
[18] Yao H,Tang X,Wei H,et al.Revisiting Spatial-Temporal Similarity:A Deep Learning Framework for Traffic Prediction[J].Proceedings of the AAAI Conference on Artificial Intelligence,2019,33(1):5668-5675.
[19] P S,Shaji A P.A Survey on Semantic Similarity[C]//2019 International Conference on Advances in Computing,Communication and Control (ICAC3).IEEE,2020:1-8.
[20] Kenter T,Borisov A,de Rijke M.Siamese CBOW:Optimizing Word Embeddings for Sentence Representations[EB/OL].2016:arXiv:1606.04640. https://arxiv.org/abs/1606.04640.

Accesses

Citation

Detail

Sections
Recommended

/