基于SBERT模型的代码片段推荐  

Code snippets recommendation based on SBERT model

在线阅读下载全文

作  者:邓斯元 魏乐 舒红平 Deng Siyuan;Wei Le;Shu Hongping(School of Software Engineering,Chengdu University of Information Technology,Chengdu 610225,China;Automatic Software Generation&Intelligence Service Key Laboratory of Sichuan Province,Chengdu 610225,China)

机构地区:[1]成都信息工程大学软件工程学院,成都610225 [2]软件自动生成与智能服务四川省重点实验室,成都610225

出  处:《计算机应用研究》2022年第12期3730-3735,共6页Application Research of Computers

基  金:四川省重点研发资助项目(2020YFG0299)。

摘  要:在当前的软件开发环境中,海量的低质量、无意义的代码知识为开发人员进行代码复用造成了阻碍,大大降低了软件开发效率。为了快速准确地为开发人员推荐高质量的代码知识,提出了基于SBERT(sentence-BERT)模型的代码片段推荐方法CSRSB(code snippets recommendation based on sentence-BERT)。该方法首先获取海量的高质量数据来构建代码语料库,并基于深度学习模型SBERT为代码片段对应的自然语言描述和用户输入的自然语言查询生成具有丰富语义的句向量,通过比较点积相似度来实现代码片段的推荐。使用命中率、平均倒数排名和平均准确率这三个常用推荐评估指标与现有相关研究中的方法进行对比来验证该方法的有效性。实验结果表明,CSRSB在有效提高代码片段推荐准确度的同时也能够做到快速推荐。In the current software development environment,a large amount of low-quality and meaningless code knowledge hinders developers from code reuse,which greatly reduces the efficiency of software empolder.In order to quickly and accurately recommend high-quality code knowledge for developers,this paper proposed a code snippets recommendation method CSRSB based on SBERT model.Firstly,the method obtained massive high-quality data to build a code corpus.It also generated sentence vectors with rich semantics for the natural language description corresponding to the code snippets and the natural language query input by the user based on the deep learning model SBERT.Then,it implemented code snippets recommendations by comparing the dot product similarity.It verified the effectiveness of the method by comparing the three commonly used re-commendation evaluation metrics,hit ratio,mean reciprocal rank and mean average precision,with the methods in existing related research.The experimental results show that CSRSB can effectively improve the accuracy of code snippets recommendation and achieve fast recommendations.

关 键 词:代码复用 代码语料库 深度学习 代码片段推荐 

分 类 号:TP391[自动化与计算机技术—计算机应用技术]

 

参考文献:

正在载入数据...

 

二级参考文献:

正在载入数据...

 

耦合文献:

正在载入数据...

 

引证文献:

正在载入数据...

 

二级引证文献:

正在载入数据...

 

同被引文献:

正在载入数据...

 

相关期刊文献:

正在载入数据...

相关的主题
相关的作者对象
相关的机构对象