在软件的开发和维护过程中,与代码对应的注释经常存在缺失、不足或者与代码实际内容不匹配等问题,但手工编写代码注释对开发人员来说费时费力,且注释质量难以保证,因此亟需研究人员提出有效的代码注释自动生成方法.代码注释自动生成问题是当前程序理解研究领域的一个研究热点,对该问题进行了系统综述.主要将已有的自动生成方法细分为3类:基于模板的方法、基于信息检索的方法和基于深度学习的方法.依次对每一类方法的已有研究成果进行了系统的梳理、总结和点评.随后分析了已有的实证研究中经常使用的语料库和主要的注释质量评估方法,以利于针对该问题的后续研究可以进行合理的实验设计.最后进行总结,并对未来值得关注的研究方向进行了展望.
During software development and maintenance, code comments often have some problems, such as missing, insufficient, or mismatching with code content. Writing high-quality code comments takes time and effort for developers, and the quality can not be guaranteed, therefore, it is urgent for researchers to design effective automatic code comment generation methods. The automatic code comment generation issue is an active research topic in the program comprehension domain. This study conducts a systematic review of this research topic. The existing methods are divided into three categories: Template-based generation methods, information retrieval-based methods, and deep learning-based methods. Related studies are analyzed and summarizedfor each category. Then, the corpora and comment quality evaluation methods that are often used in previous studiesare analyzed, which can facilitate the experimental study for future studies. Finally, the potential research directions in the future aresummarized and discussed.
[
代码注释自动生成是当前程序理解领域的一个研究热点[
代码注释的自动生成在很多软件工程相关任务中都能起到重要的作用.例如: 当开发人员新加入某个项目的开发团队, 或者需要评估项目内的某个模块是否需要使用新的类库时, 都需要通过阅读和理解代码尽快地熟悉大规模软件项目内的某个程序模块.开发人员在审查某个程序模块时, 需要尽快了解该模块的核心代码变更情况.在软件开发和维护过程中, 开发人员需要尽快定位到自己感兴趣的代码段上.不难看出, 高质量的代码注释有助于协助开发人员提高上述任务的完成效率.
但代码注释自动生成问题在研究时也面临诸多严峻挑战: 首先, 高质量的代码注释离不开对代码结构和语义的高质量分析, 尤其是代码语义分析在当前软件工程领域仍然是一个开放问题.其次, 有时候如果仅分析代码本身, 并不足以生成高质量的代码注释.因此还需要研究如何有效地利用项目缺陷跟踪系统和版本控制系统内的领域知识以及来自Stack Overflow和Github的众包知识.最后, 当前对生成的代码注释进行质量评估时, 主要采用手工评估方法和自动评估方法.但使用手工评估方法打分, 受限于专家对编程语言和领域知识的熟悉程度, 容易存在主观性较强的问题.而自动评估方法一般使用来自机器翻译研究领域的评测指标, 虽然可以自动给出生成注释的质量评分, 但代码注释自动生成问题与机器翻译问题相比, 仍存在一定的差异性[
代码注释自动生成的研究工作最早可以追溯到Haiduc等人[
为了对该问题的已有研究工作和取得的成果进行系统的梳理, 我们首先确定了source code summarization、summarizing source code、generating summary comments、summarization of source code、comment generation、commit message generation、generating commit messages等关键词.随后我们选择如下论文数据库, 通过输入上述关键词来检索与综述主题相关的论文.
https://ieeexplore.ieee.org)]]>
https://portal.acm.org)]]>
https://www.sciencedirect.com)]]>
https://link.springer.com)]]>
https://www.onlinelibrary.wiley.com)]]>
基于上述论文数据库中检索出来的相关文献, 我们在人工筛选方法的基础上, 通过分析论文的标题、关键词和摘要等来识别并移除与综述主题无关的论文.然后通过谷歌学术和DBLP等学术搜索引擎来查阅被选中论文的被引用情况和相关研究人员已发表论文的清单, 以进一步补充相关论文.最后我们确定了与该综述主题直接相关的高质量论文共70篇(截止到2020年7月).
我们首先将每年累计发表的论文总数进行统计, 结果如
相关论文每年累计发表的论文数
Cumulative number of published papers for each year
随后我们按照论文的发表源进行统计, 结果见
按照论文发表源进行统计, 仅列出发表数量超过1次的发表源
The statistics of paper according to publishing venues, notice onlylisting the publishing venues with more than one paper
发表源(简称) | 发表源(全称) | 类型 | CCF级别 | 累计发表数量 |
ASE | International Conference on Automated Software Engineering | 会议 | A | 10 |
ICSE | International Conference on Software Engineering | 会议 | A | 7 |
TSE | IEEE Transactions on Software Engineering | 期刊 | A | 4 |
ACL | Annual Meeting of the Association for Computational Linguistics | 会议 | A | 2 |
IJCAI | International Joint Conference on Artificial Intelligence | 会议 | A | 2 |
WWW | the Web Conference | 会议 | A | 2 |
ICPC | International Conference on Program Comprehension | 会议 | B | 12 |
SANER | International Conference on Software Analysis, Evolution, and Reengineering | 会议 | B | 4 |
SCAM | International Working Conference on Source Code Analysis & Manipulation | 会议 | C | 2 |
通过分析相关研究人员, 我们发现目前在该研究问题上最为活跃的是来自美国圣母大学(University of Notre Dame)的Collin McMillan教授所领导的研究小组.同时我们也注意到, 国内研究人员在该研究问题上也日趋活跃, 目前来自浙江大学、北京大学、南京大学、北京航空航天大学、南方科技大学等国内高校的研究人员都有高质量的研究成果发表.除此之外, 该研究问题也是软件工程领域里的一个热点话题, 据我们所知, 目前有5篇与综述主题相关的论文获得软件工程领域权威会议的最佳论文奖, 包括: Rodeghero等人[
目前针对代码注释自动生成问题的综述并不多, Nazar等人[
本文第1节给出综述的整体研究框架.第2节~第4节分别介绍基于模板的生成方法、基于信息检索的生成方法和基于深度学习的生成方法的相关研究工作, 并进行点评.第5节总结常用的代码注释语料库.第6节将常用的代码注释质量评估方法分为两类, 并分别加以分析.最后对该领域未来值得关注的研究方向进行展望.
本文的整体研究框架如
综述的研究框架图
Research framework of our survey
从
我们进一步对3种不同类型方法的相关论文的所占比例进行了统计, 具体如
3种不同类型的方法所占的比例
Proportion of three categories of methods
这类方法主要基于SWUM(software word usage model)或分析代码结构的版型(stereotype)信息, 以识别出方法的主要功能, 并基于模板生成对应的注释.其在分析时, 不仅需要考虑到代码本身的信息, 还需要考虑代码所处的上下文信息以及不同编程语言的特征.
SWUM可以为识别和表达高级别动作提供必要的语言信息.SWUM不仅可以捕获代码中单词出现的次数, 而且还可以捕获语言与结构的关系.在注释生成问题中, 使用SWUM分析代码, 可以重点识别出3个要素: 动作(action)、主题(theme)和可能的次要参数(secondary arguments).例如, 如果方法签名(signature)是list.add(Item i), 则通过对该方法签名进行SWUM分析, 可以识别出: 动作是add, 主题是item, 次要参数是(to) list.因此, 基于上述3个要素, 可以合成较为容易理解的代码注释.
Hill等人[
Sridhara等人[
Sridhara等人[
McBurney和McMilan[
版型是针对代码结构(例如类、方法、代码变更等)的类型(type)和角色(role)的高级别抽象.利用版型信息, 可以确定需要用于生成注释的代码结构类型.例如, 如果一种方法的职责是将类实例化为对象, 则可以将该方法的版型归为构造方法.
Moreno等人[
在版本控制系统内, 开发人员可以通过提交消息(commit message)来描述代码变更(code change)的目的和变更的主要内容.不难看出, 代码变更也是理解软件演化的一个重要依据, 而对应的提交消息同样可以协助开发人员在不需要理解代码变更的底层实现细节时, 就可以为理解软件演化提供重要的信息.但一些实证研究的结果表明, 项目内的提交消息质量难以令人满意.例如: Maalej和Happel[
除了基于SWUM和版型的方法, 也有研究人员从其他角度来设计基于模板的注释生成方法.Rai等人[
我们通过
基于模板的生成方法的对比
Comparison of template-based generation methods
相关文献 | 模块粒度 | 编程语言 | 方法类型 | 主要特征 |
Hill等人[ |
方法 | Java | SWUM | 仅分析方法的签名 |
Sridhara等人[ |
方法 | Java | SWUM | 进一步分析方法体内的代码 |
Sridhara等人[ |
方法 | Java | SWUM | 针对方法的参数生成注释 |
Sridhara等人[ |
方法 | Java | SWUM | 关注高级别的动作 |
Wang等人[ |
方法 | Java | SWUM | 关注与对象相关的高级别动作 |
McBurney等人[ |
方法 | Java | SWUM | 关注方法的上下文信息 |
Moreno等人[ |
类 | Java | 版型 | 结合版型信息与预先定义的基于方法和数据成员访问级别的启发式规则 |
Abid等人[ |
函数 | C++ | 版型 | 基于静态分析方法和一系列启发式规则 |
Buse等人[ |
代码变更 | Java | 版型 | 抽取出被修改代码内的路径谓词 |
Cortes-Coy等人[ |
代码变更 | Java | 版型 | 综合考虑代码变更的版型类型、变更的类型和与代码变更相关的影响集 |
Shen等人[ |
代码变更 | Java | 版型 | 综合利用方法版型和代码变更类型 |
Rai等人[ |
方法 | Java | 其他 | 基于代码级别的微模式 |
Malhotra [ |
类 | Java | 其他 | 基于微模式和类的变更倾向性 |
Nazar等人[ |
代码段 | Java | 其他 | 基于众包方法 |
Rastkar等人[ |
代码变更 | Java | 其他 | 基于多文档摘要方法 |
在这类方法的研究早期, 研究人员一般仅分析项目内的所有代码模块, 并基于信息检索模型, 通过识别出目标模块内的关键单词来合成代码的摘要.随着项目管理的日趋规范(例如, 当前大部分项目开发均会使用缺陷跟踪系统和版本控制系统)以及Github和Stack Overflow这类基于众包协作平台的快速发展, 研究人员尝试挖掘这些软件仓库以寻找与目标模块相似的代码段, 并利用这些相似代码段的描述、注释和讨论等以生成代码注释.
这类方法尝试着从目标代码中识别出核心关键词或语句, 随后将这些识别出的关键词或语句视为代码摘要, 我们将这类注释称为基于单词的代码注释.这类方法主要受到自动文本摘要(automatic text summarization)研究问题的启发.自动文本摘要主要针对单个或多个文档, 以尝试生成简短且包含文档核心内容的摘要.这类方法的主要流程可总结如下: 首先构造语料库, 在构造时主要包括单词识别、停用词移除和词干还原等操作.与文档不同, 代码需要额外针对标识符, 根据命名规范(例如驼峰命名法、下划线命名法)做进一步的切割.例如, 可以基于驼峰命名法将标识符setValue进一步切割成set和value这两个单词.除此之外, 在确定停用词清单时, 还需要额外添加与编程语言相关的关键词.这类方法经常考虑的检索模型包括VSM(vector space model)、LSI(latent semantic indexing)和LDA(laten Dirichlet allocation)等.在VSM模型中, 向量中的每个元素表示文档中对应单词的权重, 其中, tf(term frequency)、idf(inverse document frequency)和tf-idf是使用最多的单词权重计算方法.LSI模型使用SVD(singular value decomposition)方法将文档向量从高维单词空间映射到低维的语义空间(即主题空间).LSI模型可以用于挖掘文本隐含的主题信息, 而不需要依赖任何先验知识.LDA模型将狄利克雷先验分布引入到文档-主题分布和主题-单词分布中, 模型的学习和推断算法主要基于贝叶斯估计.
Haiduc等人[
Rodeghero等人[
Fowkes等人[
仅基于项目内模块来构建语料库, 可能存在信息不足的问题.为了缓解上述问题, 通过挖掘软件仓库, 有助于搜集与目标代码相关的知识, 并利用这些相关知识来生成更高质量的代码注释.
一些研究人员尝试着利用项目缺陷跟踪系统和开发人员往来邮件内的知识来生成代码注释.Panichella等人[
一些研究人员借助信息检索方法, 利用来自Stack Overflow和Github的众包知识来辅助生成代码注释.例如, 在开发人员问答网站Stack Overflow中, 用户经常会贴出一段含有缺陷的代码和所需要实现的功能, 随后, 其他用户会围绕这段缺陷代码展开讨论, 并给出可能的缺陷修复方案.这些讨论经常会包含一些有价值的信息, 并可以辅助对上述代码的理解.同样, 由于代码重复在大规模代码库(例如Github)内是一种常见现象.因此可以使用代码克隆(code clone)检测方法来尝试检索出与目标代码相似的代码段, 并基于这些相似代码段的注释来生成目标代码的注释.
Rahman等人[
Wong等人[
Wong等人[
同样, 也有研究人员尝试基于信息检索的生成方法, 通过分析代码变更来生成提交消息.Huang等人[
Liu等人[
我们通过
基于信息检索生成方法的对比
Comparison of information retrieval-based generation methods
相关文献 | 模块粒度 | 编程语言 | 方法类型 | 主要特征 |
Haiduc等人[ |
方法 | Java | 基于代码关键词抽取 | 基于LSI和VSM模型 |
Eddy等人[ |
方法 | Java | 基于代码关键词抽取 | 基于hPAM模型 |
McBurney等人[ |
方法 | Java | 基于代码关键词抽取 | 考虑了主题模型, 并将主题分层组织 |
Rodeghero等人[ |
方法 | Java | 基于代码关键词抽取 | 借助眼动追踪技术 |
Fowkes等人[ |
折叠代码 | Java | 基于代码关键词抽取 | 基于VSM和主题模型 |
Panichella等人[ |
方法 | Java | 基于软件仓库挖掘 | 综合考虑了缺陷报告和邮件清单 |
Rahman等人[ |
方法 | Java | 基于软件仓库挖掘 | 利用Stack Overflow的帖子 |
Wong等人[ |
方法 | Java | 基于软件仓库挖掘 | 利用Stack Overflow的帖子 |
Vassallo等人[ |
类 | Java | 基于软件仓库挖掘 | 利用Stack Overflow的帖子 |
Wong等人[ |
方法 | Java | 基于软件仓库挖掘 | 利用Github, 基于代码克隆检测方法 |
Badihi等人[ |
方法 | Java | 基于软件仓库挖掘 | 基于众包方式, 通过设计游戏机制来提高注释质量 |
Huang等人[ |
代码变更 | Java | 基于软件仓库挖掘 | 基于修改前后代码的语法和语义相似度 |
Liu等人[ |
代码变更 | Java | 基于软件仓库挖掘 | 基于 |
这类方法主要基于代码的naturalness假设[
基于深度学习的方法目前主要将代码注释自动生成问题建模为神经机器翻译(neural machine translation, 简称NMT)问题[
当前这类方法主要基于编码器-解码器结构(encode-decoder structure), 有时又被称为序列到序列模型(sequence to sequence model).具体来说, 编码器的作用是将源代码编码为固定长度的向量表示, 解码器的作用是将源代码的向量表示进行解码, 并生成代码注释.不同的编码器-解码器的主要区别在于代码的输入形式和神经网络的结构.一般来说, 常见的结构包括: CNN(convolutional neural network)和RNN(recurrent neural network).其中, LSTM(long short term memory)是最常见的一种RNN网络, 其考虑了3个门控, 即输入门控、遗忘门控和输出门控.主要是为了解决长序列训练过程中的梯度消失和梯度爆炸问题.GRU(gated recurrent unit)可以缓解LSTM中存在的结构复杂和实现复杂的问题, 并可以有效地减少模型训练时所需的时间开销.GRU仅考虑了两个门控, 即更新门控和重置门控.同时, 研究人员还会在RNN上进一步考虑注意力机制(attention mechanism), 其可以为编码器/解码器的相关序列中更为相关的词素赋予更高的权重取值, 以进一步缓解长序列训练中存在的相关问题.
Iyer等人[
Hu等人[
LeClair等人[
Ahmad等人[
已有的针对代码变更生成提交消息的方法[
Loyola等人[
Liu等人[
除了上述经典的基于编码器-解码器模型的方法, 研究人员最近也尝试综合使用其他类型的学习算法(例如图神经网络、强化学习和对偶学习等)来进一步提升性能.
一些研究人员考虑使用图神经网络.Shido等人[
一些研究人员考虑使用强化学习.Wan等人[
一些研究人员借助对偶学习(dual learning), 通过利用两个任务之间的对称性, 通过互相反馈, 以进一步提升模型性能.Chen等人[
除了上述研究工作外, 一些研究人员尝试着利用其他信息(例如API序列信息、与目标代码相似的代码段、方法的上下文信息等)来进一步提升生成的注释质量.
开发人员经常会通过调用特定的API序列来实现某个功能.例如, 使用Java编程语言实现打开文件这一功能, 就会使用固定的API序列.因此, 与可能基于不同编码规范实现的代码相比, 代码内的API序列会更为有规可循.基于上述观察, Hu等人[
Zhang等人[
Liu等人[
我们通过
基于深度学习的生成方法的对比
Comparison of deep learning-based generation methods
相关文献 | 模块粒度 | 编程语言 | 方法类型 | 主要特征 |
Iyer等人[ |
代码段 | C#、SQL查询 | 经典编码器-解码器 | 基于LSTM和注意力机制 |
Allamanis等人[ |
方法 | Java | 经典编码器-解码器 | 基于CNN和注意力机制 |
Zheng等人[ |
代码段 | Java | 经典编码器-解码器 | 提出代码注意力机制 |
Liang等人[ |
方法 | Java | 经典编码器-解码器 | 基于Code-RNN和Code-GRU |
Hu等人[ |
方法 | Java | 经典编码器-解码器 | 基于SBT方法将AST转换成序列 |
Kang等人[ |
方法 | Java | 经典编码器-解码器 | 考虑了预训练的词嵌入 |
LeClair等人[ |
方法 | Java | 经典编码器-解码器 | 同时考虑了代码的单词表示和AST表示 |
Ahmad等人[ |
代码段、方法 | Python、Java | 经典编码器-解码器 | 基于Transformer |
Loyola等人[ |
代码变更 | Python、C++、Java、JavaScript | 经典编码器-解码器 | 基于LSTM |
Jiang等人[ |
代码变更 | Java | 经典编码器-解码器 | 基于RNN |
Xu等人[ |
代码变更 | Java | 经典编码器-解码器 | 抽取代码结构和代码语义信息, 使用复制机制缓解OOV问题 |
Liu等人[ |
代码变更 | Java | 经典编码器-解码器 | 基于AST对代码变更进行编码, 并提出一个混合排序模块 |
Liu等人[ |
Pull Request | Java | 经典编码器-解码器 | 借助指针生成网络缓解OOV问题 |
Shido等人[ |
方法 | Java | 其他类型学习方法 | 使用扩展的Tree-LSTM |
LeClair等人[ |
方法 | Java | 其他类型学习方法 | 利用了图神经网络 |
Liu等人[ |
函数 | C/C++ | 其他类型学习方法 | 基于联合代码属性图和基于检索增强机制的图神经网络 |
Wan等人[ |
代码段 | Python | 其他类型学习方法 | 利用了强化学习 |
Chen等人[ |
代码段 | C#、SQL查询 | 其他类型学习方法 | 通过构建两个VAEs, 同时考虑了注释生成和代码检索 |
Ye等人[ |
代码段 | Python、SQL查询 | 其他类型学习方法 | 基于对偶学习, 同时考虑了注释生成和代码检索 |
Wang等人[ |
代码段 | Python | 其他类型学习方法 | 借助演员-评论者网络, 同时考虑了注释生成和代码检索 |
Wei等人[ |
代码段、方法 | Python、Java | 其他类型学习方法 | 基于对偶学习, 同时考虑了注释生成和代码生成问题 |
Hu等人[ |
方法 | Java | 其他信息来源 | 额外考虑了API序列信息 |
Zhang等人[ |
代码段、方法 | Python、Java | 其他信息来源 | 利用与目标代码语法和语义相似的代码段 |
Liu等人[ |
方法 | Java | 其他信息来源 | 考虑了代码的调用信息 |
Zhou等人[ |
方法 | Java | 其他信息来源 | 考虑了方法的上下文信息, 综合使用了程序分析和预定义的模板 |
Haque等人[ |
方法 | Java | 其他信息来源 | 考虑了文件的上下文信息 |
早期的研究基本上都是从Github里选择流行的开源项目, 并借助用户研究(human study)方式对所提方法的有效性进行评估, 因此实验规模较小, 并以案例分析为主.随后, 研究人员逐渐共享出他们整理的语料库, 并吸引了更多研究人员针对该研究问题展开深入的研究.不难看出, 这些语料库是当前基于深度学习的方法能够生成高质量代码注释的一个重要前提.本文对目前代码注释自动生成研究已共享的主流语料库进行了总结, 具体见
目前已经共享的代码注释语料库
Statistics for shared code comment corpus
共享语料库的文献 | 编程语言 | 模块粒度 | 共享网址 | 累计次数 |
Hu等人[ |
Java | 方法 | https://github.com/huxingfree/DeepCom]]> | 8 |
Barone等人[ |
Python | 代码段 | https://github.com/rsennrich/nematus]]> | 6 |
Jiang等人[ |
Java | 代码变更 | https://sjiang1.github.io/commitgen/]]> | 3 |
Iyer等人[ |
C#、SQL查询 | 代码段 | https://github.com/sriniiyer/codenn]]> | 2 |
LeClair等人[ |
Java | 方法 | http://leclair.tech/data/funcom]]> | 2 |
Allamanis等人[ |
Java | 方法 | https://groups.inf.ed.ac.uk/cup/codeattention]]> | 1 |
Hu等人[ |
Java | 方法 | https://github.com/xinghu/TL-CodeSum]]> | 1 |
LeClair等人[ |
Java | 方法 | https://s3.us-east-2.amazonaws.com/icse2018/index.html]]> | 1 |
Yao等人[ |
SQL、Python | 代码段 | https://github.com/LittleYUYU/StackOverflow-Question-Code-Dataset]]> | 1 |
Iyer等人[
随后, Hu等人共享了两个高质量语料库.(1) 在文献[
Barone等人[
Jiang等人[
不难看出, 目前文献[
精确评估生成的代码注释质量仍然是一个开放性问题.相对于文本分类和机器翻译等自然语言处理的应用, 代码注释质量的评估更具研究挑战性, 从理论上来讲, 并不存在完美的代码注释.针对同一段代码, 不同开发人员可能会写出不同的代码注释, 并且这些代码注释之间可能会存在较大的差异性.在已有的研究工作中, 主要考虑了两种评估方式.第1种评估方式是雇用有经验的开发人员进行人工评估, 这是论文分析的3类方法均会使用的评估方式.第2种评估方式是使用来自机器翻译领域的评测指标来辅助评估, 这是第3类方法经常使用的评估方式.
好的代码注释需要满足如下特征[
在人工评估时, 研究人员一般会邀请经验丰富的开发人员(通常要求具有至少5年的编程经验)或计算机专业的硕士研究生或博士研究生来阅读自动生成的代码注释, 并从给定的维度来进行打分, 每一项得分通常被设置为从1~5, 其中, 1表示最差, 5表示最好.除此之外, 也有研究人员将得分设置为从1~3或从1~4.但在人工评估的过程中, 不同开发人员之间的打分会存在较大的差异, 一些开发人员认为质量很好的代码注释, 可能在另一个开发人员眼里被认为质量不好, 这与参与人员的编程经验、对项目所处领域的熟悉程度、人员个性、认真态度等均有关.因此, 如何克服评分专家之间的主观差异性成为研究人员关注的焦点.例如, 可以考虑金字塔方法(pyramid method)[
这些评测指标主要来自机器翻译和文本总结等研究领域, 可以评估候选文本(即基于代码注释自动方法而生成)和参考文本(即基于手工方式而生成)的相似度.
(1) BLEU指标[
但BLEU指标更偏重查准率, 而忽略了查全率(即参考文本中未在候选文本中出现的
(2) METEOR指标[
(3) ROUGE指标[
(4) CIDER指标[
不难看出, BLEU、METOR和ROUGE指标的取值范围介于0~1之间, 并经常以百分比的形式给出.而CIDER指标对的取值范围并不在0~1之间, 因此经常以实数的形式给出.
我们按照不同年份, 将上述评测指标在基于深度学习的方法中的使用情况进行了统计, 最终如
评测指标在不同年份的使用情况统计
Statistics on the usage of performance measures for different years
不难看出, 在2016年和2017年, 研究人员主要使用BLEU和METOR指标.但从2018年开始, 研究人员逐渐开始使用ROUGE和CIDER指标.除此之外, 我们还发现基本上所有的基于深度学习的方法均使用了BLEU评测指标, 近些年来, 研究人员更倾向于同时使用BLEU、METOR和ROUGE指标.
在最近的一个研究工作中, Stapleton等人[
高质量的代码注释有助于减少开发人员花费在程序理解上的代价.但开发人员由于项目开发时间紧、编程经验不足或者对代码注释的重视程度不够, 经常会造成代码注释的缺失、不足或者与代码实际内容不匹配等问题.因此, 代码注释自动生成是缓解上述问题的一种有效手段, 也是当前程序理解研究领域的一个重要应用场景.同时, 针对该问题的研究具有丰富的理论研究价值和工业应用前景, 目前, 该问题在程序理解领域仍是一个开放性研究问题.本文针对该主题进行了系统的综述, 以方便研究人员更好地了解这一主题的最新研究进展.具体来说, 首先将已有方法细分为3类: 基于模板的方法、基于信息检索的方法和基于深度学习的方法.对每一类方法均深入分析了方法的核心思想并对经典工作进行了深入的评点.随后对常用的语料库和代码注释生成质量评估方法进行了总结, 以方便研究人员对后续提出的新方法进行更加全面和合理的评估.虽然研究人员针对代码注释自动问题已经取得了一系列高质量的研究成果, 但该问题仍有很多研究点值得研究人员进一步关注.
(1) 搭建统一的实验平台以集成更多的语料库、评测指标和基准方法等.通过第5节的分析, 我们发现虽然研究人员陆续共享了多个代码注释语料库, 其中一些语料库[
(2) 从挖掘众包知识网站、分析相关软件制品和学习优秀注释风格等角度, 进一步地提升生成的代码注释质量.进一步提升生成的代码注释质量仍然是该综述主题的一个重要研究点, 首先, 一方面需要充分利用来自Stack Overflow和Github平台上的众包知识, 以进一步提升注释的生成质量.具体来说, 在生成代码注释时, 不仅要深入分析代码的文本内容和结构信息, 还要额外搜索Github和Stack Overflow等平台, 以有效地搜索出与目标代码相关的众包知识.通过有效利用这些众包知识, 进一步地提升生成的代码注释的质量.另一方面, 也可以充分利用项目内的相关知识.为了更好地捕获与项目相关的信息, 可以在训练模型和生成注释时, 考虑项目软件仓库内的其他类型文档.例如, 如果一个新的代码变更是为了修复缺陷, 则可以去查找这次变更对应的缺陷报告以获取缺陷的具体信息.其次, 本文总结的3种类型方法各有自己的优点和不足.虽然当前基于深度学习的方法是主流的研究方式, 但我们仍然可以通过融合其他两种类型的方法来进一步提升生成的代码注释质量.例如: Zhang等人[
(3) 针对其他软件制品来生成注释.该综述重点分析了传统代码(例如Java、Python等)的注释自动生成问题, 但在当前软件开发和维护过程中, 除了传统软件代码外, 开发人员还会创建其他类型的软件制品.结合这些软件制品特征来生成对应的高质量注释, 同样具有研究意义并存在一定的研究挑战性.虽然研究人员在这个方向上进行了一些探索.例如, Kamimura等人[
(4) 辅助其他软件工程任务.除了分析代码生成对应的注释外, 我们还可以利用已有的研究成果辅助其他软件工程任务.例如: 通过分析方法或者类内的代码来生成方法名或者类名.Allamanis等人[
(5) 注释自动生成插件的开发和代码注释的自动补全.研究人员在后续研究中需要针对主流的集成开发环境, 开发相关的注释自动生成插件, 在选定关注的代码段后, 插件可以直接生成对应的代码注释, 以方便开发人员后续对代码注释作进一步的完善.除此之外, 已有研究结果表明, 直接生成高质量的代码注释比较困难, 一种可行的方法是在用户编写代码注释时, 自动给出注释补全建议.该解决方案的好处是, 一方面可以减少编写代码注释的代价, 另一方面也可以协助开发人员写出更多的代码注释.Movshovitz-Attias等人[
(6) 自动化的评估方法.通过分析已有工作, 我们发现大部分工作在注释质量评估时, 都考虑了手工评估的方法.但这种评估方法较为主观, 与参与评估人员的编程经验和对项目所在领域知识的了解密切相关.在基于深度学习的生成方法中, 大部分研究人员直接使用机器翻译领域中的评价指标.但代码注释生成问题与机器翻译问题仍存在一定的区别.首先, 代码注释与代码本身并不完全对应, 代码注释含有的单词通常要显著少于代码含有的单词.其次, 目前语料库中代码对应的注释质量并不乐观, 因此基于语料库中注释计算出的评测指标值, 并不一定能够真实地反映出代码注释的质量, 会对不同方法间的性能比较结论的有效性产生影响, 因此如何寻找更加客观评估代码注释质量的评测指标仍是一个开放问题, 也是现有研究成果应用到实际开发过程中的一个重要阻碍.
我们希望针对上述挑战提出有效的解决方案, 可以使得开发人员在代码注释的编写上节约大量的时间, 同时自动生成的高质量的注释也可以为项目的后续维护提供重要的保障.
感谢各位审稿专家提出的宝贵意见.
本文由“面向非确定性的软件质量保障方法与技术”专题特约编辑陈俊洁副教授、汤恩义副教授、何啸副教授以及马晓星教授推荐.
Xia X, Bao L, Lo D, Xing Z, Hassan AE, Li S. Measuring program comprehension: A large-scale field study with professionals. IEEE Trans. on Software Engineering, 2018, 44(10): 951-976.
He H. Understanding source code comments at large-scale. In: Proc. of the 27th ACM Joint Meeting on European Software Engineering Conf. and Symp. on the Foundations of Software Engineering. 2019. 1217-1219.
Kramer D. API documentation from source code comments: A case study of Javadoc. In: Proc. of the 17th Annual Int'l Conf. on Computer Documentation. 1999. 147-153.
Fluri B, Wursch M, Gall HC. Do code and comments co-evolve? On the relation between source code and comment changes. In: Proc. of the 14th Working Conf. on Reverse Engineering. 2007. 70-79.
Jin Z, Liu F, Li G. Program comprehension: Present and future. Ruan Jian Xue Bao/Journal of Software, 2019, 30(1): 110-126(in Chinese with English abstract). http://www.jos.org.cn/1000-9825/5643.htm[doi:10.13328/ki.jos.005643]
金芝, 刘芳, 李戈. 程序理解: 现状与未来. 软件学报. 2019;30(1): 110-26. http://www.jos.org.cn/1000-9825/5643.htm[doi:10.13328/ki.jos.005643]
Stapleton S, Gambhir Y, LeClair A, Eberhart Z, Weimer W, Leach K, Huang Y. A human study of comprehension and code summarization. In: Proc. of the Int'l Conf. on Program Comprehension. 2020. 2-13.
Haiduc S, Aponte J, Moreno L, Marcus A. On the use of automated text summarization techniques for summarizing source code. In: Proc. of the 17th Working Conf. on Reverse Engineering. 2010. 35-44.
Haiduc S, Aponte J, Marcus A. Supporting program comprehension with source code summarization. In: Proc. of the 32nd ACM/IEEE Int'l Conf. on Software Engineering. 2010. 223-226.
Liu F, Li G, Hu X, Jin Z. Program comprehension based on deep learning. Journal of Computer Research and Development, 2019, 56(8): 1605-1620(in Chinese with English abstract).
刘芳, 李戈, 胡星, 等. 基于深度学习的程序理解研究进展. 计算机研究与发展, 2019, 56(8): 1605-1620.
Iyer S, Konstas I, Cheung A, Zettlemoyer L. Summarizing source code using a neural attention model. In: Proc. of the 54th Annual Meeting of the Association for Computational Linguistics. 2016. 2073-2083.
Rodeghero P, McMillan C, McBurney PW, Bosch N, D'Mello S. Improving automated source code summarization via an eye-tracking study of programmers. In: Proc. of the 36th Int'l Conf. on Software Engineering. 2014. 390-401.
McBurney PW, McMillan C. Automatic documentation generation via source code summarization of method context. In: Proc. of the 22nd Int'l Conf. on Program Comprehension. 2014. 279-290.
Hu X, Li G, Xia X, Lo D, Jin Z. Deep code comment generation. In: Proc. of the 26th IEEE/ACM Int'l Conf. on Program Comprehension. 2018. 200-210.
Liu Z, Xia X, Hassan AE, Lo D, Xing Z, Wang X. Neural-machine-translation-based commit message generation: How far are we? In: Proc. of the 33rd ACM/IEEE Int'l Conf. on Automated Software Engineering. 2018. 373-384.
Liu Z, Xia X, Treude C, Lo D, Li S. Automatic generation of pull request descriptions. In: Proc. of the 34th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2019. 176-188.
Nazar N, Hu Y, Jiang H. Summarizing software artifacts: A literature review. Journal of Computer Science and Technology, 2016, 31(5): 883-909.
Song X, Sun H, Wang X, Yan J. A survey of automatic generation of source code comments: Algorithms and techniques. IEEE Access, 2019, 7: 111411-111428.
Hill E, Pollock L, Vijay-Shanker K. Automatically capturing source code context of NL-queries for software maintenance and reuse. In: Proc. of the 31st IEEE Int'l Conf. on Software Engineering. 2009. 232-242.
Sridhara G, Hill E., Muppaneni D, Pollock L, Vijay-Shanker K. Towards automatically generating summary comments for Java methods. In: Proc. of the IEEE/ACM Int'l Conf. on Automated Software Engineering, 2010. 43-52
Sridhara G, Pollock L, Vijay-Shanker K. Generating parameter comments and integrating with method summaries. In: Proc. of the 19th IEEE Int'l Conf. on Program Comprehension. 2011. 71-80.
Sridhara G, Pollock L, Vijay-Shanker K. Automatically detecting and describing high level actions within methods. In: Proc. of the 33rd Int'l Conf. on Software Engineering. 2011. 101-110.
Wang X, Pollock L, Vijay-Shanker K. Automatically generating natural language descriptions for object-related statement sequences. In: Proc. of the 24th IEEE Int'l Conf. on Software Analysis, Evolution and Reengineering. 2017. 205-216.
McBurney PW, McMillan C. Automatic source code summarization of context for Java methods. IEEE Trans. on Software Engineering, 2015, 42(2): 103-119.
Moreno L, Aponte J, Sridhara G, Marcus A, Pollock L, Vijay-Shanker K. Automatic generation of natural language summaries for Java classes. In: Proc. of the 21st Int'l Conf. on Program Comprehension. 2013. 23-32.
Abid NJ, Dragan N, Collard ML, Maletic JI. Using stereotypes in the automatic generation of natural language summaries for C++ methods. In: Proc. of the 2015 IEEE Int'l Conf. on Software Maintenance and Evolution. 2015. 561-565.
Maalej W, Happel HJ. Can development work describe itself? In: Proc. of the 7th IEEE Working Conf. on Mining Software Repositories. 2010. 191-200.
Dyer R, Nguyen HA, Rajan H, Nguyen TN. BOA: A language and infrastructure for analyzing ultra-large-scale software repositories. In: Proc. of the 35th Int'l Conf. on Software Engineering. 2013. 422-431.
Buse RP, Weimer WR. Automatically documenting program changes. In: Proc. of the IEEE/ACM Int'l Conf. on Automated Software Engineering. 2010. 33-42.
Cortés-Coy LF, Linares-Vásquez M, Aponte J, Poshyvanyk D. On automatically generating commit messages via summarization of source code changes. In: Proc. of the 14th IEEE Int'l Working Conf. on Source Code Analysis and Manipulation. 2014. 275-284.
Shen J, Sun X, Li B, Yang H, Hu J. On automatic summarization of what and why information in source code changes. In: Proc. of the 40th IEEE Annual Computer Software and Applications Conf. 2016. 103-112.
Rai S, Gaikwad T, Jain S, Gupta A. Method level text summarization for Java code using nano-patterns. In: Proc. of the 24th Asia-Pacific Software Engineering Conf. 2017. 199-208.
Malhotra M, Chhabra JK. Class level code summarization based on dependencies and micro patterns. In: Proc. of the 2nd Int'l Conf. on Inventive Communication and Computational Technologies. 2018. 1011-1016.
Nazar N, Jiang H, Gao G, Zhang T, Li X, Ren Z. Source code fragment summarization with small-scale crowdsourcing based features. Frontiers of Computer Science, 2016, 10(3): 504-517.
Rastkar S, Murphy GC. Why did this code change? In: Proc. of the 35th Int'l Conf. on Software Engineering. 2013. 1193-1196.
Eddy BP, Robinson JA, Kraft NA, Carver JC. Evaluating source code summarization techniques: Replication and expansion. In: Proc. of the 21st Int'l Conf. on Program Comprehension. 2011. 13-22.
McBurney PW, Liu C, McMillan C, Weninger T. Improving topic model source code summarization. In: Proc. of the 22nd Int'l Conf. on Program Comprehension. 2014. 291-294.
Rodeghero P, Liu C, McBurney PW, McMillan C. An eye-tracking study of Java programmers and application to source code summarization. IEEE Trans. on Software Engineering, 2015, 41(11): 1038-1054.
Fowkes J, Chanthirasegaran P, Ranca R, Allamanis M, Lapata M, Sutton C. Autofolding for source code summarization. IEEE Trans. on Software Engineering, 2017, 43(12): 1095-1109.
Panichella S, Aponte J, Di Penta M, Marcus A, Canfora G. Mining source code descriptions from developer communications. In: Proc. of the 20th IEEE Int'l Conf. on Program Comprehension. 2012. 63-72.
Rahman MM, Roy CK, Keivanloo I. Recommending insightful comments for source code using crowdsourced knowledge. In: Proc. of the 15th IEEE Int'l Working Conf. on Source Code Analysis and Manipulation. 2015. 81-90.
Wong E, Yang J, Tan L. Autocomment: Mining question and answer sites for automatic comment generation. In: Proc. of the 28th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2013. 562-567.
Vassallo C, Panichella S, Di Penta M, Canfora G. Codes: Mining source code descriptions from developers discussions. In: Proc. of the 22nd Int'l Conf. on Program Comprehension. 2014. 106-109.
Wong E, Liu T, Tan L. Clocom: Mining existing source code for automatic comment generation. In: Proc. of the 22nd IEEE Int'l Conf. on Software Analysis, Evolution, and Reengineering. 2015. 380-389.
Badihi S, Heydarnoori A. Crowdsummarizer: Automated generation of code summaries for Java programs through crowdsourcing. IEEE Software, 2017, 34(2): 71-80.
Huang Y, Zheng Q, Chen X, Xiong Y, Liu Z, Luo X. Mining version control system for automatically generating commit comment. In: Proc. of the 2017 ACM/IEEE Int'l Symp. on Empirical Software Engineering and Measurement. 2017. 414-423.
Jiang S, Armaly A, McMillan C. Automatically generating commit messages from diffs using neural machine translation. In: Proc. of the 32nd IEEE/ACM Int'l Conf. on Automated Software Engineering. 2017. 135-146.
Alon U, Zilberstein M, Levy O, Yahav E. code2vec: Learning distributed representations of code. In: Proc. of the ACM on Programming Languages. 2019. 1-29.
Alon U, Brody S, Levy O, Yahav E. code2seq: Generating sequences from structured representations of code. arXiv Preprint arXiv: 1808.01400, 2019.
Lozoya RC, Baumann A, Sabetta A, Bezzi M. Commit2Vec: Learning distributed representations of code changes. arXiv Preprint arXiv: 1911.07605, 2019.
Hoang T, Kang HJ, Lawall J, Lo D. CC2Vec: Distributed representations of code changes. arXiv Preprint arXiv: 2003.05620, 2020.
Allamanis M, Barr ET, Devanbu P, Sutton C. A survey of machine learning for big code and naturalness. ACM Computing Surveys, 2018, 51(4): 1-37.
Hindle A, Barr ET, Su Z, Gabel M, Devanbu P. On the naturalness of software. In: Proc. of the 34th Int'l Conf. on Software Engineering. 2012. 837-847.
Li YC, Xiong DY, Zhang M. A survey of neural machine translation. Chinese Journal of Computers. 2018, 41(12): 2734-2755(in Chinese with English abstract).
李亚超, 熊德意, 张民. 神经机器翻译综述. 计算机学报. 2018, 41(12): 2734-2755.
Allamanis M, Peng H, Sutton C. A convolutional attention network for extreme summarization of source code. In: Proc. of the Int'l Conf. on Machine Learning. 2016. 2091-2100.
Zheng W, Zhou HY, Li M, Wu J. Code attention: Translating code to comments by exploiting domain features. arXiv Preprint arXiv: 1709.07642, 2017.
Liang Y, Zhu K. Q. Automatic generation of text descriptive comments for code blocks. In: Proc. of the 32nd AAAI Conf. on Artificial Intelligence. 2018.
Hu X, Li G, Xia X, Lo D, Jin Z. Deep code comment generation with hybrid lexical and syntactical information. Empirical Software Engineering, 2020, 25(3): 2179-2217.
Kang HJ, Bissyandé TF, Lo D. Assessing the generalizability of code2vec token embeddings. In: Proc. of the 34th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2019. 1-12.
Pennington J, Socher R, Manning CD. Glove: Global vectors for word representation. In: Proc. of the 2014 Conf. on Empirical Methods in Natural Language Processing. 2014. 1532-1543.
LeClair A, Jiang S, McMillan C. A neural model for generating natural language summaries of program subroutines. In: Proc. of the 41st IEEE/ACM Int'l Conf. on Software Engineering. 2019. 795-806.
Ahmad WU, Chakraborty S, Ray B, Chang KW. A transformer-based approach for source code summarization. arXiv Preprint arXiv: 2005.00653, 2020.
Loyola P, Marrese-Taylor E, Matsuo Y. A neural architecture for generating natural language descriptions from source code changes. arXiv Preprint arXiv: 1704.04856, 2017.
Jiang S, McMillan C. Towards automatic generation of short summaries of commits. In: Proc. of the 25th IEEE/ACM Int'l Conf. on Program Comprehension. 2017. 320-323.
Xu S, Yao Y, Xu F, Gu T, Tong H, Lu J. Commit message generation for source code changes. In: Proc. of the 27th Int'l Joint Conf. on Artificial Intelligence. 2019. 3975-3981.
Jiang S. Boosting neural commit message generation with code semantic analysis. In: Proc. of the 34th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2019. 1280-1282.
Liu S, Gao C, Chen S, Nie LY, Liu Y. ATOM: Commit message generation based on abstract syntax tree and hybrid ranking. IEEE Trans. on Software Engineering, 2020.
Shido Y, Kobayashi Y, Yamamoto A, Miyamoto A, Matsumura T. Automatic source code summarization with extended tree-LSTM. In: Proc. of the 2019 Int'l Joint Conf. on Neural Networks. 2019. 1-8.
LeClair A, Haque S, Wu L, McMillan C. Improved code summarization via a graph neural network. In: Proc. of the Int'l Conf. on Program Comprehension. 2020.
Liu S, Chen Y, Xie X, Siow JK, Liu Y. Automatic code summarization via multi-dimensional semantic fusing in GNN. arXiv Preprint arXiv: 2006.05405, 2020.
Wan Y, Zhao Z, Yang M, Xu G, Ying H, Wu J, Yu PS. Improving automatic source code summarization via deep reinforcement learning. In: Proc. of the 33rd ACM/IEEE Int'l Conf. on Automated Software Engineering. 2018. 397-407.
Wang W, Zhang Y, Sui Y, Wan Y, Zhao Z, WuJ, Xu G. Reinforcement-learning-guided source code summarization via hierarchical attention. IEEE Trans. on Software Engineering, 2020.
Chen Q, Zhou M. A neural framework for retrieval and summarization of source code. In: Proc. of the 33rd IEEE/ACM Int'l Conf. on Automated Software Engineering. 2018. 826-831.
Ye W, Xie R, Zhang J, Hu T, Wang X, Zhang S. Leveraging code generation to improve code retrieval and summarization via dual learning. In: Proc. of the Web Conf. 2020. 2309-2319.
Wang W, Zhang, Y, Zeng Z, Xu G. Trans. A transformer-based framework for unifying code summarization and code search. arXiv Preprint arXiv: 2003.03238, 2020.
Wei B, Li G, Xia X, Fu Z, Jin Z. Code generation as a dual task of code summarization. In: Advances in Neural Information Processing Systems. 2019. 6563-6573.
Hu X, Li G, Xia X, Lo D, Lu S, Jin Z. Summarizing source code with transferred API knowledge. In: Proc. of the 27th Int'l Joint Conf. on Artificial Intelligence. 2018. 2269-2275.
Zhang J, Wang X, Zhang H, Sun H, Liu X. Retrieval-based neural source code summarization. In: Proc. of the 42nd Int'l Conf. on Software Engineering. 2020.
Liu B, Wang T, Zhang X, Fan Q, Yin G, Deng J. A neural-network based code summarization approach by using source code and its call dependencies. In: Proc. of the 11th Asia-Pacific Symp. on Internetware. 2019. 1-10.
Zhou Y, Yan X, Yang W, Chen T, Huang Z. Augmenting Java method comments generation with context information based on neural networks. Journal of Systems and Software, 2019, 156: 328-340.
Haque S, LeClair A, Wu L, McMillan C. Improved automatic summarization of subroutines via attention to file context. In: Proc. of the 17th Int'l Conf. on Mining Software Repositories. 2020.
Barone AVM, Sennrich R. A parallel corpus of Python functions and documentation strings for automated code documentation and code generation. In: Proc. of the 8th Int'l Joint Conf. on Natural Language Processing. 2017. 314-319.
LeClair A, McMillan C. Recommendations for datasets for source code summarization. In: Proc. of the 2019 Conf. of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. 2019. 3931-3937.
Yao Z, Weld DS, Chen WP, Sun H. Staqc: A systematically mined question-code dataset from stack overflow. In: Proc. of the 2018 World Wide Web Conf. 2018. 1693-1703.
Eberhart Z, LeClair A, McMillan C. Automatically extracting subroutine summary descriptions from unstructured comments. In: Proc. of the 27th IEEE Int'l Conf. on Software Analysis, Evolution and Reengineering. 2020. 35-46.
Khamis N, Witte R, Rilling J. Automatic quality assessment of source code comments: The JavadocMiner. In: Proc. of the Int'l Conf. on Application of Natural Language to Information Systems. 2010. 68-79.
Steidl D, Hummel B, Juergens E. Quality analysis of source code comments. In: Proc. of the 21st Int'l Conf. on Program Comprehension. 2013. 83-92.
Nenkova A, Passonneau RJ. Evaluating content selection in summarization: The Pyramid method. In: Proc. of the Human Language Technology Conf. of the North American. 2004. 145-152.
Papineni K, Roukos S, Ward T, Zhu WJ. BLEU: A method for automatic evaluation of machine translation. In: Proc. of the 40th Annual Meeting of the Association for Computational Linguistics. 2002. 311-318.
Banerjee S, Lavie A. METEOR: An automatic metric for MT evaluation with improved correlation with human judgments. In: Proc. of the ACL WORKSHop on Intrinsic and Extrinsic Evaluation Measures for Machine Translation and/or Summarization. 2005. 65-72.
Lin CY. Rouge: A package for automatic evaluation of summaries. In: Proc. of the Text Summarization Branches Out. 2004. 74-81.
Vedantam R, Lawrence Zitnick C, Parikh D. Cider: Consensus-based image description evaluation. In: Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition. 2015. 4566-4575.
Kamimura M, Murphy GC. Towards generating human-oriented summaries of unit test cases. In: Proc. of the 21st Int'l Conf. on Program Comprehension. 2013. 215-218.
Li B, Vendome C, Linares-Vásquez M, Poshyvanyk D, Kraft NA. Automatically documenting unit test cases. In: Proc. of the 2016 IEEE Int'l Conf. on Software Testing, Verification and Validation. 2016. 341-352.
Moreno L, Bavota G, Di Penta M, Oliveto R, Marcus A, Canfora G. Automatic generation of release notes. In: Proc. of the 22nd ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. 2014. 484-495.
Gao C, Zeng J, Xia X, Lo D, Lyu MR, King I. Automating app review response generation. In: Proc. of the 34th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2019. 163-175.
Allamanis M, Barr ET, Bird C, Sutton C. Suggesting accurate method and class names. In: Proc. of the 10th Joint Meeting on Foundations of Software Engineering. 2015. 38-49.
Jiang L, Liu H, Jiang H. Machine learning based recommendation of method names: How far are we. In: Proc. of the 34th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2019. 602-614.
Oda Y, Fudaba H, Neubig G, Hata H, Sakti S, Toda T, Nakamura S. Learning to generate pseudo-code from source code using statistical machine translation. In: Proc. of the 30th IEEE/ACM Int'l Conf. on Automated Software Engineering. 2015. 574-584.
Movshovitz-Attias D, Cohen W. Natural language models for predicting programming comments. In: Proc. of the 51st Annual Meeting of the Association for Computational Linguistics. 2013. 35-40.
Ciurumelea A, Proksch S, Gall HC. Suggesting comment completions for Python using neural language models. In: Proc. of the 27th IEEE Int'l Conf. on Software Analysis, Evolution and Reengineering. 2020. 456-467.