Combining Contexts from Multiple Sources for Documentation-Specific Code Example Generation

03/25/2023
by   Junaed Younus Khan, et al.
0

Code example is a crucial part of good documentation. It helps the developers to understand the documentation easily and use the corresponding code unit (e.g., method) properly. However, many official documentation still lacks (good) code example and it is one of the common documentation issues as found by several studies. Hence in this paper, we consider automatic code example generation for documentation, a direction less explored by the existing research. We employ Codex, a GPT-3 based model, pre-trained on both natural and programming languages to generate code examples from source code and documentation given as input. Our preliminary investigation on 40 scikit-learn methods reveals that this approach is able to generate good code examples where 72.5 properly dealt with the target method and documentation (relevance). We also find that incorporation of error logs (produced by the compiler while executing a failed code example) in the input further improves the passability from 72.5 to 87.5 example generation and warrants in-depth future studies.

READ FULL TEXT
research
09/06/2022

Automatic Code Documentation Generation Using GPT-3

Source code documentation is an important artifact for efficient softwar...
research
03/31/2023

Towards Enhancing In-Context Learning for Code Generation

In-context learning (ICL) with pre-trained language models (PTLMs) has s...
research
05/28/2019

Analyzing and Supporting Adaptation of Online Code Examples

Developers often resort to online Q&A forums such as Stack Overflow (SO)...
research
05/29/2021

CommitBERT: Commit Message Generation Using Pre-Trained Programming Language Model

Commit message is a document that summarizes source code changes in natu...
research
08/29/2018

Retrieval-Based Neural Code Generation

In models to generate program source code from natural language, represe...
research
02/04/2020

Code Duplication on Stack Overflow

Despite the unarguable importance of Stack Overflow (SO) for the daily w...
research
06/27/2022

BashExplainer: Retrieval-Augmented Bash Code Comment Generation based on Fine-tuned CodeBERT

Developers use shell commands for many tasks, such as file system manage...

Please sign up or login with your details

Forgot password? Click here to reset