CSRS: Code Search with Relevance Matching and Semantic Matching

03/15/2022
by   Yi Cheng, et al.
0

Developers often search and reuse existing code snippets in the process of software development. Code search aims to retrieve relevant code snippets from a codebase according to natural language queries entered by the developer. Up to now, researchers have already proposed information retrieval (IR) based methods and deep learning (DL) based methods. The IR-based methods focus on keyword matching, that is to rank codes by relevance between queries and code snippets, while DL-based methods focus on capturing the semantic correlations. However, the existing methods do not consider capturing two matching signals simultaneously. Therefore, in this paper, we propose CSRS, a code search model with relevance matching and semantic matching. CSRS comprises (1) an embedding module containing convolution kernels of different sizes which can extract n-gram embeddings of queries and codes, (2) a relevance matching module that measures lexical matching signals, and (3) a co-attention based semantic matching module to capture the semantic correlation. We train and evaluate CSRS on a dataset with 18.22M and 10k code snippets. The experimental results demonstrate that CSRS achieves an MRR of 0.614, which outperforms two state-of-the-art models DeepCS and CARLCS-CNN by 33.77 respectively. In addition, we also conducted several experiments to prove the effectiveness of each component of CSRS.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
05/29/2020

Simplifying Deep-Learning-Based Model for Code Search

To accelerate software development, developers frequently search and reu...
research
07/10/2021

Is a Single Model Enough? MuCoS: A Multi-Model Ensemble Learning for Semantic Code Search

Recently, deep learning methods have become mainstream in code search si...
research
08/07/2020

PSCS: A Path-based Neural Model for Semantic Code Search

To obtain code snippets for reuse, programmers prefer to search for rela...
research
10/19/2020

COSEA: Convolutional Code Search with Layer-wise Attention

Semantic code search, which aims to retrieve code snippets relevant to a...
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
03/12/2021

Wireframe-Based UI Design Search Through Image Autoencoder

UI design is an integral part of software development. For many develope...
research
08/08/2022

CSSAM:Code Search via Attention Matching of Code Semantics and Structures

Despite the continuous efforts in improving both the effectiveness and e...

Please sign up or login with your details

Forgot password? Click here to reset