DeepAI AI Chat
Log In Sign Up

Learning to Generate Code Comments from Class Hierarchies

by   Jiyang Zhang, et al.

Descriptive code comments are essential for supporting code comprehension and maintenance. We propose the task of automatically generating comments for overriding methods. We formulate a novel framework which accommodates the unique contextual and linguistic reasoning that is required for performing this task. Our approach features: (1) incorporating context from the class hierarchy; (2) conditioning on learned, latent representations of specificity to generate comments that capture the more specialized behavior of the overriding method; and (3) unlikelihood training to discourage predictions which do not conform to invariant characteristics of the comment corresponding to the overridden method. Our experiments show that the proposed approach is able to generate comments for overriding methods of higher quality compared to prevailing comment generation techniques.


page 1

page 2

page 3

page 4


A Survey of Automatic Generation of Source Code Comments: Algorithms and Techniques

As an integral part of source code files, code comments help improve pro...

Preprocessing Source Code Comments for Linguistic Models

Comments are an important part of the source code and are a primary sour...

Code Attention: Translating Code to Comments by Exploiting Domain Features

Appropriate comments of code snippets provide insight for code functiona...

API2Com: On the Improvement of Automatically Generated Code Comments Using API Documentations

Code comments can help in program comprehension and are considered as im...

Reply to the commentary "Be careful when assuming the obvious", by P. Alday

Here we respond to some comments by Alday concerning headedness in lingu...

APIContext2Com: Code Comment Generation by Incorporating Pre-Defined API Documentation

Code comments are significantly helpful in comprehending software progra...

Deep Learning to Detect Redundant Method Comments

Comments in software are critical for maintenance and reuse. But apart f...