Code Completion with Neural Attention and Pointer Networks

  • 2018-05-14 15:04:18
  • Jian Li, Yue Wang, Michael R. Lyu, Irwin King
  • 0

Abstract

Intelligent code completion has become an essential research task toaccelerate modern software development. To facilitate effective code completionfor dynamically-typed programming languages, we apply neural language models bylearning from large codebases, and develop a tailored attention mechanism forcode completion. However, standard neural language models even with attentionmechanism cannot correctly predict the out-of-vocabulary (OoV) words thatrestrict the code completion performance. In this paper, inspired by theprevalence of locally repeated terms in program source code, and the recentlyproposed pointer copy mechanism, we propose a pointer mixture network forbetter predicting OoV words in code completion. Based on the context, thepointer mixture network learns to either generate a within-vocabulary wordthrough an RNN component, or regenerate an OoV word from local context througha pointer component. Experiments on two benchmarked datasets demonstrate theeffectiveness of our attention mechanism and pointer mixture network on thecode completion task.

 

Quick Read (beta)

loading the full paper ...