In software Q&A sites, there are many code‐solving examples of individual program problems, and these codes with explanatory natural language descriptions are easy to understand and reuse. Code search in software Q&A sites increases the productivity of developers. However, previous approaches to code search fail to capture structural code information and the interactivity between source codes and natural queries. In other words, most of them focus on specific code structures only. This paper proposes TCS (Transformer‐based code search), a novel neural network, to catch structural information for searching valid source codes from the query, which is vital for code search. The multi‐head attention mechanism in Transformer helps TCS learn enough information about the underlying semantic vector representation of codes and queries. An aligned attention matrix is also employed to catch relationships between codes and queries. Experimental results show that the proposed TCS can learn more structural information and has better performance than existing models.
scite is a Brooklyn-based organization that helps researchers better discover and understand research articles through Smart Citations–citations that display the context of the citation and describe whether the article provides supporting or contrasting evidence. scite is used by students and researchers from around the world and is funded in part by the National Science Foundation and the National Institute on Drug Abuse of the National Institutes of Health.
customersupport@researchsolutions.com
10624 S. Eastern Ave., Ste. A-614
Henderson, NV 89052, USA
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Copyright © 2024 scite LLC. All rights reserved.
Made with 💙 for researchers
Part of the Research Solutions Family.