摘要
随着软件项目规模的不断增大和开源代码库的日益丰富,快速、准确的代码检索变得至关重要。传统基于关键词的搜索方法存在效率低和准确性不高等问题,因此文章提出了一种基于树结构的项目源代码检索方法,结合代码和注释构建多层次树结构,以帮助开发者更好地理解代码关系,进而准确定位所需代码。通过汇聚相似代码元素、过滤非相关代码,该方法可有效提高代码检索的准确性。实验结果显示,基于树结构的代码检索方法在准确率、召回率和F1值方面显著优于传统的文本匹配和图嵌入方法,可提供高效、准确的代码检索工具,从而提高开发效率和代码重用质量,有望在软件开发中产生积极影响。
With the continuous increase in software project scale and the enrichment of open source code libraries,fast and accurate code retrieval has become crucial.Traditional keyword based search methods suffer from low efficiency and accuracy.Therefore,this article proposes a tree based project source code retrieval method,which combines code and annotations to construct a multi-level tree structure to help developers better understand code relationships and accurately determine the required code.This method can effectively improve the accuracy of code retrieval by aggregating similar code elements and filtering irrelevant code.The experimental results show that the tree based code retrieval method is significantly better than traditional text matching and graph embedding methods in terms of accuracy,recall,and F1 value.It can provide efficient and accurate code retrieval tools,thereby improving development efficiency and code reuse quality,and is expected to have a positive impact on software development.
作者
糜伊杨
余芊瞳
魏念青
MI Yiyang;YU Qiantong;WEI Nianqing(Chengdu University of Information Technology,Chengdu 610225,China)
出处
《计算机应用文摘》
2024年第7期125-127,共3页
Chinese Journal of Computer Application
关键词
代码检索
多层次树结构
信息检索
code retrieval
multi level tree structure
information retrieval