Code classification and code clone are one of the current research hotspots. How to represent source code characteristics is a key link in code classification and code clone. At present, with the rapid development of deep learning, compared with traditional source code feature representation methods, deep learning methods can better represent source code features. However, there are still some shortcomings in the existing deep learning methods. Some models have high complexity and lack of parallel ability. To solve this problem, this paper proposes a source code representation method based on multi head attention mechanism (SCRMHA). SCRMHA converts the source code snippet into statement vector and uses the multi-head attention mechanism to capture the representations of the entire code snippet. We apply the obtained source code snippet characteristics to code classification and code clone. Experimental results show that the performance of SCRMHA is better than that of traditional source code feature representation methods. SCRMHA takes less time than ASTNN and its complexity is about 1/3 of ASTNN, which can effectively represent the characteristics of source code.
No takes yet. Share an insight, caveat, or question.
Xiao et al. (2024) studied this question.
Synapse has enriched 5 closely related papers on similar clinical questions. Consider them for comparative context: