论文标题
以编程任务知识图为促进的以任务为导向的API用法示例
Task-Oriented API Usage Examples Prompting Powered By Programming Task Knowledge Graph
论文作者
论文摘要
通常创建编程教程以通过代码示例演示编程任务。但是,我们对堆栈溢出问题的研究表明,高质量编程教程的利用率较低,这是由任务说明不匹配和代码信息过载导致的。文档搜索可以找到相关的教程文档,但是他们通常找不到与开发人员任务需求相关的特定编程操作和代码解决方案。最近提出的以活动为中心的知识图搜索支持对编程操作的直接搜索,但在动作覆盖范围,基于自然语言的任务搜索和粗粒度的代码示例建议方面具有局限性。在这项工作中,我们在知识图中增强了动作覆盖范围,并从代码示例中提取的注释和更多形式的活动句子中提取的动作。为了克服任务描述不匹配问题,我们开发了一种基于代码的任务搜索方法,以查找相关的编程操作和代码示例,以便为正在开发的代码找到。我们将知识图和任务搜索方法集成到IDE中,并开发一种基于观察的PUSH工具,以提示开发人员使用以任务为导向的API使用示例。为了减轻代码信息过载问题,我们的工具强调了基于基础知识图的提示教程任务摘录和代码示例中的编程操作和API信息。我们的评估证实了构造的知识图的高质量,并表明我们的基于代码的任务搜索可以将有效的代码解决方案推荐给堆栈溢出的编程问题。一项小型用户研究表明,我们的工具有助于协助开发人员在其编程任务中查找和使用相关的编程教程。
Programming tutorials are often created to demonstrate programming tasks with code examples. However, our study of Stack Overflow questions reveals the low utilization of high-quality programming tutorials, which is caused task description mismatch and code information overload. Document search can find relevant tutorial documents, but they often cannot find specific programming actions and code solutions relevant to the developers' task needs. The recently proposed activity-centric search over knowledge graph supports direct search of programming actions, but it has limitations in action coverage, natural language based task search, and coarse-grained code example recommendation. In this work, we enhance action coverage in knowledge graph with actions extracted from comments in code examples and more forms of activity sentences. To overcome the task description mismatch problem, we develop a code matching based task search method to find relevant programming actions and code examples to the code under development. We integrate our knowledge graph and task search method in the IDE, and develop an observe-push based tool to prompt developers with task-oriented API usage examples. To alleviate the code information overload problem, our tool highlights programming action and API information in the prompted tutorial task excerpts and code examples based on the underlying knowledge graph. Our evaluation confirms the high quality of the constructed knowledge graph, and show that our code matching based task search can recommend effective code solutions to programming issues asked on Stack Overflow. A small-scale user study demonstrates that our tool is useful for assisting developers in finding and using relevant programming tutorials in their programming tasks.