摘要
通过示例代码学习简单算法的实现和具体API的使用方式是程序开发人员在软件开发中进行软件复用的高效手段,也是使用代码搜索引擎的主要目的。代码搜索引擎从网页搜索技术发展而来,提供对网络上源代码资源的检索功能,能够有效定位与搜索内容相关的代码,为程序开发人员提供帮助。但现有的代码搜索引擎没有在搜索结果中区别API的实现代码与使用代码,搜索结果存在冗余,导致用户无法快速有效地找到提供有用信息的代码片段。为了使用户更好更快地找到代码搜索目标,阐述了应用语法与语义分析技术从区分API实现代码和使用代码、相似代码聚类、搜索结果摘要3个方面对代码搜索结果进行优化的方法,给出了一个代码搜索引擎的实现,并在实例研究中展示了该方法的有效性。
Learning simple algorithm and specific API usage by code examples is an efficient way in software reuse and is the main purpose of using code search engine. Code search engine providing search service for source code on the internet was developed from Web search engine. It is able to locate source code related to the search input and brings great assistance to software development. However, the state-of-art code search engines do not make a distinction between API implementation and usage, the results are redundant and not easy to recognize. It is difficult for the user to obtain useful code segments from search result items. To address the problem, we proposed applying syntax and semantic analysis techniques to organizing the search results,clustering the similar code and acquiring better code digest. We implemented our method with a code search engine and evaluate its effectiveness in this paper, the experimental results demonstrate that our approach works efficiently.
出处
《计算机科学》
CSCD
北大核心
2009年第8期165-168,共4页
Computer Science
基金
国家科技支撑计划(2006BAH02A02)
国家高技术研究发展计划(863)(2006AA01Z189)资助