Retrieval-based neural source code summarization
Authors:
Open Access
- 27 June 2020
- conference paper
- Published by Association for Computing Machinery (ACM)
- p. 1385-1397
Abstract
Source code summarization aims to automatically generate concise summaries of source code in natural language texts, in order to help developers better understand and maintain source code. Traditional work generates a source code summary by utilizing information retrieval techniques, which select terms from original source code or adapt summaries of similar code snippets. Recent studies adopt Neural Machine Translation techniques and generate summaries from code snippets using encoder-decoder neural networks. The neural-based approaches prefer the high-frequency words in the corpus and have trouble with the low-frequency ones. In this paper, we propose a retrieval-based neural source code summarization approach where we enhance the neural model with the most similar code snippets retrieved from the training set. Our approach can take advantages of both neural and retrieval-based techniques. Specifically, we first train an attentional encoder-decoder model based on the code snippets and the summaries in the training set; Second, given one input code snippet for testing, we retrieve its two most similar code snippets in the training set from the aspects of syntax and semantics, respectively; Third, we encode the input and two retrieved code snippets, and predict the summary by fusing them during decoding. We conduct extensive experiments to evaluate our approach and the experimental results show that our proposed approach can improve the state-of-the-art methods.Keywords
Funding Information
- National Key Research and Development Program of China (2018YFB1004805)
- National Natural Science Foundation of China (61702024, 61932007, 61972013, 61421003)
- ARC DP (200102940)
This publication has 47 references indexed in Scilit:
- Suggesting accurate method and class names2015
- Improving automated source code summarization via an eye-tracking study of programmers2014
- A comparative study of TF*IDF, LSI and multi-words for text classificationExpert Systems with Applications, 2011
- Towards automatically generating summary comments for Java methods2010
- A study of the documentation essential to software maintenance2005
- A Survey of Documentation Practice within Corrective MaintenanceEmpirical Software Engineering, 2005
- CCFinder: a multilinguistic token-based code clone detection system for large scale source codeIEEE Transactions on Software Engineering, 2002
- NLTK2002
- Multilayer perceptron, fuzzy sets, and classificationIEEE Transactions on Neural Networks, 1992
- A vector space model for automatic indexingCommunications of the ACM, 1975