在C语言知识问答系统中,文本相似度计算至关重要,但传统方法(如余弦相似度和编辑距离)存在无法深入理解语义、难以处理语言复杂性等问题。为此,本研究提出融合双向长短时记忆网络(BiLSTM)与注意力机制的C知识文本相似度计算模型(BMHA)。该模型利用BiLSTM的上下文感知能力和注意力机制聚焦关键信息的优势,深入挖掘文本语义。经实验,在基于TensorFlow框架搭建的平台上,以C语言问答社区真实语料为数据集,BMHA模型在语义匹配任务中F1值达92.1%,较传统LSTM和CNN基准模型分别提升19.7%与24.5%。这表明其性能优异,为编程教育领域文本相似度计算提供了新方法,有望推动相关领域发展。
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.
关键词
文本相似度计算 /
双向长短时记忆网络 /
注意力机制 /
C语言知识问答系统
Key words
text similarity calculation /
bidirectional long short-term memory network /
attention mechanisms /
C language knowledge question and answer system
{{custom_sec.title}}
{{custom_sec.title}}
{{custom_sec.content}}
参考文献
[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.
基金
黑龙江省高等教育教学改革研究项目,项目名称:“教材、资源、方法”游戏化智慧课程的立体资源建设与研究; 哈尔滨师范大学教育教学改革项目,项目编号:XJGZ202501; 黑龙江省线上线下混合式一流课程(高级语言程序设计)