计算机工程 ›› 2020, Vol. 46 ›› Issue (1): 196-200,207.doi: 10.19678/j.issn.1000-3428.0053683

• 体系结构与软件技术 • 上一篇    下一篇

基于差异性代码克隆的代码块补全提示方法

殷康麒a,b, 吴鸣a,b, 王鹏程a,b, 徐云a,b   

  1. 中国科学技术大学 a. 计算机科学与技术学院;b. 安徽省高性能计算重点实验室, 合肥 230027
  • 收稿日期:2019-01-15 修回日期:2019-04-04 出版日期:2020-01-15 发布日期:2020-01-08
  • 作者简介:殷康麒(1995-),男,硕士研究生,主研方向为软件编程;吴鸣、王鹏程,博士研究生;徐云,教授、博士生导师。
  • 基金项目:
    国家自然科学基金面上项目(61672480)。

Method of Code Block Completion Suggestion Based on Gapped Code Clone

YIN Kangqia,b, WU Minga,b, WANG Pengchenga,b, XU Yuna,b   

  1. a. School of Computer Science and Technology;b. Key Laboratory of High Performance Computing of Anhui Province, University of Science and Technology of China, Hefei 230027, China
  • Received:2019-01-15 Revised:2019-04-04 Online:2020-01-15 Published:2020-01-08

摘要: 在软件编程中,通过代码补全提示可以提高编码效率,但目前缺乏有效的工具和手段从规模差异较大的相似代码中找到合适的候选代码。针对该问题,基于差异性代码克隆技术设计一种新的代码块补全提示方法。通过改进基于滑动窗口和带误匹配索引的匹配算法,寻找与待补全代码块相似的候选代码块,并对其进行特征提取、聚类和相关性排名,以此获得候选代码块的提示顺序。实验结果表明,与HILL等人提出的代码块补全提示方法相比,该方法提示准确率较高,并且适用于更多代码块补全场景。

关键词: 代码补全提示, 代码克隆, 特征提取, 聚类, 编码, 集成开发环境

Abstract: Code completion suggestion can significantly enhance coding efficiency in programming,but existing tools and methods are not effective enough in collecting suitable candidate codes from codes with large size difference.To address the problem,this paper proposes a new code block completion suggestion method based on gapped code clone techniques.By improving a matching algorithm based on sliding windows and error-matching indexes,this method searches for candidate code blocks similar to to-be-completed blocks.Then it performs feature extraction,clustering and similarity-based sorting on candidate code blocks,so as to obtain the order of suggested code blocks.Experimental results show that,compared with the code block completion suggestion method proposed by HILL etc.,this proposed method has a higher accuracy,and is applicable to more code block completion scenarios.

Key words: code completion suggestion, code clone, feature extraction, clustering, coding, Integrated Development Environment(IDE)

中图分类号: