Affiliation:
1. School of Computer, National University of Defense Technology, Changsha, China
2. College of Computer Science and Technology, Zhejiang University, Hangzhou, China
Abstract
With the rapid increase of public code repositories, developers maintain a great desire to retrieve precise code snippets by using natural language. Despite existing deep learning-based approaches that provide end-to-end solutions (i.e., accept natural language as queries and show related code fragments), the performance of code search in the large-scale repositories is still low in accuracy because of the code representation (e.g., AST) and modeling (e.g., directly fusing features in the attention stage).
In this paper, we propose a novel learnable
de
ep
G
raph for
C
ode
S
earch (called
deGraphCS
) to transfer source code into variable-based flow graphs based on an intermediate representation technique, which can model code semantics more precisely than directly processing the code as text or using the syntax tree representation. Furthermore, we propose a graph optimization mechanism to refine the code representation and apply an improved gated graph neural network to model variable-based flow graphs. To evaluate the effectiveness of
deGraphCS
, we collect a large-scale dataset from GitHub containing 41,152 code snippets written in the C language and reproduce several typical deep code search methods for comparison. The experimental results show that
deGraphCS
can achieve state-of-the-art performance and accurately retrieve code snippets satisfying the needs of the users.
Funder
National Key R&D Program of China
National Natural Science Foundation of China
Publisher
Association for Computing Machinery (ACM)
Reference71 articles.
1. Neural machine translation by jointly learning to align and translate;Bahdanau Dzmitry;arXiv preprint arXiv:1409.0473,2014
2. Sourcerer
3. Tal Ben-Nun, Alice Shoshana Jakobovits, and Torsten Hoefler. 2018. Neural code comprehension: A learnable representation of code semantics. In Advances in Neural Information Processing Systems 31, S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (Eds.). Curran Associates, Inc., 3585–3597. http://papers.nips.cc/paper/7617-neural-code-comprehension-a-learnable-representation-of-code-semantics.pdf.
4. Joel Brandt, Mira Dontcheva, Marcos Weskamp, and Scott R. Klemmer. 2010. Example-centric programming: Integrating web search into the development environment. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems. 513–522.
5. BIKER: a tool for Bi-information source based API method recommendation
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Survey of Code Search Based on Deep Learning;ACM Transactions on Software Engineering and Methodology;2023-12-23
2. KAPE:
k
NN-based Performance Testing for Deep Code Search;ACM Transactions on Software Engineering and Methodology;2023-12-21
3. Natural Language to Code: How Far Are We?;Proceedings of the 31st ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering;2023-11-30
4. Multi-intent Description of Keyword Expansion for Code Search;Communications in Computer and Information Science;2023-11-27
5. Towards Better Multilingual Code Search through Cross-Lingual Contrastive Learning;Proceedings of the 14th Asia-Pacific Symposium on Internetware;2023-08-04