Learning to Generate Code Comments from Class Hierarchies
release_5wp7tc3q2nfizau5qhnh4w7h2y
by
Jiyang Zhang, Sheena Panthaplackel, Pengyu Nie, Raymond J. Mooney, Junyi Jessy Li, Milos Gligoric
2021
Abstract
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.
In text/plain
format
Archived Files and Locations
application/pdf 397.7 kB
file_bjcfdahirzfv7ahtodoyc47qt4
|
arxiv.org (repository) web.archive.org (webarchive) |
2103.13426v2
access all versions, variants, and formats of this works (eg, pre-prints)