Code Recommendation Based on Deep Learning
Hao Sun, Zhifei Xu, Li Xu · 2023
Software developers, especially programming beginners, often need to complete some unfamiliar coding tasks, generally by reusing the previous code or searching the existing code snippets, and from a large number of redundant search results to screen out the code with similar structure to complete the coding task. In order to quickly and accurately recommend high-quality code snippets for programmers, this paper Sentence-BERT model. Firstly, the method obtains a large amount of high-quality data to build the code base, and proposes a code snippet recommendation method based on generates sentence vectors with rich semantics for the natural language description corresponding to the code snippets and the natural language query input by users based on the deep learning model SBERT. Then, the code snippets are recommended by comparing the dot product similarity. The effectiveness of the proposed method is verified by comparing the three commonly used evaluation indexes of hit rate, average reciprocal ranking and average accuracy with the methods in the current related research. Experimental results show that this recommendation method can effectively improve the accuracy and effect of code snippet recommendation.