使用神经嵌入和机器翻译从自然语言描述生成上下文感知API调用

H. Phan, Arushi Sharma, A. Jannesari
{"title":"使用神经嵌入和机器翻译从自然语言描述生成上下文感知API调用","authors":"H. Phan, Arushi Sharma, A. Jannesari","doi":"10.1109/ASEW52652.2021.00050","DOIUrl":null,"url":null,"abstract":"API calls can be described using natural language and can be implemented using a programming language. A programming environment that can process natural language descriptions within source code and provide context aware code suggestions can significantly improve productivity of developers and make programming more accessible to non-programmers and less experienced programmers. This paper proposes a context-aware tool called API Call Programming Interface (ACPI) which allows developers to write a natural language description for methods within source code and get correct and compilable API Call (AC) based on the text description and surrounding code. Existing work and code suggestion tools only consider the user's natural language description as input and ignore the contextual surrounding code. We take surrounding code into account and include information about local variable names within the code suggestion. Our approach consists of three modules. First, Method Name Generator, an unsupervised neural-embeddings-based algorithm to map the natural language description of methods to a list of most likely method names. Second, an AST Generator, a supervised Machine Translation model that predicts the structure of the AST from the list of the method names. And third, a Code Synthesizer that assigns local variables names to the AST to get the final method calls. Further, we include a Ranking Module that ranks the list of suggested method names based on their completeness. We evaluated our approach on data from 1000 high-quality Java projects and achieved an accuracy of 61% for API calls suggestions from natural language descriptions, which outperforms prior work and demonstrates the potential of our approach. We also conducted productivity experiments with 148 undergraduate participants to measure the usefulness of ACPI. The experiment showed that programming with ACPI can reduce programming time by 45% and increase programming accuracy from 19% to 83% when compared to programming without ACPI in four code completion tasks.","PeriodicalId":349977,"journal":{"name":"2021 36th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW)","volume":"74 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-11-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"5","resultStr":"{\"title\":\"Generating Context-Aware API Calls from Natural Language Description Using Neural Embeddings and Machine Translation\",\"authors\":\"H. Phan, Arushi Sharma, A. Jannesari\",\"doi\":\"10.1109/ASEW52652.2021.00050\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"API calls can be described using natural language and can be implemented using a programming language. A programming environment that can process natural language descriptions within source code and provide context aware code suggestions can significantly improve productivity of developers and make programming more accessible to non-programmers and less experienced programmers. This paper proposes a context-aware tool called API Call Programming Interface (ACPI) which allows developers to write a natural language description for methods within source code and get correct and compilable API Call (AC) based on the text description and surrounding code. Existing work and code suggestion tools only consider the user's natural language description as input and ignore the contextual surrounding code. We take surrounding code into account and include information about local variable names within the code suggestion. Our approach consists of three modules. First, Method Name Generator, an unsupervised neural-embeddings-based algorithm to map the natural language description of methods to a list of most likely method names. Second, an AST Generator, a supervised Machine Translation model that predicts the structure of the AST from the list of the method names. And third, a Code Synthesizer that assigns local variables names to the AST to get the final method calls. Further, we include a Ranking Module that ranks the list of suggested method names based on their completeness. We evaluated our approach on data from 1000 high-quality Java projects and achieved an accuracy of 61% for API calls suggestions from natural language descriptions, which outperforms prior work and demonstrates the potential of our approach. We also conducted productivity experiments with 148 undergraduate participants to measure the usefulness of ACPI. The experiment showed that programming with ACPI can reduce programming time by 45% and increase programming accuracy from 19% to 83% when compared to programming without ACPI in four code completion tasks.\",\"PeriodicalId\":349977,\"journal\":{\"name\":\"2021 36th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW)\",\"volume\":\"74 1\",\"pages\":\"0\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2021-11-01\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"5\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"2021 36th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW)\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/10.1109/ASEW52652.2021.00050\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"2021 36th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/ASEW52652.2021.00050","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 5

摘要

API调用可以用自然语言描述,也可以用编程语言实现。能够处理源代码中的自然语言描述并提供上下文感知的代码建议的编程环境可以显著提高开发人员的生产力,并使非程序员和经验不足的程序员更容易接受编程。本文提出了一种上下文感知的API调用编程接口(API Call Programming Interface, ACPI)工具,它允许开发人员对源代码中的方法编写自然语言描述,并根据文本描述和周围代码获得正确的可编译API调用(API Call, AC)。现有的工作和代码建议工具只考虑用户的自然语言描述作为输入,而忽略了周围的上下文代码。我们考虑周围的代码,并在代码建议中包含有关局部变量名的信息。我们的方法由三个模块组成。首先,方法名称生成器,这是一种基于无监督神经嵌入的算法,用于将方法的自然语言描述映射到最可能的方法名称列表。第二个是AST生成器,这是一个监督机器翻译模型,它从方法名列表中预测AST的结构。第三,一个代码合成器,它将局部变量名称分配给AST以获得最终的方法调用。此外,我们还包含了一个Ranking模块,该模块根据建议的方法名称的完整性对其列表进行排序。我们在来自1000个高质量Java项目的数据上评估了我们的方法,从自然语言描述中获得API调用建议的准确率达到了61%,这优于之前的工作,并展示了我们方法的潜力。我们还对148名大学生参与者进行了生产力实验,以衡量ACPI的有用性。实验表明,在4个代码完成任务中,与不使用ACPI的编程相比,使用ACPI的编程时间缩短了45%,编程精度从19%提高到83%。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
Generating Context-Aware API Calls from Natural Language Description Using Neural Embeddings and Machine Translation
API calls can be described using natural language and can be implemented using a programming language. A programming environment that can process natural language descriptions within source code and provide context aware code suggestions can significantly improve productivity of developers and make programming more accessible to non-programmers and less experienced programmers. This paper proposes a context-aware tool called API Call Programming Interface (ACPI) which allows developers to write a natural language description for methods within source code and get correct and compilable API Call (AC) based on the text description and surrounding code. Existing work and code suggestion tools only consider the user's natural language description as input and ignore the contextual surrounding code. We take surrounding code into account and include information about local variable names within the code suggestion. Our approach consists of three modules. First, Method Name Generator, an unsupervised neural-embeddings-based algorithm to map the natural language description of methods to a list of most likely method names. Second, an AST Generator, a supervised Machine Translation model that predicts the structure of the AST from the list of the method names. And third, a Code Synthesizer that assigns local variables names to the AST to get the final method calls. Further, we include a Ranking Module that ranks the list of suggested method names based on their completeness. We evaluated our approach on data from 1000 high-quality Java projects and achieved an accuracy of 61% for API calls suggestions from natural language descriptions, which outperforms prior work and demonstrates the potential of our approach. We also conducted productivity experiments with 148 undergraduate participants to measure the usefulness of ACPI. The experiment showed that programming with ACPI can reduce programming time by 45% and increase programming accuracy from 19% to 83% when compared to programming without ACPI in four code completion tasks.
求助全文
通过发布文献求助,成功后即可免费获取论文全文。 去求助
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:604180095
Book学术官方微信