计算机与现代化

• 算法设计与分析 • 上一篇    下一篇

一种有效的API搜索算法

  

  1. (1.上海交通大学软件学院,上海200240;2.上海交通大学计算机科学与工程系,上海200240)

  • 收稿日期:2015-11-12 出版日期:2016-04-14 发布日期:2018-09-30
  • 作者简介:宋文灏(1990-),男,上海人,上海交通大学软件学院硕士研究生,研究方向:程序分析,代码搜索; 钟浩,男,上海交通大学计算机科学与工程系副教授,研究方向:程序分析,软件维护,软件工程,数据挖掘; 于海波,女,讲师,研究方向:语义网,个人信息管理,信息检索,多智能体应用。
  • 基金资助:

    国家自然科学基金资助项目(61572313

An Efficient API Search Algorithm

  1. (1. School of Software, Shanghai Jiao Tong University, Shanghai 200240, China;

    2. Department of Computer Science and Engineering, Shanghai Jiao Tong University, Shanghai 200240, China)

  • Received:2015-11-12 Online:2016-04-14 Published:2018-09-30

摘要:

近年来程序库日趋复杂。当面对不熟悉的开发领域或者功能模块时,开发者通常需要借助搜索引擎或者查阅API文档的方式来选择合适的API来进行开发。然而传统搜索引擎的搜索结果过于碎片化以及API文档中检索的不便使得这一过程十分耗时。本文提出一种新的搜索算法,并根据该算法实现一个API搜索工具APIBookAPIBook能够根据用户对API功能的自然语言描述,结合软件库中API的语义信息、类型信息和调用情况,向用户推荐相关的API,并且给出API调用的代码示例。实验表明APIBookAPI搜索上比传统的检索模型更加有效。

 

关键词:

text-indent: 21pt">mso-ascii-font-family: 'Times New Roman', mso-hansi-font-family: 'Times New Roman'">应用编程接口, mso-ascii-font-family: 'Times New Roman', mso-hansi-font-family: 'Times New Roman'">信息检索, mso-ascii-font-family: 'Times New Roman', mso-hansi-font-family: 'Times New Roman'">代码推荐, mso-ascii-font-family: 'Times New Roman', mso-hansi-font-family: 'Times New Roman'">程序分析

Abstract:

 Software libraries become more and more complex in recent years. When working on unfamiliar fields and functions, developers often have to rely on search engine or reading API documents to develop program with right API. However, the result of traditional search engine doesn’t focus on APIs and it is not very convenient to search in API documents, which makes this process very time consuming. We proposed a new search algorithm and implemented a tool APIBook for API search. APIBook can recommend relevant APIs to users based on natural language query as well as APIs’ semantic, type, and invocation information in software libraries. Experiment shows that APIBook is more effective than traditional search model.

Key words: API, information retrieval, code recommendation, program analysis

中图分类号: