TY - JOUR
T1 - LSTM-based argument recommendation for non-API methods
AU - Li, Guangjie
AU - Liu, Hui
AU - Li, Ge
AU - Shen, Sijie
AU - Tang, Hanlin
N1 - Publisher Copyright:
© 2020, Science China Press and Springer-Verlag GmbH Germany, part of Springer Nature.
PY - 2020/9/1
Y1 - 2020/9/1
N2 - Automatic code completion is one of the most useful features provided by advanced IDEs. Argument recommendation, as a special kind of code completion, is widely used as well. While existing approaches focus on argument recommendation for popular APIs, a large number of non-API invocations are requesting for accurate argument recommendation as well. To this end, we propose an LSTM-based approach to recommending non-API arguments instantly when method calls are typed in. With data collected from a large corpus of open-source applications, we train an LSTM neural network to recommend actual arguments based on identifiers of the invoked method, the corresponding formal parameter, and a list of syntactically correct candidate arguments. To feed these identifiers into the LSTM neural network, we convert them into fixed-length vectors by Paragraph Vector, an unsupervised neural network based learning algorithm. With the resulting LSTM neural network trained on sample applications, for a given call site we can predict which of the candidate arguments is more likely to be the correct one. We evaluate the proposed approach with tenfold validation on 85 open-source C applications. Results suggest that the proposed approach outperforms the state-of-the-art approaches in recommending non-API arguments. It improves the precision significantly from 71.46% to 83.37%.
AB - Automatic code completion is one of the most useful features provided by advanced IDEs. Argument recommendation, as a special kind of code completion, is widely used as well. While existing approaches focus on argument recommendation for popular APIs, a large number of non-API invocations are requesting for accurate argument recommendation as well. To this end, we propose an LSTM-based approach to recommending non-API arguments instantly when method calls are typed in. With data collected from a large corpus of open-source applications, we train an LSTM neural network to recommend actual arguments based on identifiers of the invoked method, the corresponding formal parameter, and a list of syntactically correct candidate arguments. To feed these identifiers into the LSTM neural network, we convert them into fixed-length vectors by Paragraph Vector, an unsupervised neural network based learning algorithm. With the resulting LSTM neural network trained on sample applications, for a given call site we can predict which of the candidate arguments is more likely to be the correct one. We evaluate the proposed approach with tenfold validation on 85 open-source C applications. Results suggest that the proposed approach outperforms the state-of-the-art approaches in recommending non-API arguments. It improves the precision significantly from 71.46% to 83.37%.
KW - LSTM
KW - argument recommendation
KW - deep learning
KW - non-API
UR - http://www.scopus.com/inward/record.url?scp=85089521056&partnerID=8YFLogxK
U2 - 10.1007/s11432-019-2830-8
DO - 10.1007/s11432-019-2830-8
M3 - Article
AN - SCOPUS:85089521056
SN - 1674-733X
VL - 63
JO - Science China Information Sciences
JF - Science China Information Sciences
IS - 9
M1 - 190101
ER -