An Extractive-and-Abstractive Framework for Source Code Summarization

06/15/2022
by   Weisong Sun, et al.
0

(Source) Code summarization aims to automatically generate summaries/comments for a given code snippet in the form of natural language. Such summaries play a key role in helping developers understand and maintain source code. Existing code summarization techniques can be categorized into extractive methods and abstractive methods. The extractive methods extract a subset of important statements and keywords from the code snippet using retrieval techniques, and generate a summary that preserves factual details in important statements and keywords. However, such a subset may miss identifier or entity naming, and consequently, the naturalness of generated summary is usually poor. The abstractive methods can generate human-written-like summaries leveraging encoder-decoder models from the neural machine translation domain. The generated summaries however often miss important factual details. To generate human-written-like summaries with preserved factual details, we propose a novel extractive-and-abstractive framework. The extractive module in the framework performs a task of extractive code summarization, which takes in the code snippet and predicts important statements containing key factual details. The abstractive module in the framework performs a task of abstractive code summarization, which takes in the entire code snippet and important statements in parallel and generates a succinct and human-written-like natural language summary. We evaluate the effectiveness of our technique, called EACS, by conducting extensive experiments on three datasets involving six programming languages. Experimental results show that EACS significantly outperforms state-of-the-art techniques in terms of all three widely used metrics, including BLEU, METEOR, and ROUGH-L.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
08/26/2023

EditSum: A Retrieve-and-Edit Framework for Source Code Summarization

Existing studies show that code summaries help developers understand and...
research
05/24/2023

SAGA: Summarization-Guided Assert Statement Generation

Generating meaningful assert statements is one of the key challenges in ...
research
08/26/2021

Retrieval Augmented Code Generation and Summarization

Software developers write a lot of source code and documentation during ...
research
12/21/2019

Automatically Extracting Subroutine Summary Descriptions from Unstructured Comments

Summary descriptions of subroutines are short (usually one-sentence) nat...
research
07/15/2021

Neural Code Summarization: How Far Are We?

Source code summaries are important for the comprehension and maintenanc...
research
10/21/2022

Low-Resources Project-Specific Code Summarization

Code summarization generates brief natural language descriptions of sour...
research
11/12/2018

A Fine-Grained Approach for Automated Conversion of JUnit Assertions to English

Converting source or unit test code to English has been shown to improve...

Please sign up or login with your details

Forgot password? Click here to reset