引用本文:高原,刘辉,樊孝忠,牛振东.基于代码库和特征匹配的函数名称推荐方法.软件学报,2015,26(12):3062-3074
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览 4080次   下载 7007 本文二维码信息
码上扫一扫!
分享到: 微信 更多
基于代码库和特征匹配的函数名称推荐方法
高原1,2, 刘辉1,3, 樊孝忠1, 牛振东1
1.北京理工大学计算机学院, 北京 100081;2.第二炮兵装备研究院, 北京 100085;3.高可信软件技术教育部重点实验室(北京大学), 北京 100871
摘要:
函数名称质量的高低,对于理解和维护程序非常重要.然而对于软件开发人员,尤其是母语非英语的软件开发人员,为函数选取高质量的名称比较困难.为此,提出一种函数名称推荐方法.首先,基于开源软件创建函数库;然后,对于某个需要推荐名称的函数f,从函数库中检索与其相似的函数.对检索返回的相似函数用自然语言处理工具对函数名进行解析并获取标注词条,然后,从相应的函数体中提取特征代码并与相应的标注词条建立关联.基于此关联关系以及函数f的特征,自动推荐合适的函数名.该方法在开源项的1430个函数中进行了初步验证,结果表明:有22.7%的推荐结果与原函数名完全一致,有57.9%的推荐结果与原函数名关键词一致或基本一致.
关键词:  函数名称  推荐  特征选择  算法  自然语言处理
DOI:10.13328/j.cnki.jos.004817
分类号:
基金项目:国家自然科学基金(61272169,61472034,61003065,61371194);国家重点基础研究发展计划(973)(2013CB329303);教育部新世纪优秀人才支持计划(NCET-13-0041);北京高等学校青年英才计划(YETP1183);新闻出版重大科技工程项目(GAPP_ZDKJ_BQ/01)
Method Name Recommendation Based on Source Code Depository and Feature Matching
GAO Yuan1,2, LIU Hui1,3, FAN Xiao-Zhong1, NIU Zhen-Dong1
1.School of Computer Science and Technology, Beijing Institute of Technology, Beijing 100081, China;2.The Second Artillery Equipment Research Institute, Beijing 100085, China;3.Key Laboratory of High Confidence Software Technologies of the Ministry of Education(Peking University), Beijing 100871, China
Abstract:
Quality of method names is critical for the readability and maintainability of program. However, it is difficult for software engineers, especially non-English speaking, inexperienced engineers, to propose high quality method names. To address this issue, this paper proposes an approach to recommend method names. First, a method corpus is constructed from open source applications. For a given method f to be named, similar methods are retrieved from the method corpus. Names of these retrieved methods are divided into phrases, and features of these methods are extracted as well. A mapping between these phrases and features is also created to derive a list of candidate phrases and features for the method to be named. These phrases are finally constructed into candidate method names. The proposed approach is evaluated on 1430 methods in open source applications. Evaluation results suggest that 22.7 percent of recommended method names are the same as original ones, and 57.9 percent has the same or almost the same keywords as original ones.
Key words:  method name  recommendation  feature selection  algorithm  natural language processing

引用本文:
【打印本页】   【下载PDF全文】   查看/发表评论  【EndNote】   【RefMan】   【BibTex】
←前一篇|后一篇→ 过刊浏览    高级检索
本文已被:浏览次   下载  
分享到: 微信 更多
摘要:
关键词:  
DOI:
分类号:
基金项目:
Abstract:
Key words: