Software Engineering and Methodology for Emerging Domains: 16th National Conference, NASAC 2017, Harbin, China, November 4–5, 2017, and 17th National Conference, NASAC 2018, Shenzhen, China, November 23–25, 2018, Revised Selected Papers

Phoebe Chen,A. Cuzzocrea,Xiaoyong Du,Orhun Kara,Ting Liu,K. Sivalingam,D. Ślęzak,T. Washio,Xiaokang Yang,Simone Diniz Junqueira Barbosa,Zhengrong Li,He Jiang,Ge Li,Minghui Zhou,Ming Li
DOI: https://doi.org/10.1007/978-981-15-0310-8
2019-01-01
Abstract:Comments play an important role in software developments. They can not only improve the readability and maintainability of source code, but also provide significant resource for software reuse. However, it is common that lots of code in software projects lacks of comments. Automatic comment generation is proposed to address this issue. In this paper, we present an end-to-end approach to generate comments for APIbased code snippets automatically. It takes API sequences as the core semantic representations of method-level API-based code snippets and generates comments from API sequences with sequence-to-sequence neural models. In our evaluation, we extract 217K pairs of code snippets and comments from Java projects to construct the dataset. Finally, our approach gains 36.48% BLEU-4 score and 9.90% accuracy on the test set. We also do case studies on generated comments, which presents that our approach generates reasonable and effective comments for API-based code snippets.
What problem does this paper attempt to address?