You are currently viewing a new version of our website. To view the old version click .
Electronics
  • Article
  • Open Access

28 November 2024

Deep Semantics-Enhanced Neural Code Search

,
,
,
,
and
School of Computer Science and Engineering, Northeastern University, Shenyang 110819, China
*
Author to whom correspondence should be addressed.
This article belongs to the Special Issue Machine Learning for Software Engineering and Applications

Abstract

Code search uses natural language queries to retrieve code snippets from a vast database, identifying those that are semantically similar to the query. This enables developers to reuse code and enhance software development efficiency. Most existing code search algorithms focus on capturing semantic and structural features by learning from both text and code graph structures. However, these algorithms often struggle to capture deeper semantic and structural features within these sources, leading to lower accuracy in code search results. To address this issue, this paper proposes a novel semantics-enhanced neural code search algorithm called SENCS, which employs graph serialization and a two-stage attention mechanism. First, the code program dependency graph is transformed into a unique serialized encoding, and a bidirectional long short-term memory (LSTM) model is used to learn the structural information of the code in the graph sequence to generate code vectors rich in structural features. Second, a two-stage attention mechanism enhances the embedded vectors by assigning different weight information to various code features during the code feature fusion phase, capturing significant feature information from different code feature sequences, resulting in code vectors rich in semantic and structural information. To validate the performance of the proposed code search algorithm, extensive experiments were conducted on two widely used code search datasets, CodeSearchNet and JavaNet. The experimental results show that the proposed SENCS algorithm improves the average code search accuracy metrics by 8.30 % (MRR) and 17.85% (DCG) and compared to the best baseline code search model in the literature, with an average improvement of 14.86% in the SR@1 metric. Experiments with two open-source datasets demonstrate SENCS achieves a better search effect than state of-the-art models.

1. Introduction

With the continuous advancement of internet technology, the demand for software and its functionalities has increased, pushing developers to invest significant time and effort in software development and project design [1,2,3]. To satisfy complex programming requirements, developers often use natural language to describe the functionality they need and to search for similar code online. The growth of open-source communities and online Q&A platforms has led to a massive increase in available project code, providing rich data for developers to find high-quality code snippets aligned with their queries [4,5].
Code search refers to the process where a code search algorithm retrieves code snippets that are semantically similar to a user’s natural language query from a vast codebase [2,3]. Traditional code search methods treat source code as plain text, comparing it directly with the natural language query. However, this approach often yields low accuracy due to the complexity of natural language. In response, researchers have introduced information retrieval and heuristic-based methods, but these approaches fail to capture the deep semantic connections between natural language and code, leading to a significant semantic gap.
With the rise of deep learning (DL) in natural language processing (NLP), researchers have developed DL-based code search techniques to better understand code semantics and improve search performance. For example, DeepCS [6], NCS [7], GraphCS [8], GSMM [9], QueCos [10], etc. With the further development and application of pre-trained models in the field of NLP, researchers are also considering using pre-trained methods to enhance the performance of code search tasks, such as CodeBERT [11], GraphCodeBERT [12], and the CDCS [13] algorithm. Currently, most DL algorithms utilize Graph Neural Network (GNN) models to learn structural feature information from code, but they often fail to capture the deep structural information within code, resulting in lower search accuracy. As the demand for efficient and accurate code search grows, there is a need to develop algorithms that not only provide accurate results but also execute searches efficiently.
In this context, this paper proposes a code search algorithm that incorporates semantic enhancement. The proposed algorithm uses graph serialization and a two-stage attention mechanism to improve code search accuracy. The proposed algorithm considers three types of feature information: code method names, character tagging sequences, and program dependency graph serialization. To capture deep semantic and structural information, a two-stage attention mechanism is introduced to enhance feature representation and combine multiple feature vectors into enriched code vectors. The program dependency graph is transformed into a unique serialized sequence, ensuring that the structural information is fully embedded, which significantly improves search accuracy. The key contributions of this paper are as follows:
(1) In this paper, we propose SENCS, a deep semantic-enhanced neural code search algorithm based on graph serialization and a two-stage attention mechanism. We provide semantic features to code vectors by extracting code method name features and character markup features; generate serialized encodings by extracting program dependency graph structural features of the code; and further learn the graph sequence features to provide structural features to code vectors.
(2) In the enhancement phase of the two-stage mechanism, we use multi-head attention to enhance the features of the embedding vector and the features in the fusion phase. We use the multi-head attention mechanism to assign different weights to the different code features to generate enriched code feature vectors with enhanced semantic features and enhanced structural features.
(3) Extensive experiments were conducted using both the CodeSearchNet dataset and JavaNet dataset, comparing SENCS to several baseline models. The results show that SENCS improved search accuracy metrics by an average of 9.70% compared to the best baseline model. In particular, the SR@1 metric shows an improvement of 14.86%. For the number of most relevant code snippets that return top-ranked position code fragments, the SENCS algorithm in this paper has more than the number for comparable algorithms.
The structure of this paper is as follows: Section 1 provides an introduction, covering the research background and the significance of code search. Section 2 reviews related work in the field. Section 3 discusses the SENCS algorithm, including code semantic features enhancement and code graph sequence features enhancement. Section 4 presents the experiments and results, and Section 5 concludes the paper with a summary.

4. Experimental Evaluation

To assess the code search performance of the proposed SENCS algorithm, this section presents a comparative experiment focused on analyzing accuracy and effectiveness. A two-stage attention mechanism impact experiment was designed to evaluate the effect of this mechanism on algorithm performance. Additionally, an ablation study was conducted to assess the influence of various code features on the algorithm’s performance. This section also includes parameter sensitivity analysis experiments to investigate the impact of different code feature lengths and feature vector dimensions on algorithm performance.

4.1. Introduction to Experimental Dataset and Experimental Environment

The experiments were conducted using two cutting-edge datasets, namely CodeSearchNet and JavaNet, to evaluate the proposed algorithm’s code search performance. The CodeSearchNet dataset is a well-known resource for code search research [30], jointly released by Microsoft and GitHub in 2019. The JavaNet dataset consists of Java code snippets and their corresponding natural language descriptions, gathered from open-source networks using web crawling algorithms [9]. The partitioning details for both the CodeSearchNet and JavaNet datasets are presented in Table 1. Table 2 provides detailed information about the experimental environment.
Table 1. Information of datasets after preprocessing.
Table 2. Description of the experimental environment.

4.2. Evaluation Indicators and Baseline Models

To better evaluate the performance of code search tasks and verify the effectiveness of proposed SENCS algorithm, three accuracy metrics, mean reciprocal rank (MRR) and SuccessRate@K, and discounted cumulative gain (DCG) were used in the experiments.
In Formula (34), F r a n k   refers to the position where the best code snippet that meets the query semantics first appears in the list of returned results after executing the code search. The smaller the value of F r a n k , the higher the position of the results that meet the query requirements in the returned result list. Conversely, the lower the value, the lower the position of the results that meet the query requirements. SuccessRate@K (abbreviated as SR@K) is an important evaluation metric for assessing the performance of code search. SR@K is the probability that the first K code search results returned have code snippets that are semantically similar to the natural language query. The smaller the value, the lower the accuracy of the code search, and the higher the value, the higher the accuracy of the code search. The calculation process is shown in Formula (34).
S R @ K = 1 Q n u m q u e r y Q n u m F ( F r a n k q K )
In the above Formula (34), Q n u m represents the number of queries in the set Q of natural language query statements, q u e r y represents a query statement in the set Q of query statements, F r a n k q represents the Frank value corresponding to the q u e r y statement, and F is the discriminant function in the formula. When the discriminant statement in the F function is true, the return result is 1, and when the discriminant statement in the F function is false, the return result is 0.
Mean reciprocal rank (MRR) is an internationally recognized metric for evaluating code search tasks. MRR is calculated by averaging the sum of the reciprocals of Frank values for natural language queries, representing the position of code fragments related to query semantics in the return result list. For a natural language query, when conducting a code search, the algorithm usually prioritizes displaying code fragments with high rankings to the user. That is, the higher the MRR value, the higher the ranking of code related to the query semantics, and the higher the search accuracy of the code search algorithm. The smaller the MRR value, the lower the ranking of code related to the query semantics, and the lower the search accuracy of the code search algorithm. The MRR calculation process is shown in Formula (35).
M R R = 1 Q n u m q u e r y Q n u m 1 F r a n k q
In Formula (35), Q n u m represents the number of queries in the set Q of natural language query statements, q u e r y represents a query statement in the set Q of query statements, and F r a n k q represents the F r a n k value corresponding to the query statement.
Discounted cumulative gain (DCG) is a widely recognized metric for evaluating the quality of ranked lists in information retrieval and recommendation systems. Unlike mean reciprocal rank (MRR), which primarily focuses on the highest rank of the first relevant item, DCG considers the relevance of all items in the ranked list, with higher ranks receiving more weight. This makes DCG a comprehensive measure that evaluates the overall quality of the entire result list. For the case of the only correct answer, the calculation formula for DCG can be simplified as Formula (36).
D C G = i k r e l i l o g 2 ( i + 1 )
In Formula (36), r e l i is the correlation score for the i-th result (1 for correct answer, 0 for incorrect answer), and k is the first k results considered.
To better evaluate the code search performance of the SENCS algorithm, we selected the DeepCS model, MMAN model, and GSMM model as baseline comparison code search models. All three models are code search models based on multimodal feature extraction.
During the experiment, the code search dataset was randomly shuffled to obtain pairs of code fragments and natural language descriptions, with a batch size set to 64. The corresponding feature vector lengths for extracting various code feature information, natural language description feature information, and natural language query information were specified, as detailed in Table 3. To prevent parameter overfitting during the experimental process, a Dropout mechanism was introduced, with the Dropout value set to 0.25. A more detailed description of the experimental parameters for the SENCS algorithm is provided in Table 3.
Table 3. Experimental parameter description.
The SENCS algorithm was applied to perform code search tasks on both the CodeSearchNet and JavaNet datasets, measuring SR@K (SR@1, SR@5, SR@10) to validate the accuracy of the code search results. Additionally, MRR evaluation metrics were used to validate the effectiveness of the code search results returned by the SENCS algorithm, utilizing the Frank evaluation metrics for further assessment.

4.3. Experimental Results

4.3.1. Comparison of Accuracy of Code Search Results

In Table 4, the code search performance of the proposed SENCS algorithm and the three baseline models on the CodeSearchNet dataset is presented. The experimental results indicate that the SENCS algorithm achieved an MRR value of 0.510, with SR@1, SR@5, and SR@10 values of 0.393, 0.646, and 0.736, respectively, with a DCG value of 0.559. Compared to the DeepCS algorithm, the SENCS algorithm improved MRR by 44.06%, with increases of 43.43%, 40.13%, and 37.57% in SR@1, SR@5, and SR@10, respectively, with DCG increases of 40.8%. When compared to the MMAN algorithm, the SENCS algorithm showed an MRR improvement of 18.60%, with SR@1, SR@5, and SR@10 increases of 28.85%, 14.94%, and 2.125%, respectively, with DCG increases of 23.1%. In comparison with the GSMM algorithm, the SENCS algorithm improved MRR by 7.36%, with SR@1, SR@5, and SR@10 increases of 14.91%, 10.05%, and 18.13%, respectively, with DCG increases of 11.1%.
Table 4. Code search accuracy of SENCS algorithm on CodeSearchNet dataset.
Table 5 demonstrates the code search performance of the SENCS algorithm and the baseline models on the JavaNet dataset. The results indicate that the SENCS algorithm achieved an MRR value of 0.686, with SR@1, SR@5, and SR@10 values of 0.581, 0.814, and 0.877, respectively with a DCG value of 0.729. This represents a 65.30% improvement in MRR compared to the DeepCS algorithm, with SR@1, SR@5, and SR@10 increases of 71.38%, 63.45%, and 40.77%, respectively, with DCG increases of 53.8%. Compared to the MMAN algorithm, the SENCS algorithm showed a 35.84% improvement in MRR, with SR@1, SR@5, and SR@10 increases of 38.33%, 37.50%, and 11.71%, respectively, with DCG increases of 24.6%. When compared to the GSMM algorithm, there was a 9.23% improvement in MRR, with SR@1, SR@5, and SR@10 increases of 14.82%, 1.36%, and 1.74%, respectively, with DCG increases of 24.6%.
Table 5. Code search accuracy of SENCS algorithm on JavaNet dataset.
From these results, it is evident that the SENCS algorithm improves the accuracy of code search by an average of 9.70% compared to the optimal baseline model, GSMM, across both datasets, with an average improvement of 14.86% in SR@1. The experiment with two open-source datasets shows SENCS achieves a superior search effect compared to SOTA models. The SENCS algorithm leverages graph serialization and a two-stage attention mechanism, capturing not only the semantic information of the code but also rich structural information. By combining these elements, the algorithm enhances code feature vectors and natural language description features, capturing deep source code information and learning weight information among different features during the fusion process. This results in code vectors containing rich semantic and structural information, allowing semantically similar code fragment vectors and natural language description vectors to be closer in the vector space, thereby improving code search accuracy.

4.3.2. Proposed SENCS Model Analysis

(1) The influence of the two-stage attention mechanism
The proposed SENCS algorithm incorporates a two-stage attention mechanism to enhance the accuracy of code search results. The first stage employs a multi-head attention mechanism in the feature extraction phase, improving the method name feature vector, character marker feature vector, program dependency sequence feature vector, and natural language description feature vector. The second stage utilizes a multi-head attention mechanism in the multi-feature fusion phase to learn the weight values of different vectors for effective fusion. To evaluate the impact of the two-stage attention mechanism on the code search performance of the SENCS algorithm, comparative experiments were conducted by removing the first stage, the second stage, and both attention mechanisms. The algorithm names are summarized in Table 6.
Table 6. Algorithm name introduction.
Experiments were carried out on the CodeSearchNet and JavaNet datasets, with the results shown in Table 7 and Table 8. The data reveal that compared to a model without an attention mechanism, applying the attention mechanism in the feature semantic enhancement stage improved MRR by 3.00% and 2.31%, and DCG by 5.08% and 1.29%, on the two datasets, respectively. SR@1, SR@5, and SR@10 increased by 4.02%, 2.66%, and 2.43%, respectively for the first dataset, and by 2.78%, 2.04%, and 1.52%, respectively for the second dataset. When the attention mechanism was used in the feature fusion stage, MRR improved by 6.65% and 3.85%, DCG by 6.46% and 2.44% on the two datasets, respectively. SR@1, SR@5, and SR@10 increased by 8.62%, 6.48%, and 4.01%, respectively, for the first dataset, and 4.82%, 2.93%, and 2.10%, respectively, for the second dataset. When both attention mechanisms were applied, MRR increased by 9.44% and 5.70%, and DCG by 9.39% and 4.74%, with SR@1, SR@5, and SR@10 rising by 12.93%, 7.48%, and 5.59% for the first dataset, and 7.79%, 3.82%, and 2.69% for the second dataset, respectively. These findings demonstrate that employing a two-stage attention mechanism significantly enhances model accuracy. Notably, the attention mechanism in the semantic feature extraction phase provides substantial improvements in code search accuracy, as it captures weight information from different aspects of method names, character labels, and program dependency sequences, enriching the vector representations for feature fusion. Thus, the proposed SENCS algorithm shows significant improvements in search accuracy compared to algorithms without attention mechanisms.
Table 7. Effect of two-stage attention mechanism on search accuracy with CodeSearchNet dataset.
Table 8. Effect of two-stage attention mechanism on search accuracy with JavaNet dataset.
(2) Ablation experiment
To further investigate the impact of different code features on the code search performance of the SENCS algorithm, ablation experiments were designed. The three components—method name feature learning, character label feature learning, and program dependency graph sequence feature learning—were removed, and the resulting code search performance was evaluated on the CodeSearchNet and JavaNet datasets. The algorithm names are detailed in Table 9.
Table 9. Algorithm name introduction.
Figure 5 visualizes the effect of the SENCS algorithm on code search accuracy after removing different code features from the CodeSearchNet and JavaNet datasets, highlighting the significance of each feature on overall performance.
Figure 5. Influence of different code features with different datasets on search accuracy.
From Figure 5, it is evident that removing the program dependency graph sequence representation significantly impacts the proposed SENCS model. This is because the program dependency graph encapsulates control flow and data flow information related to code variables. Its serialized representation also contains semantic information from all character tags in the program. Consequently, removing this feature leads to a notable decline in search performance, particularly in the SR@1 metric. Character tagging information functions similarly to the textual sequence of code fragments, effectively matching keywords with those in the query statement. Removing this information hampers the model’s ability to capture comprehensive semantic and syntactic features of the code, thereby diminishing the performance of the proposed SENCS algorithm. While method name information quickly conveys the function and purpose of the code, its similarity to query statements is generally lower due to naming conventions. As a result, removing method name features has a comparatively smaller impact on the proposed SENCS algorithm’s performance. This analysis highlights that the proposed SENCS algorithm excels in code search by simultaneously leveraging method name, character tagging, and graph serialization features.
(3) Parameter sensitivity analysis
In deep learning-based code search algorithms, parameter sensitivity is crucial, as different parameters can significantly affect performance. To investigate this, comparative experiments were designed to analyze the effects of four feature parameters—method name length, number of character tags, graph sequence length, and natural language description length—on model performance using the CodeSearchNet and JavaNet datasets. The influence of different vector dimensions on model performance was evaluated using MRR, SR@1, SR@5, and SR@10. The experimental results are illustrated in Figure 6 and Figure 7.
Figure 6. Influence of different parameters on code search performance.
Figure 7. Influence of different vector dimensions on code search performance.
Figure 6a depicts the impact of method name sequence length on the proposed SENCS algorithm’s search accuracy. It is evident from the graph that a method name sequence length of 6 yielded the best performance across various evaluation metrics. Conversely, a length of 1 resulted in lower accuracy, as most function names exceed one word, with the first word often lacking significant semantic content. Figure 6b illustrates the effect of the number of character tags in the function character tagging sequence. The SENCS algorithm performed optimally when the number of tokens in the character tagging sequence was 50. Figure 6c examines the effect of encoding length in the function graph sequence on search accuracy. The best performance occurred with an encoding length of 80. As the graph sequence length decreases, accuracy drops significantly due to shorter sequences failing to comprehensively represent the information within the program dependency graph, resulting in lost semantic and structural information. Figure 6d presents the effect of the natural language description sequence length on search accuracy. The SENCS algorithm performed best with a sequence length of 30. When the length increases to 100, accuracy metrics decline because the model needs to process more semantic information, which can lead to complex and redundant descriptions that diminish the semantic similarity between the vector representation and the original statement.
Figure 7a,b show the impact of changes in code vector dimension and query vector dimension on the proposed SENCS algorithm’s search accuracy across the CodeSearchNet and JavaNet datasets. The optimal performance is observed with a vector representation dimension of 512. Deviations from this dimension, whether increasing or decreasing, resulted in lower MRR, SR@1, SR@5, and SR@10 metrics, establishing 512 as the ideal setting for vector dimensions in the proposed SENCS algorithm.

4.4. Discussion

The SENCS algorithm demonstrates significant improvements in code search by effectively integrating both semantic and structural information. By leveraging graph serialization and a two-stage attention mechanism, SENCS captures not only the surface-level syntax of the code but also its deeper functional and structural characteristics. This dual focus enhances the feature vectors of code snippets, making them richer in both semantic and structural details. Additionally, the algorithm’s ability to learn weight information during the feature fusion process ensures that the final vector representations are highly representative of the code’s true nature. As a result, semantically similar code fragments and natural language descriptions are brought closer together in the vector space, leading to more accurate and relevant search results. Furthermore, the enhanced understanding of natural language queries allows users to describe their needs more intuitively, improving the overall user experience and efficiency in finding the desired code snippets.
In contrast, models like DeepCS utilize the textual information and API information of the code, but DeepCS does not use the graph structure, nor the attention mechanism. Although GraphCodeBERT uses graph structure, it does not convert the graph structure into code features, but only utilizes the link relationship between nodes in the graph as a pre-training task. GSMM and other baseline models primarily focus on the semantic information of the code and natural language descriptions, often neglecting the structural information inherent in the code. This limitation means that these models may miss important contextual and structural details that are crucial for accurately understanding and matching code fragments.
In this paper, SENCS considers logical relationships such as control relationships between code statements, dependencies between data, etc., which are important features that can reflect the nature of the code, and such features can all be modeled by graphs (e.g., PDG used in this paper.) Related models such as DeepCS, GraphCodeBERT, etc., do not take the structure of code graphs as an important feature of code representation. The feature vectors generated by GSMM and similar models may not fully capture the nuanced relationships between code elements, leading to less accurate and less effective code search results. Additionally, they all lack the advanced attention mechanisms that allow the SENCS algorithm to dynamically weigh different features based on their importance in the context of the query. SENCS captures the structural information with deep semantics implicit in the code graph and fuses it with textual and API information as a representation of the code through an attention mechanism, thus providing better performance. This is the main innovation of SENCS. The SENCS algorithm provides a more comprehensive and robust approach to code search, significantly enhancing its performance compared to existing methods.
In future research, we will consider comparing with these latest transformer models to further evaluate the performance of SENCS compared with state-of-the-art technology. This can help us understand the relative advantages and disadvantages of SENCS in the latest algorithm environment and provide a reference for further optimization of the model.

5. Conclusions

In this paper, we propose SENCS, an advanced code search model that can be used in various real-world scenarios such as code recommendation systems or code completion tasks. Code search is a critical research task in the field of software engineering, aiming to utilize natural language queries to locate semantically similar code fragments within extensive code databases. This process enhances the development efficiency of software developers by returning relevant code snippets based on user queries. Currently, most code search algorithms extract semantic and structural feature information from code snippets to generate vector representations. While GNN models are commonly employed to capture code structure features, these models often fail to delve deeply into the complex structural information of code graphs, leading to partial information loss and diminished search accuracy.
This article explores natural language-based code search algorithms and proposes a novel deep semantic-enhanced neural code search algorithm called SENCS that combines graph serialization with a two-stage attention mechanism to improve search accuracy. The algorithm employs a Bi-LSTM model and an MLP model to learn the semantic feature information from method names and character tags of source code fragments, generating corresponding feature vectors. Additionally, the source code’s program dependency graph is extracted, utilizing a specified edge-first traversal method to create a unique serialized representation of the graph as structural feature information. A Bi-LSTM model further captures the deep structural features within this graph sequence, generating program dependency graph feature vectors.
To enrich the semantic and structural information embedded in the source code fragment vectors, the proposed algorithm introduces a two-stage attention mechanism. This mechanism employs multi-head attention to enhance features across multiple code feature vectors and natural language description vectors. During the fusion of these vectors, it captures diverse aspects of code feature information, facilitating a better integration of semantic and structural features. Consequently, this approach generates a robust code vector representation, effectively realizing the code search algorithm. Extensive experiments on two open-source datasets and comparisons with three advanced models demonstrate that our approach can achieve the best code search effect
The practical significance of the SENCS algorithm lies in its ability to significantly enhance the efficiency and effectiveness of code search for software developers. By providing more accurate and contextually relevant search results, SENCS can reduce the time and effort required to find suitable code snippets, thereby accelerating the development process. This is particularly valuable in large-scale software projects where developers often need to navigate vast codebases to find specific functionalities. Moreover, the algorithm’s capability to understand and leverage both semantic and structural information ensures that the returned code snippets are not only syntactically correct but also functionally appropriate, reducing the likelihood of introducing bugs or inefficiencies.
For future work, we plan to leverage transformers and pre-trained models to further enhance the effectiveness of our algorithm. Specifically, we will explore the integration of advanced models such as CodeBERT and Codex, which have shown promising results in natural language and code understanding tasks. These models can provide deeper semantic insights and improve the accuracy of code search by better capturing the nuances of both code and natural language queries. Additionally, we aim to address the scalability of our algorithm by optimizing it to handle larger code repositories efficiently. This will involve developing methods to reduce computational complexity and improve processing speed, ensuring that the algorithm remains performant even with vast datasets. We will also investigate the performance of our algorithm across different programming languages, adapting the feature extraction and vector generation processes to accommodate the unique characteristics of each language. By pursuing these directions, we aim to make our code search algorithm more robust, efficient, and widely applicable.

Author Contributions

Software, Y.S., L.M. and Y.G.; writing—original draft preparation, Y.Y. and Y.G.; writing—review and editing, Y.Y., L.M., Y.G., F.W. and Y.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

The original contributions presented in the study are included in the article, further inquiries can be directed to the corresponding author.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Kim, K.; Ghatpande, S.; Kim, D.; Zhou, X.; Liu, K.; Bissyandé, T.F.; Klein, J.; Le Traon, Y. Big Code Search: A Bibliography. ACM Comput. Surv. 2024, 56, 1–49. [Google Scholar] [CrossRef]
  2. Xie, Y.; Lin, J.; Dong, H.; Zhang, L.; Wu, Z. Survey of Code Search Based on Deep Learning. ACM Trans. Softw. Eng. Methodol. 2024, 33, 1–42. [Google Scholar] [CrossRef]
  3. Ko, A.J.; Myers, B.A.; Coblenz, M.J.; Aung, H.H. An exploratory study of how developers seek, relate, and collect relevant information during software maintenance tasks. IEEE Trans. Softw. Eng. 2006, 32, 971–987. [Google Scholar] [CrossRef]
  4. Chen, J.; Hu, X.; Li, Z.; Gao, C.; Xia, X.; Lo, D. Code Search is All You Need? Improving Code Suggestions with Code Search. In Proceedings of the ICSE 2024: IEEE/ACM 46th International Conference on Software Engineering, Lisbon, Portugal, 14–20 April 2024; pp. 1–13. [Google Scholar]
  5. Brandt, J.; Guo, P.J.; Lewenstein, J.; Dontcheva, M.; Klemmer, S.R. Two studies of opportunistic programming: Interleaving web foraging, learning, and writing code. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems, Boston, MA, USA, 4–9 April 2009; pp. 1589–1598. [Google Scholar]
  6. Gu, X.; Zhang, H.; Kim, S. Deep code search. In Proceedings of the 40th International Conference on Software Engineering, Gothenburg, Sweden, 27 May–3 June 2018; pp. 933–944. [Google Scholar]
  7. Liu, J.; Kim, S.; Murali, V.; Chaudhuri, S.; Chandra, S. Neural query expansion for code search. In Proceedings of the 3rd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, Phoenix, AZ, USA, 22 June 2019; pp. 29–37. [Google Scholar]
  8. Huang, S.; Zhao, Y.; Liang, Y. Code Search Combining Graph Embedding and Attention Mechanism. J. Front. Comput. Sci. Technol. 2022, 16, 844. [Google Scholar]
  9. Shi, Y.; Yin, Y.; Wang, Z.; Lo, D.; Zhang, T.; Xia, X.; Zhao, Y.; Xu, B. How to better utilize code graphs in semantic code search? In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering, Singapore, 14–18 November 2022; pp. 722–733. [Google Scholar]
  10. Wang, C.; Nong, Z.; Gao, C.; Li, Z.; Zeng, J.; Xing, Z.; Liu, Y. Enriching query semantics for code search with reinforcement learning. Neural Netw. 2022, 145, 22–32. [Google Scholar] [CrossRef] [PubMed]
  11. Feng, Z.; Guo, D.; Tang, D.; Duan, N.; Feng, X.; Gong, M.; Shou, L.; Qin, B.; Liu, T.; Jiang, D.; et al. CodeBERT: A pre-trained model for programming and natural languages. In Proceedings of the EMNLP 2020: Findings of the Association for Computational Linguistics, Online, 16–20 November 2020; pp. 1536–1547. [Google Scholar]
  12. Guo, D.; Ren, S.; Lu, S.; Feng, Z.; Tang, D.; Liu, S.; Zhou, L.; Duan, N.; Svyatkovskiy, A.; Fu, S.; et al. GraphCodeBERT: Pre-training code representations with data flow. In Proceedings of the International Conference on Learning Representations, Vienna, Austria, 4 May 2021; pp. 1–18. [Google Scholar]
  13. Chai, Y.; Zhang, H.; Shen, B.; Gu, X. Cross-domain deep code search with meta learning. In Proceedings of the 44th International Conference on Software Engineering, Pittsburgh, PA, USA, 22–27 May 2022; pp. 487–498. [Google Scholar]
  14. Wu, H.C.; Luk, R.W.; Wong, K.F.; Kwok, K.L. Interpreting TF-IDF term weights as making relevance decisions. ACM Trans. Inf. Syst. (TOIS) 2008, 26, 1–37. [Google Scholar] [CrossRef]
  15. Robertson, S.; Zaragoza, H. The probabilistic relevance framework: BM25 and beyond. Found. Trends Inf. Retr. 2009, 3, 333–389. [Google Scholar] [CrossRef]
  16. Lv, F.; Zhang, H.; Lou, J.G.; Wang, S.; Zhang, D.; Zhao, J. Codehow: Effective code search based on api understanding and extended boolean model(e). In Proceedings of the 30th IEEE/ACM International Conference on Automated Software Engineering (ASE), Lincoln, NE, USA, 9–13 November 2015; pp. 260–270. [Google Scholar]
  17. Li, X.; Wang, Z.; Wang, Q.; Yan, S.; Xie, T.; Mei, H. Relationship-aware code search for JavaScript frameworks. In Proceedings of the 2016 24th ACM SIGSOFT International Symposium on Foundations of Software Engineering, Seattle, WA, USA, 13–18 November 2016; pp. 690–701. [Google Scholar]
  18. Zhang, F.; Niu, H.; Keivanloo, I.; Zou, Y. Expanding queries for code search using semantically related api class-names. IEEE Trans. Softw. Eng. 2017, 44, 1070–1082. [Google Scholar] [CrossRef]
  19. Raghothaman, M.; Wei, Y.; Hamadi, Y. SWIM: Synthesizing what I mean. In Proceedings of the 38th International Conference on Software Engineering, Austin, TX, USA, 14–22 May 2016; pp. 357–367. [Google Scholar]
  20. Ding, S.H.; Fung, B.C.; Charland, P. Kam1n0: Mapreduce-based assembly clone search for reverse engineering. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, San Francisco, CA, USA, 13–17 August 2016; pp. 461–470. [Google Scholar]
  21. Sachdev, S.; Li, H.; Luan, S.; Kim, S.; Sen, K.; Chandra, S. Retrieval on source code: A neural code search. In Proceedings of the 2nd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, Philadelphia, PA, USA, 18 June 2018; pp. 31–41. [Google Scholar]
  22. Wen, D.; Yang, L.; Zhang, Y.; Lin, Y.; Xu, K.; Lin, H. Multi-level semantic representation model for code search. In Proceedings of the Joint Conference of the Information Retrieval Communities in Europe (CIRCLE), Toulouse, France, 6–9 July 2020; pp. 1–5. [Google Scholar]
  23. Salza, P.; Schwizer, C.; Gu, J.; Gall, H.C. On the effectiveness of transfer learning for code search. IEEE Trans. Softw. Eng. 2023, 49, 1804–1822. [Google Scholar] [CrossRef]
  24. Geng, M.; Dong, D.; Lu, P. Input Transformation for Pre-Trained-Model-Based Cross-Language Code Search. In Proceedings of the 2023 IEEE 23rd International Conference on Software Quality, Reliability, and Security Companion (QRS-C), Chiang Mai, Thailand, 22–26 October 2023; pp. 403–412. [Google Scholar]
  25. Zhang, S.; Ding, Y.; Hu, E.; Yu, Y.; Zhang, Y. Enhancing Code Representation Learning for Code Search with Abstract Code Semantics. In Proceedings of the 2024 International Joint Conference on Neural Networks (IJCNN), Yokohama, Japan, 30 June–5 July 2024; pp. 1–8. [Google Scholar] [CrossRef]
  26. Vallejo-Huanga, D.; Morocho, J.; Salgado, J. SimilaCode: Programming Source Code Similarity Detection System Based on NLP. In Proceedings of the 2023 15th International Congress on Advanced Applied Informatics Winter (IIAI-AAI-Winter), Bali, Indonesia, 11–13 December 2023; pp. 171–178. [Google Scholar]
  27. Cai, B.; Yu, Y.; Hu, Y. CSSAM: Code Search via Attention Matching of Code Semantics and Structures. In Proceedings of the 2023 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER), Taipa, Macao, 21–24 March 2023; pp. 402–413. [Google Scholar] [CrossRef]
  28. Saieva, A.; Chakraborty, S.; Kaiser, G. REINFOREST: Reinforcing Semantic Code Similarity for Cross-Lingual Code Search Models. arXiv 2023, arXiv:2305.03843. [Google Scholar]
  29. Wan, Y.; Shu, J.; Sui, Y.; Xu, G.; Zhao, Z.; Wu, J.; Yu, P. Multi-modal attention network learning for semantic source code retrieval. In Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering (ASE), San Diego, CA, USA, 11–15 November 2019; pp. 13–25. [Google Scholar]
  30. Husain, H.; Wu, H.H.; Gazit, T.; Allamanis, M.; Brockschmidt, M. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv 2019, arXiv:1909.09436. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Article Metrics

Citations

Article Access Statistics

Multiple requests from the same IP address are counted as one view.