一句话:提出 BIKER,融合词嵌入与 Stack Overflow/API 文档双信息源,跨越词汇与知识鸿沟推荐 API。
针对开发者按自然语言任务描述查找 API 时的词汇鸿沟(同义异词)和知识鸿沟(API 文档偏重功能结构,缺少概念与目的),本文提出 BIKER。BIKER 用词嵌入计算任务与文本描述的语义相似度;并受开发者参考 Stack Overflow 与 API 文档的启发,从 Stack Overflow 帖子抽取候选 API,再结合查询与帖子、API 文档的相似度排序,同时汇总 API 描述和代码示例等补充信息。在 413 个 API 相关问题上评估,BIKER 在类级与方法级推荐上优于先进基线;28 名 Java 开发者的用户研究验证了其实用性。
Developers often need to search for appropriate APIs for their programming tasks. Although most libraries have API reference documentation, it is not easy to find appropriate APIs due to the lexical gap and knowledge gap between the natural language description of the programming task and the API description in API documentation. Here, the lexical gap refers to the fact that the same semantic meaning can be expressed by different words, and the knowledge gap refers to the fact that API documentation mainly describes API functionality and structure but lacks other types of information like concepts and purposes, which are usually the key information in the task description. In this paper, we propose an API recommendation approach named BIKER (Bi-Information source based KnowledgE Recommendation) to tackle these two gaps. To bridge the lexical gap, BIKER uses word embedding technique to calculate the similarity score between two text descriptions. Inspired by our survey findings that developers incorporate Stack Overflow posts and API documentation for bridging the knowledge gap, BIKER leverages Stack Overflow posts to extract candidate APIs for a program task, and ranks candidate APIs by considering the query’s similarity with both Stack Overflow posts and API documentation. It also summarizes supplementary information (e.g., API description, code examples in Stack Overflow posts) for each API to help developers select the APIs that are most relevant to their tasks. Our evaluation with 413 API-related questions confirms the effectiveness of BIKER for both class- and method-level API recommendation, compared with state-of-the-art baselines. Our user study with 28 Java developers further demonstrates the practicality of BIKER for API search.