代码补全(code completion)是自动化软件开发的重要功能之一,是大多数现代集成开发环境和源代码编辑器的重要组件.代码补全提供即时类名、方法名和关键字等预测,辅助开发人员编写程序,直观提高软件开发效率.近年来,开源软件社区中源代码和数据规模不断扩大,人工智能技术取得了卓越进展,这对自动化软件开发技术产生了极大的促进作用.智能代码补全(intelligent code completion)根据源代码建立语言模型,从语料库学习已有代码特征,根据待补全位置的上下文代码特征在语料库中检索最相似的匹配项进行推荐和预测.相对于传统代码补全,智能代码补全凭借其高准确率、多补全形式、可学习迭代的特性成为软件工程领域的热门方向之一.研究者们在智能代码补全方面进行了一系列研究,根据这些方法如何表征和利用源代码信息的不同方式,可以将它们分为基于编程语言表征和基于统计语言表征两个研究方向,其中,基于编程语言表征又分为标识符序列、抽象语法树、控制/数据流图这3个类别,基于统计语言表征又分为
Code completion is one of the crucial functions of automation software development. It is an essential component of most modern integrated development environments and source code editors. Code completion provides predictions such as instant class names, method names, keywords, and assists developer to code, which improves the efficiency of software development intuitively. In recent years, with the expanding of the source code and data scale in the open-source software community, and outstanding progress in artificial intelligence technology, the automation software development technology has been much promoted. Intelligent code completion builds a language model for source code, learns features from the existing code corpus, and retrieves the most similar matches in the corpus for recommendation and prediction based on the context code features around the position to be completed. Compared to traditional code completion, intelligence code completion has become one of the hot trends in the field of software engineering with its characteristics like high accuracy, multiple completion forms, and iterative learning ability. Researchers have conducted a series of researches on intelligent code completion. According to the different forms that these completion methods represent and utilize source code information, they can be divided into two research directions: programming language representation and statistical language representation. The programming language is divided into three types: token sequences, abstract syntax tree, and control/data flow graph. The statistical language also has two types:
在软件工程的研究中, 提高开发效率和质量是从业者和研究者们关注的核心问题.为此, 许多研究通过改进软件开发方法和运用自动化工具来提高软件开发的自动化水平, 如缺陷定位[
代码补全的研究最早可以追溯到1971年的SPELL[
以上代码补全方法通常只利用已输入的代码和语法规则, 通过人工定义启发式规则进行预测和补全, 很少考虑待补全代码与上文的语义关联.随着方法和参数的版本迭代更新, 这些规则就会落后甚至失效.为了解决这些问题, 研究者们建立学习模型解析源代码的语义和结构信息, 利用开源代码语料库对代码补全模型进行训练, 动态显示补全列表.2004年, Hill等人提出, 代码克隆并不一定是代码中需要去除的弊病[
智能代码补全方法涵盖许多技术, 如信息检索、自然语言处理等, 但所有的智能代码补全模型都将待补全位置的代码上下文与从开源代码语料库中学习到的代码上下文进行关联, 再推荐相似度高的补全建议.根据此流程, 不同智能代码补全方法的差异通常可以归纳为两个方面:代码上下文的表征方式、上下文之间相似度的度量方式.代码表征方式是指对代码进行信息提取和结构化表示的方法, 在代码上下文的表征方式中, 有两个主要的研究方向:其一是专注于从源代码中提取结构特征[
虽然智能代码补全方法近些年取得了一定进展, 但仍然存在许多问题.Jin等人关于代码补全方法的实证研究[
本文首次从代码表征方式的角度对代码补全方法进行综述研究, 整理和归纳当前智能代码补全技术, 指出已有的研究思路及欠缺, 并展望智能代码补全技术未来发展.
本文采用以下流程完成对相关文献的获取.本综述的目的是了解智能代码补全技术的研究现状.面向这一目标, 本综述在公开的期刊及会议论文、出版书籍中, 检索在智能代码补全方法研究中提出新模型、新算法, 或为代码补全方法提供实证研究支持的文献.本文分3步并根据上述原则在文献库中进行检索和选取.
(1) 本综述选用ACM电子文献数据库、IEEE Xplore电子文献数据库、Springer Link电子文献数据库、中国知网搜索引擎及Google学术搜索引擎等进行原始搜索.论文检索的关键字包括code completion、intelligent completion、api completion等.同时, 在标题、摘要、关键词和索引中进行检索.
(2) 本综述依据中国计算机学会(CCF)推荐国际学术会议和期刊列表中软件工程和人工智能领域分布中进行文献检索, 有TOSEM、TSE、EMSE、JSS、ICSE、FSE/ESEC、ASE、MSR等, 搜索时间从2004年开始.
(3) 为避免遗漏相关研究, 在之前两步搜索的基础上, 根据每篇文献的参考文献列表进行寻找与代码补全问题相关的研究文献, 并添加到相关文献中.
基于上述选取原则和检索步骤, 本文选取56篇文献作为综述总结的相关文献.在这些文献中, 提出了智能代码补全方法的新理论、新算法的直接相关文献有28篇; 为智能代码补全方法提供理论支持, 如代码表征方式和源代码语言模型的部分相关文献有8篇; 其他为智能代码补全的背景动机、评估方法提供实证研究支持的部分相关文献有9篇.上述文献分布情况在
2004年~2018年发表论文统计
Statistics of the papers published in 2004~2018
从总体趋势来看, 从2004年开始, 每年都有智能代码补全方法相关研究出现, 并且每年数量总体呈上升趋势; 从期刊和会议主题来看, 智能代码补全方法的研究主要集中在软件工程领域, 人工智能领域也有4篇论文.
本文第1节介绍代码补全方法的相关概念与研究概况.第2节介绍代码补全方法中的代码表征方式, 将已有工作划分为两类研究思路.第3节介绍代码补全方法的模型验证方法和评估指标.第4节指出智能代码补全方法的主要挑战.第5节讨论智能代码补全方法未来研究方向.第6节对本文进行总结.
为了便于论文阐述, 将智能代码补全相关概念陈述如下.
(1) 标识符(token):标识符是源代码编译过程中的最小单位, 包括关键词、函数名、变量名、运算符等.
(2) 代码片段(code snippet):代码片段是一小段的源代码, 它包含一些功能性的语句, 例如类声明、函数声明, 也可以是一个有起止标识符的代码块.
(3) 输入前缀:开发人员已经键入的若干字符, 用于限定当前位置的完整标识符, 缩小可能的补全结果.开发人员可以直接从空白获取完整代码片段, 如直接补全以默认参数填充的完整模板.
(4) 代码补全:基于开发人员的输入前缀和代码片段, 预测待补全代码片段中的类名、方法名和代码片段等, 并为开发人员提供建议列表.
根据待补全对象, 代码补全主要可以分为标识符补全、代码片段补全和关键词/缩略词补全.
(1) 标识符补全
根据输入前缀, 对不完整的标识符进行补全, 补全对象包括方法名、变量名、参数名等, 如
Visual Studio补全插件的标识符补全示例
Example of token completion in the completion plug-in of Visual Studio
标识符补全中有一种使用频率高的补全方式是API方法调用补全, 即在类名后输入“.”调用方法或变量, 并补全以默认参数填充的完整模板, 如
Visual Studio补全插件的API方法调用补全示例
Example of API method call completion in the completion plug-in of Visual Studio
(2) 代码片段补全
在一些代码补全工具, 如SLANG[
带有空缺的代码片段和补全后的代码片段
Code snippet with vacancies, and completed code snippet
(3) 关键词/缩略词补全
输入简短的、未预定义的短语或缩略词, 补全为完整的函数和参数.这种补全方式是由Little等人在2007年提出的关键词编程[
带有关键词的代码片段和补全后的代码片段
Code snippet with keywords, and completed code snippet
Han等人在2009年提出了缩略词补全[
缩略词补全示例
Example of abbreviation completion
代码补全问题可以归结为预测标识符(token)的问题.传统的代码补全方法基于已输入的代码和语法规则进行补全, 需要制定许多启发式规则进行判别.随着方法和参数的版本迭代更新, 这些规则就会落后甚至失效.推荐列表按字母排序, 增加了开发人员的额外键入和选择时间.
鉴于这些问题, 研究者将判别和推荐的任务交给计算机, 让计算机在已有代码中学习规律, 与待补全位置匹配, 推荐相似度高的补全建议, 即智能代码补全.在智能代码补全中, 研究者们对代码表征方式进行更深入的研究[
不同于从源代码进一步挖掘额外信息, 另一部分研究者们尝试通过其他角度理解代码.该方向一个标志性研究成果是2012年Hindle等人假设编程语言是自然语言的一种, 它具有可重复并带有可预测的统计学规律. Hindle等人通过自然语言中常用的概率模型
用神经网络训练统计语言模型是由Bengio提出[
同样地, 深度学习作为神经网络的热门研究方向, 也在代码补全领域得到了应用.胡星等人[
近年来, 代码补全方法的实用性也受到一些研究者的质疑, 实证研究[
智能代码补全方法在补全方式、语言模型和评估方法存在很大差异, 但是基本框架和主要流程相似.智能补全方法的目的在于让计算机读懂源代码(即提取源代码特征)、学习如何寻找补全内容(即模型学习和相似比较), 将补全内容与待补全位置进行匹配(即结果过滤整合), 最后给出相应的补全建议(即结果呈现).
智能代码补全的一般过程
General process of intelligent code completion
● 首先让计算机读懂代码, 需要将隐含在源代码纯文本中的特征进行提取和表征, 即代码表征环节, 这是对源代码的第一步处理, 也是最重要的步骤之一.代码表征方法是对代码进行信息提取和结构化表示的方法, 对源代码特征提取和表征的不同层次、不同方式, 直接决定了后续的模型构建和相似比较.代码表征环节将源代码转化为可比较的结构化信息, 如提取源代码的抽象语法树(abstract syntax tree, 简称AST)或程序依赖图, 或者为源代码建立统计语言模型, 都是对源代码的不同表征方式.
● 然后在模型学习和相似比较环节, 计算机通过学习代码语料库中的代码特征, 对比补全位置的上下文代码和其他代码片段, 预测并推荐相似度高的代码片段.不同的代码表征方式往往会采用不同的相似度和比较算法, 如标识符序列会采用向量空间距离、抽象语法树会采用树匹配技术等.
● 在补全结果过滤整合环节, 智能代码补全方法会根据类型定义和语法规则, 对补全结果进行过滤筛选整合去重, 过滤掉不符合语法规则的补全结果.
● 最后在代码补全结果呈现环节, 会将上述环节得到的最终推荐结果以适宜的方式返回给开发人员进行选用, 如弹出候选窗口供开发人员通过键盘选取.
模型验证方法是指通过科学的方法对数据集进一步划分, 一部分作为训练集用于模型学习, 另一部分作为测试集用于性能评估.在智能代码补全方法研究中, 经常采用的模型验证方法是
为了衡量补全方法的性能, 并且由于补全方法会推荐最有可能的
平均倒数排名MRR被广泛用于信息检索和推荐系统的性能评估, 是针对返回有序的推荐列表算法的标准衡量指标, 核心思想是:以第1个正确答案的位置作为衡量标准, 计算方式为对于一次补全推荐, 如果正确答案首次出现在列表中的排名为
准确率(
精确率(
召回率(
研究者们在评估时也会指定推荐列表长度
补全时间是指代码补全方法给出推荐列表的时间, 一般计算测试数据上的平均补全时间.Jin等人的实证研究指出[
对于上述的单一指标, 有研究者为补全任务提出一个结合前缀长度、排名和补全时间的综合评估指标[
其中,
对代码的表征方式, 决定了代码的表征方式和特定代码特征的抽取, 以及待补全代码和代码语料库的处理方式, 和上下文之间相似度的比较方式, 从而影响补全性能.本文根据智能代码补全方法的一般过程, 从代码表征的视角对现有的智能代码补全方法进行分类.根据对代码信息的利用和特征提取的不同形式, 智能代码补全方法可以分为基于编程语言表征和基于统计语言表征两个方向.在本文中, 编程语言指高级语言, 基于编程语言表征指对高级语言的文本进行建模的研究方向; 统计语言指可以利用统计方法处理的自然语言[
本文深入调研了代码补全方法的发展历程, 发现对代码表征的程度从浅显到深入, 提取到的结构和语义信息从单一到多元.本文根据不同的代码表征方式, 将总结不同研究思路及各自研究成果, 并对部分基础模型提供了理论阐述, 指出每个方向的优缺点, 为未来的研究提供参考.本文将各个研究方向的优缺点总结在
不同智能代码补全方法的优缺点
Advantages and disadvantages of different intelligent code completion approaches
研究方向 | 优点 | 缺点 |
标识符序列 | 模型简洁, 补全类型多 | 性能一般 |
抽象语法树 | 不同编程语言通用性好 | 需要额外的语法树抽取 |
控制/数据流 | 结构/上下文信息丰富 | 模型复杂 |
灵活性强, 可扩展性高 | 只能提取一定范围内信息 | |
神经网络 | 长距离信息提取能力 | 训练时间长, 存储开销大 |
基于编程语言表征的研究通过对代码的静态或动态分析, 利用词法分析、语法分析、控制/数据流分析等技术, 提取代码特征.由于对编程语言信息的提取程度不同, 本文将基于编程语言表征的智能代码补全方法又分出标识符序列、抽象语法树语法和词汇控制/数据流图这3个层次进行详细阐述.
基于标识符序列表征的代码补全技术将源代码表征为标识符序列或者根据序列特征提取特征矩阵, 通过特征向量距离或特征矩阵的最近邻匹配进行相似度比较.
基于词汇表征的智能代码补全方法的代表文献总结
Summary of representative literature on token-based intelligent code completion approaches
文献 | 代码表征 | 相似比较算法 | 评估指标 | 补全方式 |
Little等人[ |
自定义的三元组 | 自定义的解释向量 | 准确率和补全时间 | 关键词补全 |
Han等人[ |
标识符序列 | 维特比算法 | 准确率 | 缩略词补全 |
Perelman等人[ |
自定义的部分表达式 | 特征向量 | 排名和补全时间 | 标识符补全 |
Bruch等人[ |
特征矩阵 | 最近邻匹配BMN | 准确率、召回率和 |
标识符补全 |
Proksch等人[ |
特征矩阵 | 基于模式的贝叶斯网络 | 标识符补全 |
Han等人提出了一种与关键词补全[
Perelman等人[
Bruch等人[
Proksch等人[
基于标识符序列表征的智能代码补全方法将源代码表征为标识符的序列, 利用了源代码的序列化特征, 模型简洁且补全类型广泛, 但是对于信息利用仍然欠缺, 无法利用更深层次的信息.
基于抽象语法树表征的智能代码补全方法能够对源代码中的语法规则和结构信息进行提取和利用.基于抽象语法树的方法使用语法分析器提取语法特征, 利用抽象语法树进行表示, 将待补全代码视作语法树的缺失结点, 将树形结构作为代码特征进行匹配.抽象语法树是一种将语法结构抽象为树形的代码表示方法.
基于抽象语法树表征的智能代码补全方法的代表文献总结
Summary of representative literature on AST-based intelligent code completion approaches
文献 | 代码表征 | 相似比较算法 | 评估指标 | 补全方式 |
Holmes等人[ |
抽象语法树 | 启发式规则匹配 | 准确率 | 标识符补全 |
Robbes等人[ |
含修改历史的抽象语法树 | 频繁项集 | 综合评估指标 | 标识符补全 |
Zhong等人[ |
残缺的抽象语法树 | 特征向量 | 准确率 | 标识符补全 |
Bajaj等人[ |
DOM结构抽象语法树 | 动态模式匹配 | 准确率 | 标识符补全 |
Bielik等人[ |
抽象语法树 | 自定义规则匹配 | 错误率 | 标识符补全 |
Raychev等人[ |
抽象语法树 | 决策树生成 | 准确率 | 标识符补全 |
Holmes等人[
Robbes等人[
Zhong等人[
Bajaj等人[
Bielik等人提出了PHOG[
Raychev等人提出了TGEN[
抽象语法树是最常见的基于语法的代码表征方式之一, 研究也相对较多.基于抽象语法树表征的代码补全方法可以利用语法结构特征, 比标识符序列表征深入.基于抽象语法树表征的模型移植性较好, 可以在其他语言的抽象语法树上进行补全.代码特征信息的增多, 也造成抽象语法树的遍历和操作往往需要较大的计算开销, 导致很难动态更新待补全代码的语法结构, 并且在获得特定指标时需要额外工具来获得.
抽象语法树虽然可以抽象出编程语言的语法结构, 但是对于项目代码来说, 特殊意义的变量命名反映代码功能的信息被丢失, 基于控制/数据流图表征的智能代码补全方法在抽象语法树的基础上, 结合了代码的部分控制/数据流信息, 在代码补全任务中得以应用.
基于控制/数据流图表征的智能代码补全方法的代表文献总结
Summary of representative literature on control/data-flow-graph-based intelligence code completion approaches
文献 | 代码表征 | 相似比较算法 | 评估指标 | 补全方式 |
Nguyen等人[ |
抽象语法树加上API调用序列 | 特征向量 | 准确率 | 代码片段补全 |
Li等人[ |
抽象语法树加上数据流 | 特征向量 | 准确率 | 标识符补全 |
Nguyen等人提出了GraPacc[
Li等人[
基于控制/数据流图的表征方式充分利用编程语言和源代码中的语义信息, 但是实现难度也更大, 尚没有能够完全提取源代码中的语义信息的表征方式, 已有的研究往往是选取一定程度的语义信息进行建模.由于语义信息复杂, 计算开销大, 基于控制/数据流图的智能代码补全方法无法全部利用, 性能上并不一定优于基于语法的智能代码补全方法.
不同于基于编程语言表征的研究尝试去明确地提取代码中的结构和语义信息, 基于统计语言表征的研究利用自然语言中的统计语言模型对代码进行表征.2010年, 通过对SourceForge上6 000多个项目中包含的4亿多行代码的分析, Gabel等人[
本节将对基于统计语言表征的智能代码补全研究进行总结.下面先简要介绍相关概念和理论.
(1) 统计语言模型(statistical language model)
一个语言模型为句子
依据统计语言模型上述定义, 问题归结为计算公式(7)等号右边各项的值.公式(7)看似简单, 但存在两个问题:首先是自由参数过多, 假设上面句子中的所有单词都来自大小为
(2)
研究者们假设语料库中每个词出现的概率只与前面的
根据定义, 当
(3) 平滑方法
研究者们又通过对语料库中的序列概率重新分配来解决数据稀疏, 这种做法称为数据平滑(smoothing).最简单的平滑方法是加一平滑(即拉普拉斯平滑), 默认每一个词组都出现1次, 这样就避免了某一词组没有出现, 导致频次和涉及到的词对条件概率为0的情况, 可以有效地缓解数据稀疏性.平滑方法还有古德-图灵平滑Witten-Bell平滑等算法.
(4) 语言模型的评估指标
研究者们使用测试数据上的性能指标如精度、召回率等评价算法的优劣.但评价语言模型的好坏, 需要用到信息论中熵的概念.交叉熵是衡量模型的估计结果与实际情况的差异的一种指标, 其值越小, 说明模型与真实概率分布之间的偏差就越小, 也即模型越好.对于一个语言模型
又由公式(7)和公式(8)可得:
基于
基于
Summary of representative literature on
文献 | 统计模型 | 评估指标 | 补全方式 |
Hindle等人[ |
准确率 | 标识符补全 | |
Raychev等人[ |
准确率 | 代码片段补全 | |
Nguyen等人[ |
结合语义信息的 |
准确率 | 标识符补全 |
Tu等人[ |
“缓存” |
MRR和准确率 | 标识符补全 |
Franks等人[ |
“缓存” |
MRR | 标识符补全 |
Nguyen等人[ |
结合结构信息的 |
准确率 | API方法调用补全 |
Roos等人[ |
基于定向搜索的 |
精确率 | API方法调用补全 |
Nguyen等人[ |
结合细粒度代码更改的 |
准确率 | API方法调用补全 |
Allamanis等人[
Nguyen等人针对
Tu等人[
Raychev等人提出了SLANG[
Franks等人开发了名为CACHECA[
Nguyen等人针对
Bettenburg等人[
Roos同样使用
Nguyen等人针对API调用补全存在不同开源项目存在特定的API使用模式, 统计语言模型从全部项目中学习存在噪音的问题, 提出了APIREC[
基于统计语言模型表征的智能代码补全方法通过对
循环神经网络(recurrent neural network, 简称RNN)是Bengio在2001年提出[
循环神经网络结构
Stucture of recurrent neural network
循环神经网络会记录上一个隐藏层的输出, 联合当前层输入计算隐藏层, 给出当前层输出.隐藏层不断在计算中被使用和更新, 使得每一层的输出都是由之前的序列和当前的输入共同决定的.这样的循环结构使循环神经网络不再仅从定长的前序序列中提取信息, 而是真正充分利用所有的上文信息进行预测.但RNN在实际应用中存在梯度消失(vanishing gradient)问题[
基于神经网络模型表征方式的智能代码补全方法主要采用改进的RNN模型, 包括指针网络、LSTM和门控网络等.
基于神经网络模型表征的智能代码补全方法的代表文献总结
Summary of representative literature on neural-network-based intelligence code completion approaches
文献 | 统计模型 | 评估指标 | 补全方式 |
Bhoopchand[ |
指针网络 | 准确率 | 标识符补全 |
Hellendoorn等人[ |
优化的“缓存” |
标识符补全 | |
Allamanis等人[ |
门控图神经网络 | 变量名补全 |
Bhoopchand等人[
Hellendoorn等人[
Allamanis等人[
研究者们在代码元素的重复性和局部性进行了许多研究, 大多将统计语言模型应用在API方法调用补全上, 有工作[
关于智能代码补全方法的研究在10余年中已经取得了一定的成果, 并且在实际开发中得到应用和实践, 但仍然面临以下挑战.
(1) 缺乏统一的模型性能评估指标:在上文中对现有的智能代码补全方法的评估指标进行了整理, 最常用的是机器学习领域使用的准确率、召回率和信息检索领域使用的平均倒数排名, 但是大部分文献都只采用其中一个指标进行性能评估, 采用不同评估指标的模型难以互相换算性能指标, 也难以进行性能比较.
(2) 缺乏能够有效衡量补全性能的真实基准语料库和数据集:性能评估指标在很大程度上取决于语料库和测试集, 目前智能代码补全方法采用的语料库大多是研究者在开源代码仓库中用爬虫抓取的个人数据集, 也有少部分研究者公开的数据集[
(3) 智能代码补全方法在代码表征和模型构建上有不同方向且各有所短:实证研究[
智能代码补全方法的研究工作面临上一节提到的一些挑战, 为了应对这些挑战, 本节从场景需求和模型构建角度讨论了智能代码补全方法未来可能的研究方向.
(1) 需要进一步挖掘真实补全场景:研究结果[
(2) 模型的复杂不能代表性能的优越, 模型构建需要针对代码补全任务的特殊性进一步研究:代码补全方法正在从单标识符补全转变为代码块的多标识符补全, 随着卷积神经网络[
智能代码补全作为开发人员在集成开发环境中常用辅助工具, 对软件开发效率有着极为重要的影响.学术界对代码补全方法的研究有超过10年的历史, 很少有综述类文章总结代码补全方法研究进展和成果.本文从代码表征方式的角度梳理归纳了智能代码补全研究的两种研究思路, 总结讨论了当前智能代码补全方法面临的关键问题及未来发展趋势.主要工作总结如下:(1)本文从代码表征方式的角度出发, 对现有的智能代码补全方法进行了归纳总结, 将智能代码补全方法的研究思路分为基于编程语言表征和基于统计语言表征两大类;(2) 本文介绍了在智能代码补全方法中常用的实验验证方法, 并总结了代码补全评估指标和计算公式; (3)本文指出了目前智能代码补全方法研究的仍面临的主要挑战, 并围绕挑战展望了智能代码补全方法的未来发展和研究方向.
Lo D, Xia X. Fusion fault localizers. In: Proc. of the 29th ACM/IEEE Int'l Conf. on Automated Software Engineering. ACM, 2014. 127-138.
Xia X, Lo D, Pan SJ, Nagappan N, Wang X. Hydra: Massively compositional model for cross-project defect prediction. IEEE Trans. on Software Engineering, 2016, 42(10):977-998.
Le Goues C, Nguyen T, Forrest S, Weimer W. Genprog: A generic method for automatic software repair. IEEE Trans. on Software Engineering, 2011, 38(1):54-72.
Xiong Y, Liu X, Zeng M, Zhang L, Huang G. Identifying patch correctness in test-based program repair. In: Proc. of the 40th Int'l Conf. on Software Engineering. ACM, 2018. 789-799.
Bellamy B, Avgustinov P, De Moor O, Sereni D. Efficient local type inference. ACM SIGPLAN Notices, 2008, 43(10):475-492.
Pierce BC, Turner DN. Local type inference. ACM Trans. on Programming Languages and Systems (TOPLAS), 2000, 22(1):1-44.
Huang Q, Xia X, Xing Z, Lo D, Wang X. API method recommendation without worrying about the task-API knowledge gap. In: Proc. of the 33rd ACM/IEEE Int'l Conf. on Automated Software Engineering. ACM, 2018. 293-304.
Nguyen P, Di Rocco J, Ruscio D, Ochoa L, Degueule T, Di Penta M. Focus: A recommender system for mining api function calls and usage patterns. In: Proc. of the 41st ACM/IEEE Int'l Conf. on Software Engineering (ICSE). 2019.
Hill R, Rideout J. Automatic method completion. In: Proc. of the 19th IEEE Int'l Conf. on Automated Software Engineering. IEEE Computer Society, 2004. 228-235.
Asaduzzaman M, Roy CK, Schneider KA, Hou D. Cscc: Simple, efficient, context sensitive code completion. In: Proc. of the 2014 IEEE Int'l Conf. on Software Maintenance and Evolution. IEEE, 2014. 71-80.
Bruch M, Monperrus M, Mezini M. Learning from examples to improve code completion systems. In: Proc. of the 7th Joint Meeting of the European Software Engineering Conf. and the ACM SIGSOFT Symp. on the Foundations of Software Engineering. ACM, 2009. 213-222.
Roos P. Fast and precise statistical code completion. In: Proc. of the 37th Int'l Conf. on Software Engineering, Vol.2. IEEE, 2015. 757-759.
Li J, Wang Y, Lyu MR, King I. Code completion with neural attention and pointer networks. arXiv preprint arXiv: 1711.09573, 2017.
Raychev V, Vechev M, Yahav E. Code completion with statistical language models. ACM SIGPLAN Notices, 2014, 49(6):419-428.
Murphy GC, Kersten M, Findlater L. How are Java software developers using the elipse ide? IEEE Software, 2006, 23(4):76-83.
https://www.saildart.org/allow/SPELL.REG%5bUP,DOC%5d]]>
Pletcher DM, Hou D. BCC: Enhancing code completion for better API usability. In: Proc. of the 2009 IEEE Int'l Conf. on Software Maintenance. IEEE, 2009. 393-394.
Hou D, Pletcher DM. An evaluation of the strategies of sorting, filtering, and grouping API methods for code completion. In: Proc. of the 2011 27th IEEE Int'l Conf. on Software Maintenance (ICSM). IEEE, 2011. 233-242.
Robbes R, Lanza M. How program history can improve code completion. In: Proc. of the 2008 23rd IEEE/ACM Int'l Conf. on Automated Software Engineering. IEEE Computer Society, 2008. 317-326.
Proksch S, Lerch J, Mezini M. Intelligent code completion with Bayesian networks. ACM Trans. on Software Engineering and Methodology (TOSEM), 2015, 25(1):1-31.
Hindle A, Barr ET, Su Z, Gabel M, Devanbu P. On the naturalness of software. In: Proc. of the 2012 34th Int'l Conf. on Software Engineering (ICSE). IEEE, 2012. 837-847.
Bielik P, Raychev V, Vechev M. PHOG: Probabilistic model for code. In: Proc. of the Int'l Conf. on Machine Learning. 2016. 2933-2942.
Lee YY, Harwell S, Khurshid S, Marinov D. Temporal code completion and navigation. In: Proc. of the 2013 Int'l Conf. on Software Engineering. IEEE, 2013. 1181-1184.
Nguyen AT, Nguyen HA, Nguyen TT, Nguyen TN. GraPacc: A graph-based pattern-oriented, context-sensitive code completion tool. In: Proc. of the 2012 34th Int'l Conf. on Software Engineering (ICSE). IEEE, 2012. 1407-1410.
Omori T, Kuwabara H, Maruyama K. A study on repetitiveness of code completion operations. In: Proc. of the 2012 28th IEEE Int'l Conf. on Software Maintenance (ICSM). IEEE, 2012. 584-587.
Jin X, Servant F. The hidden cost of code completion: Understanding the impact of the recommendation-list length on its efficiency. In: Proc. of the 2018 IEEE/ACM 15th Int'l Conf. on Mining Software Repositories (MSR). IEEE, 2018. 70-73.
Tu Z, Su Z, Devanbu P. On the localness of software. In: Proc. of the 22nd ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. ACM, 2014. 269-280.
Zhong H, Wang X. Boosting complete-code tool for partial program. In: Proc. of the 32nd IEEE/ACM Int'l Conf. on Automated Software Engineering. IEEE, 2017. 671-681.
White M, Vendome C, Linares-Vásquez M, Poshyvanyk D. Toward deep learning software repositories. In: Proc. of the 12th Working Conf. on Mining Software Repositories. IEEE, 2015. 334-345.
Nguyen TT, Nguyen AT, Nguyen HA, Nguyen TN. A statistical semantic language model for source code. In: Proc. of the 2013 9th Joint Meeting on Foundations of Software Engineering. ACM, 2013. 532-542.
de Souza Amorim LE, Erdweg S, Wachsmuth G, Visser E. Principled syntactic code completion using placeholders. In: Proc. of the 2016 ACM SIGPLAN Int'l Conf. on Software Language Engineering. ACM, 2016. 163-175.
Hou D, Pletcher DM. Towards a better code completion system by API grouping, filtering, and popularity-based ranking. In: Proc. of the 2nd Int'l Workshop on Recommendation Systems for Software Engineering. ACM, 2010. 26-30.
Jacobellis J, Meng N, Kim M. Cookbook: In Situ code completion using edit recipes learned from examples. In: Companion Proc. of the 36th Int'l Conf. on Software Engineering. ACM, 2014. 584-587.
Bhoopchand A, Rocktäschel T, Barr E, Riedel S. Learning python code suggestion with a sparse pointer network. arXiv preprint arXiv: 1611.08307, 2016.
Nguyen TT, Pham HV, Vu PM, Nguyen TT. Recommending API usages for mobile apps with hidden Markov model. In: Proc. of the 2015 30th IEEE/ACM Int'l Conf. on Automated Software Engineering (ASE). IEEE, 2015. 795-800.
Gvero T, Kuncak V, Kuraj I, Piskac R. Complete completion using types and weights. ACM SIGPLAN Notices, 2013, 48(6):27-38.
Hellendoorn VJ, Proksch S, Gall HC, Bacchelli A. When code completion fails: A case study on real-world completions. In: Proc. of the 41st Int'l Conf. on Software Engineering. Piscataway: IEEE, 2019. 960-970.
Little G, Miller RC. Keyword programming in Java. Automated Software Engineering, 2009, 16(1):37-71.
Han S, Wallace DR, Miller RC. Code completion from abbreviated input. In: Proc. of the 2009 IEEE/ACM Int'l Conf. on Automated Software Engineering. IEEE, 2009. 332-343.
Han S, Wallace DR, Miller RC. Code completion of multiple keywords from abbreviated input. Automated Software Engineering, 2011, 18(3-4):363-398.
https://github.com/]]>
Bettenburg N, Nagappan M, Hassan AE. Towards improving statistical modeling of software engineering data: Think locally, act globally! Empirical Software Engineering, 2015, 20(2):294-335.
Nguyen AT, Hilton M, Codoban M, Nguyen HA, Mast L, Rademacher E, Nguyen TN, Dig D. API code recommendation using statistical learning from fine-grained changes. In: Proc. of the 2016 24th ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. ACM, 2016. 511-522.
Arora C, Sabetzadeh M, Briand L, Zimmer F. Automated checking of conformance to requirements templates using natural language processing. IEEE Trans. on Software Engineering, 2015, 41(10):944-968.
Falessi D, Cantone G, Canfora G. Empirical principles and an industrial case study in retrieving equivalent requirements via natural language processing techniques. IEEE Trans. on Software Engineering, 2011, 39(1):18-44.
Bengio Y, Ducharme R, Vincent P, Jauvin C. A neural probabilistic language model. Journal of Machine Learning Research, 2003, 3(6):1137-1155.
Mikolov T, Karafiát M, Burget L, Černockỳ J, Khudanpur S. Recurrent neural network based language model. In: Proc. of the 11th Annual Conf. of the Int'l Speech Communication Association. 2010.
Hu X, Li G, Liu F, Jin Z. Program generation and code completion techniques based on deep learning: Literature review. Ruan Jian Xue Bao/Journal of Software, 2019, 30(5):1206-1223(in Chinese with English abstract). http://www.jos.org.cn/1000-9825/5717.htm [doi: 10.13328/j.cnki.jos.005717]
胡星, 李戈, 刘芳, 金芝.基于深度学习的程序生成与补全技术研究进展.软件学报, 2019, 30(5):1206-1223. http://www.jos.org.cn/1000-9825/5717.htm [doi: 10.13328/j.cnki.jos.005717]
Zong CQ. Statistical Natural Language Processing. Beijing: Tsinghua University Press, 2013(in Chinese).
宗成庆.统计自然语言处理.北京:清华大学出版社, 2013.
Perelman D, Gulwani S, Ball T, Grossman D. Type-directed completion of partial expressions. ACM SIGPLAN Notices, 2012, 47(6):275-286.
Holmes R, Murphy GC. Using structural context to recommend source code examples. In: Proc. of the 27th Int'l Conf. on Software Engineering (ICSE 2005). IEEE, 2005. 117-125.
Bajaj K, Pattabiraman K, Mesbah A. Dompletion: Dom-aware Javascript code completion. In: Proc. of the 29th ACM/IEEE Int'l Conf. on Automated Software Engineering. ACM, 2014. 43-54.
Raychev V, Bielik P, Vechev M. Probabilistic model for code with decision trees. ACM SIGPLAN Notices, 2016, 51(10):731-747.
http://wala.sourceforge.net/wiki/index.php/Main_Page]]>
https://github.com/saltlab/dompletion]]>
Gabel M, Su Z. A study of the uniqueness of source code. In: Proc. of the 18th ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. ACM, 2010. 147-156.
Rabiner LR. A tutorial on hidden Markov models and selected applications in speech recognition. Proc. of the IEEE, 1989, 77(2): 257-286.
Brill E, Moore RC. An improved error model for noisy channel spelling correction. In: Proc. of the 38th Annual Meeting on Association for Computational Linguistics. Association for Computational Linguistics, 2000. 286-293.
Hinton GE, Revow M, Dayan P. Recognizing handwritten digits using mixtures of linear models. In: Proc. of the Advances in Neural Information Processing Systems. 1995. 1015-1022.
Papineni K, Roukos S, Ward T, Zhu WJ. BLEU: A method for automatic evaluation of machine translation. In: Proc. of the 40th Annual Meeting on Association for Computational Linguistics. Association for Computational Linguistics, 2002. 311-318.
Brown PF, Pietra VJD, Pietra SAD, Mercer RL. The mathematics of statistical machine translation: Parameter estimation. Computational Linguistics, 1993, 19(2):263-311.
Bahl LR, Jelinek F, Mercer RL. A maximum likelihood approach to continuous speech recognition. IEEE Trans. on Pattern Analysis & Machine Intelligence, 1983, 5(2):179-190.
Franks C, Tu Z, Devanbu P, Hellendoorn V. Cacheca: A cache language model based code suggestion tool. In: Proc. of the 37th Int'l Conf. on Software Engineering, Vol.2. IEEE, 2015. 705-708.
Nguyen AT, Nguyen TN. Graph-based statistical language model for code. In: Proc. of the 2015 IEEE/ACM 37th IEEE Int'l Conf. on Software Engineering. IEEE, 2015. 858-868.
Allamanis M, Sutton C. Mining source code repositories at massive scale using language modeling. In: Proc. of the 10th Working Conf. on Mining Software Repositories. IEEE, 2013. 207-216.
Negara S, Codoban M, Dig D, Johnson RE. Mining fine-grained code changes to detect unknown change patterns. In: Proc. of the 36th Int'l Conf. on Software Engineering. ACM, 2014. 803-813.
Bengio Y, Simard P, Frasconi P. Learning long-term dependencies with gradient descent is difficult. IEEE Trans. on Neural Networks, 1994, 5(2):157-166.
Martens J, Sutskever I. Learning recurrent neural networks with hessian-free optimization. In: Proc. of the 28th Int'l Conf. on Machine Learning (ICML 2011). 2011. 1033-1040.
Sundermeyer M, Schlüter R, Ney H. LSTM neural networks for language modeling. In: Proc. of the 13th Annual Conf. of the Int'l Speech Communication Association. 2012.
Hellendoorn VJ, Devanbu P. Are deep neural networks the best choice for modeling source code? In: Proc. of the 2017 11th Joint Meeting on Foundations of Software Engineering. ACM, 2017. 763-773.
Allamanis M, Brockschmidt M, Khademi M. Learning to represent programs with graphs. arXiv preprint arXiv: 1711.00740, 2017.
Gu X, Zhang H, Zhang D, Kim S. Deep API learning. In: Proc. of the 2016 24th ACM SIGSOFT Int'l Symp. on Foundations of Software Engineering. ACM, 2016. 631-642.
Rahman M, Palani D, Rigby PC. Natural software revisited. In: Proc. of the 41st Int'l Conf. on Software Engineering. IEEE, 2019. 37-48.
Krizhevsky A, Sutskever I, Hinton GE. Imagenet classification with deep convolutional neural networks. In: Proc. of the Advances in Neural Information Processing Systems. 2012. 1097-1105.
Szegedy C, Liu W, Jia Y, Sermanet P, Reed S, Anguelov D, Erhan D, Vanhoucke V, Rabinovich A. Going deeper with convolutions. In: Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition. 2015. 1-9.
He K, Gkioxari G, Dollár P, Girshick R. Mask R-CNN. In: Proc. of the IEEE Int'l Conf. on Computer Vision. 2017. 2961-2969.
Ren S, He K, Girshick R, Sun J. Faster R-CNN: Towards real-time object detection with region proposal networks. In: Proc. of the Advances in Neural Information Processing Systems. 2015. 91-99.
Girshick R. Fast R-CNN. In: Proc. of the IEEE Int'l Conf. on Computer Vision. 2015. 1440-1448.
Collobert R, Weston J. A unified architecture for natural language processing: Deep neural networks with multitask learning. In: Proc. of the 25th Int'l Conf. on Machine Learning. ACM, 2008. 160-167.
Kim Y. Convolutional neural networks for sentence classification. arXiv preprint arXiv: 1408.5882, 2014.
Abdel-Hamid O, Mohamed A, Jiang H, Penn G. Applying convolutional neural networks concepts to hybrid NN-HMM model for speech recognition. In: Proc. of the 2012 IEEE Int'l Conf. on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2012. 4277-4280.
Xiong W, Wu L, Alleva F, Droppo J, Huang X, Stolcke A. The Microsoft 2017 conversational speech recognition system. In: Proc. of the 2018 IEEE Int'l Conf. on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2018. 5934-5938.
LeCun Y, Bengio Y, Hinton G. Deep learning. Nature, 2015, 521(7553):436-444.
Hu X, Li G, Xia X, Lo D, Jin Z. Deep code comment generation. In: Proc. of the 26th Conf. on Program Comprehension. ACM, 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. ACM, 2018. 373-384.