Neural Networks2022,Vol.14511.DOI:10.1016/j.neunet.2021.09.025

Enriching query semantics for code search with reinforcement learning

Zeng J. Xing Z. Liu Y. Wang C. Nong Z. Gao C. Li Z.
Neural Networks2022,Vol.14511.DOI:10.1016/j.neunet.2021.09.025

Enriching query semantics for code search with reinforcement learning

Zeng J. 1Xing Z. 2Liu Y. 3Wang C. 4Nong Z. 4Gao C. 4Li Z.4
扫码查看

作者信息

  • 1. Department of Computer Science and Engineering The Chinese University of Hong Kong Hong Kong
  • 2. Research School of Computer Science Australian National University
  • 3. School of Computer Science and Engineering Nanyang Technology University
  • 4. School of Computer Science and Technology Harbin Institute of Technology
  • 折叠

Abstract

? 2021 Elsevier LtdCode search is a common practice for developers during software implementation. The challenges of accurate code search mainly lie in the knowledge gap between source code and natural language (i.e., queries). Due to the limited code-query pairs and large code-description pairs available, the prior studies based on deep learning techniques focus on learning the semantic matching relation between source code and corresponding description texts for the task, and hypothesize that the semantic gap between descriptions and user queries is marginal. In this work, we found that the code search models trained on code-description pairs may not perform well on user queries, which indicates the semantic distance between queries and code descriptions. To mitigate the semantic distance for more effective code search, we propose QueCos, a Query-enriched Code search model. QueCos learns to generate semantic enriched queries to capture the key semantics of given queries with reinforcement learning (RL). With RL, the code search performance is considered as a reward for producing accurate semantic enriched queries. The enriched queries are finally employed for code search. Experiments on the benchmark datasets show that QueCos can significantly outperform the state-of-the-art code search models.

Key words

Code search/Query semantics/Reinforcement learning/Semantic enrichment

引用本文复制引用

出版年

2022
Neural Networks

Neural Networks

EISCI
ISSN:0893-6080
被引量3
参考文献量34
段落导航相关论文