| 本文已被:浏览 2634次 下载 7358次 |
 码上扫一扫! |
|
|
| 编程现场上下文深度感知的代码行推荐 |
|
陶传奇1,2,3, 包盼盼1, 黄志球1,2, 周宇1,2, 张智轶1,2
|
|
1.南京航空航天大学 计算机科学与技术学院, 江苏 南京 211106;2.高安全系统的软件开发与验证技术工信部重点实验室(南京航空航天大学), 江苏 南京 211106;3.计算机软件新技术国家重点实验室(南京大学), 江苏 南京 210023
|
|
| 摘要: |
| 在软件开发的编程现场,有大量与当前开发任务相关的信息,比如代码上下文信息、用户开发意图等.如果能够根据已有的编程现场上下文给开发人员推荐当前代码行,不仅能够帮助开发人员更好地完成开发任务,还能提高软件开发的效率.而已有的一些方法通常是进行代码修复或者补全,又或者只是基于关键词匹配的搜索方法,很难达到推荐完整代码行的要求.针对上述问题,一种可行的解决方案是基于已有的海量源码数据,利用深度学习析取代码行的相关上下文因子,挖掘隐含的上下文信息,为精准推荐提供基础.因此,提出了一种基于深度学习的编程现场上下文深度感知的代码行推荐方法,能够在已有的大规模代码数据集中学习上下文之间潜在的关联关系,利用编程现场已有的源码数据和任务数据得到当前可能的代码行,并推荐Top-N给编程人员.代码行深度感知使用RNN Encoder-Decoder,该框架能够将编程现场已有的若干行上文代码行进行编码,得到一个包含已有代码行上下文信息的向量,然后根据该向量进行解码,得到预测的Top-N代码行输出.利用在开源平台上收集的大规模代码行数据集,对方法进行实验并测试,结果显示,该方法能够根据已有的上下文推荐相关的代码行给开发人员,Top-10的推荐准确率有60%左右,并且MRR值在0.3左右,表示用户满意的推荐项排在N个推荐结果中比较靠前的位置. |
| 关键词: 编程现场 代码上下文 代码行 深度学习 RNN Encoder-Decoder |
| DOI:10.13328/j.cnki.jos.006059 |
| 分类号:TP311 |
| 基金项目:国家重点研发计划(2018YFB1003900);国家自然科学基金(61602267,61402229);计算机软件新技术国家重点实验室基金(KFKT2018B19) |
|
| Code Line Recommendation Based on Deep Context-awareness of Onsite Programming |
|
TAO Chuan-Qi1,2,3, BAO Pan-Pan1, HUANG Zhi-Qiu1,2, ZHOU Yu1,2, ZHANG Zhi-Yi1,2
|
|
1.College of Computer Science and Technology, Nanjing University of Aeronautics and Astronautics, Nanjing 211106, China;2.Key Laboratory for Safety-critical Software Development and Verification (Nanjing University of Aeronautics and Astronautics), Ministry of Industry and Information Technology, Nanjing 211106, China;3.State Key Laboratory for Novel Software Technology (Nanjing University), Nanjing 210023, China
|
| Abstract: |
| In the Onsite Programming of software development, there are a lot of information related to the current development task, such as code line context information, user development intention, etc. If the next code line or lines can be recommended to program developers according to the existing code lines, then it will not only help the developer to complete the development task better, but also improve the efficiency of software development. However, most existing approaches only focus on code repair or completion, which seldom considers how to meet the demand of recommending code lines based on contextual information. To solve this problem, a feasible solution is using deep learning methods to extract the relevant context factors of code lines through mining hidden context information based on the existing massive source data. Therefore, this study proposes a novel approach based on deep learning for onsite programming. In this approach, the contextual relationships among various code lines are learned from existing large-scale code data sets and then Top-N code lines are recommended to programmers. The approach utilizes the RNN encoder-decoder framework, which can encode several lines of code to a vector with context-aware information, and then obtain the Top-N new code lines based on the context vector. Finally, the approach is empirically evaluated with a large-scale code line data set collected from the open source platform. The study results show that the proposed approach can recommend the relevant code lines to developers according to the existing context, and the accuracy value is approaching to 60%. In addition, the MRR value is about 0.3, indicating that the recommended items are ranked in the top of the N recommended results. |
| Key words: onsite programming source code context code line deep learning RNN Encoder-Decoder |