arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1711.09573cs.CLcs.SE
收藏

基于神经注意力和指针网络的代码完成

Code Completion with Neural Attention and Pointer Networks

The Chinese University of Hong Kong(香港中文大学);Shenzhen Research Institute, The Chinese University of Hong Kong(香港中文大学深圳研究院)

Jian Li, Yue Wang, Michael R. Lyu, Irwin King

摘要:

智能代码完成已成为加速现代软件开发的重要研究课题。为了促进动态类型程序设计语言的有效代码完成,我们应用神经语言模型,从大型代码库中学习,并开发一个量身定制的注意力机制的代码完成。然而,标准的神经语言模型,即使与注意力机制不能正确地预测词汇表外(OoV)的话,限制了代码完成性能。在本文中,受程序源代码中局部重复项的流行以及最近提出的指针复制机制的启发,我们提出了一种指针混合网络,用于更好地预测代码完成中的OoV字。基于上下文,指针混合网络学习通过RNN组件生成词汇表内单词,或者通过指针组件从本地上下文重新生成OoV单词。在两个基准数据集上的实验证明了我们的注意力机制和指针混合网络在代码完成任务上的有效性。

英文摘要:

Intelligent code completion has become an essential research task to accelerate modern software development. To facilitate effective code completion for dynamically-typed programming languages, we apply neural language models by learning from large codebases, and develop a tailored attention mechanism for code completion. However, standard neural language models even with attention mechanism cannot correctly predict the out-of-vocabulary (OoV) words that restrict the code completion performance. In this paper, inspired by the prevalence of locally repeated terms in program source code, and the recently proposed pointer copy mechanism, we propose a pointer mixture network for better predicting OoV words in code completion. Based on the context, the pointer mixture network learns to either generate a within-vocabulary word through an RNN component, or regenerate an OoV word from local context through a pointer component. Experiments on two benchmarked datasets demonstrate the effectiveness of our attention mechanism and pointer mixture network on the code completion task.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑