Embedding API Dependency Graph for Neural Code Generation

03/29/2021
by   Chen Lyu, et al.
0

The problem of code generation from textual program descriptions has long been viewed as a grand challenge in software engineering. In recent years, many deep learning based approaches have been proposed, which can generate a sequence of code from a sequence of textual program description. However, the existing approaches ignore the global relationships among API methods, which are important for understanding the usage of APIs. In this paper, we propose to model the dependencies among API methods as an API dependency graph (ADG) and incorporate the graph embedding into a sequence-to-sequence (Seq2Seq) model. In addition to the existing encoder-decoder structure, a new module named “embedder" is introduced. In this way, the decoder can utilize both global structural dependencies and textual program description to predict the target code. We conduct extensive code generation experiments on three public datasets and in two programming languages (Python and Java). Our proposed approach, called ADG-Seq2Seq, yields significant improvements over existing state-of-the-art methods and maintains its performance as the length of the target code increases. Extensive ablation tests show that the proposed ADG embedding is effective and outperforms the baselines.

READ FULL TEXT

page 26

page 42

research
10/15/2020

Holistic Combination of Structural and Textual Code Information for Context based API Recommendation

Context based API recommendation is an important way to help developers ...
research
05/27/2016

Deep API Learning

Developers often wonder how to implement a certain functionality (e.g., ...
research
03/10/2021

Unified Pre-training for Program Understanding and Generation

Code summarization and generation empower conversion between programming...
research
09/30/2019

Structural Language Models for Any-Code Generation

We address the problem of Any-Code Generation (AnyGen) - generating code...
research
04/25/2017

DeepAM: Migrate APIs with Multi-modal Sequence to Sequence Learning

Computer programs written in one language are often required to be porte...
research
03/15/2021

Embedding Code Contexts for Cryptographic API Suggestion:New Methodologies and Comparisons

Despite recent research efforts, the vision of automatic code generation...
research
05/03/2022

Deep API Learning Revisited

Understanding the correct API usage sequences is one of the most importa...

Please sign up or login with your details

Forgot password? Click here to reset