deGraphCS: Embedding Variable-based Flow Graph for Neural Code Search

03/24/2021
by   Chen Zeng, et al.
0

With the rapid increase in the amount of public code repositories, developers maintain a great desire to retrieve precise code snippets by using natural language. Despite existing deep learning based approaches(e.g., DeepCS and MMAN) have provided the end-to-end solutions (i.e., accepts natural language as queries and shows related code fragments retrieved directly from code corpus), the accuracy of code search in the large-scale repositories is still limited by the code representation (e.g., AST) and modeling (e.g., directly fusing the features in the attention stage). In this paper, we propose a novel learnable deep Graph for Code Search (calleddeGraphCS), to transfer source code into variable-based flow graphs based on the intermediate representation technique, which can model code semantics more precisely compared to process the code as text directly or use the syntactic tree representation. Furthermore, we propose a well-designed 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 C language, and reproduce several typical deep code search methods for comparison. Besides, we design a qualitative user study to verify the practical value of our approach. The experimental results have shown that deGraphCS can achieve state-of-the-art performances, and accurately retrieve code snippets satisfying the needs of the users.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
09/30/2019

Multi-Modal Attention Network Learning for Semantic Source Code Retrieval

Code retrieval techniques and tools have been playing a key role in faci...
research
03/29/2022

Accelerating Code Search with Deep Hashing and Code Classification

Code search is to search reusable code snippets from source code corpus ...
research
02/16/2022

Code Search based on Context-aware Code Translation

Code search is a widely used technique by developers during software dev...
research
10/01/2022

CodeDSI: Differentiable Code Search

Reimplementing solutions to previously solved software engineering probl...
research
11/01/2017

Learning to Represent Programs with Graphs

Learning tasks on source code (i.e., formal languages) have been conside...
research
08/13/2022

ULDGNN: A Fragmented UI Layer Detector Based on Graph Neural Networks

While some work attempt to generate front-end code intelligently from UI...
research
05/21/2023

Towards Tracing Code Provenance with Code Watermarking

Recent advances in large language models have raised wide concern in gen...

Please sign up or login with your details

Forgot password? Click here to reset