<p>Code retrieval aims to identify the most relevant code fragments in response to natural language queries and plays an important role in supporting software development on software Q&amp;A platforms. However, effectively modeling the semantic relationship between queries and code remains challenging, particularly due to noisy and incomplete code snippets. To address this challenge, we propose NMAC, a Neural Mutual Attention approach for code retrieval from Q&amp;A sites. The proposed model combines distributed word representations with a Bi-directional Long Short-Term Memory (Bi-LSTM) network and a mutual attention mechanism to explicitly capture fine-grained interactions between query titles and code fragments. NMAC analyzes key code elements, including variables, functions, documentation strings, and comments, to assess semantic relevance more accurately. The effectiveness of the proposed framework is evaluated on a benchmark dataset derived from a software Q&amp;A platform. Experimental results demonstrate that NMAC outperforms existing baseline approaches in terms of retrieval accuracy.</p>

错误:搜索内容不能为空,请输入英文关键词
错误:关键词超出字数限制,请精简
高级检索

Boosting code retrieval performance on Q&A sites with neural mutual attentions

  • Nazia Bibi,
  • Muhammad Babar,
  • Sarah Kaleem,
  • Nazar Waheed,
  • Zahid Khan,
  • Basit Qureshi

摘要

Code retrieval aims to identify the most relevant code fragments in response to natural language queries and plays an important role in supporting software development on software Q&A platforms. However, effectively modeling the semantic relationship between queries and code remains challenging, particularly due to noisy and incomplete code snippets. To address this challenge, we propose NMAC, a Neural Mutual Attention approach for code retrieval from Q&A sites. The proposed model combines distributed word representations with a Bi-directional Long Short-Term Memory (Bi-LSTM) network and a mutual attention mechanism to explicitly capture fine-grained interactions between query titles and code fragments. NMAC analyzes key code elements, including variables, functions, documentation strings, and comments, to assess semantic relevance more accurately. The effectiveness of the proposed framework is evaluated on a benchmark dataset derived from a software Q&A platform. Experimental results demonstrate that NMAC outperforms existing baseline approaches in terms of retrieval accuracy.