Developers often tend to search and reuse code snippets from large code repositories to improve their programming skills. To support code reuse, early code search models used information retrieval (IR) techniques to index a large corpus of code and then returned relevant code based on search statements. However, IR-based models can cause information loss due to keyword matching. To solve this problem, developers applied deep learning (DL) techniques to encode search models. However, these models either learn isolated representations of codes and queries or learn interdependent representations of codes and queries in a single way, which both limit the effectiveness of the models.
In this study, we propose a code search model MpaCS, which can interact from multiple perspectives to enable cross-language retrieval between code and query statements. MpaCS extracts code and query information from the code textual features (i.e., method name, and tokens), the code structural feature (i.e., abstract syntax tree), and the query feature (i.e., tokens). We first implement the alignment between code features and query features at the fragment level. Then we propose a context matching module to achieve a deeper interaction between the code and the query. Finally, we propose a new attention network to explore the maximum alignment relationship between code and query from another perspective. We evaluate the performance of MpaCS on two existing large-scale datasets with 69k and 105k code snippets, respectively. Experimental results show that MpaCS outperforms four state-of-the-art models DeepCS, UNIF, MPCAT and CARLCS-CNN.
Wed 7 DecDisplayed time zone: Osaka, Sapporo, Tokyo change
14:30 - 15:40 | |||
14:30 20mPaper | Toward a Better Alignment Between the Research and Practice of Code Search Engines Technical Track | ||
14:50 20mPaper | Multi-Perspective Alignment Mechanism for Code Search Technical Track | ||
15:10 20mPaper | Automated Generation of Bug Samples Based on Source Code Analysis Technical Track Tianming Zheng Shanghai Jiao Tong University, Zhixin Tong Shanghai Jiao Tong University, Yi-Ping You National Chiao Tung University, Yue Wu Shanghai Jiao Tong University |