• 首页
  • 期刊简介
  • 编委会
  • 投稿指南
  • 收录情况
  • 杂志订阅
  • 联系我们
引用本文:李 睿,赵逢禹,刘 亚.基于类原型与深度学习的类注释生成方法[J].软件工程,2023,26(9):12-17.【点击复制】
【打印本页】   【下载PDF全文】   【查看/发表评论】  【下载PDF阅读器】  
←前一篇|后一篇→ 过刊浏览
分享到: 微信 更多
基于类原型与深度学习的类注释生成方法
李 睿1, 赵逢禹2, 刘 亚1
(1.上海理工大学光电信息与计算机工程学院, 上海 200093;
2.上海出版印刷高等专科学校信息与智能工程系, 上海 200093)
lrui1999@163.com; zhaofengyv@usst.edu.cn; liuya@usst.edu.cn
摘 要: 现有的代码注释生成技术大多针对方法粒度,而对于面向对象程序,类才是其核心组成,因此对类生成注释是很有必要的。针对这一问题,提出一种结合类原型与深度学习技术对类生成注释的方法。首先,确定类原型并选择对应类注释模板;其次,提取类中信息填充模板,对类中的方法通过双编码器模型训练得到方法代码注释。实验结果表明,方法粒度上提出的双编码器模型在方法代码注释生成的结果评估中表现较好,类粒度的注释准确性较高。
关键词: 代码注释;类注释模板;类原型;双编码器;深度学习
中图分类号: TP311    文献标识码: A
基金项目: “十三五”国家密码发展基金理论项目(MMJJ20180202)
Class Annotation Generation Method Based on Class Prototype and Deep Learning
LI Rui1, ZHAO Fengyu2, LIU Ya1
(1.School of Optical-Electrical & Computer Engineering, University of Shanghai for Science and Technology, Shanghai 200093, China;
2. Department of Information and Intelligent Engineering, Shanghai Publishing and Printing College, Shanghai 200093, China)
lrui1999@163.com; zhaofengyv@usst.edu.cn; liuya@usst.edu.cn
Abstract: Most of the existing code annotation generation techniques are targeted at method granularity. For object-oriented programs, classes are their core components, so it is necessary to generate annotations for classes. To solve this problem, this paper proposes a class annotation generation method combining class prototype and deep learning technology. Firstly, the class prototype is determined and the corresponding class annotation template is selected. Secondly, information in the class is extracted to fill the template, and the method code annotation is obtained by training the bi-encoder model for the methods in the class. The experimental results show that the proposed biencoder model in terms of method granularity performs better in the result evaluation score of method code annotation generation, and the annotation accuracy of class granularity is higher.
Keywords: code annotation; class annotation template; class prototype; bi-encoder; deep learning


版权所有:软件工程杂志社
地址:辽宁省沈阳市浑南区新秀街2号 邮政编码:110179
电话:0411-84767887 传真:0411-84835089 Email:semagazine@neusoft.edu.cn
备案号:辽ICP备17007376号-1
技术支持:北京勤云科技发展有限公司

用微信扫一扫

用微信扫一扫