DLTPy:使用自然语言上下文对Python函数签名进行深度学习类型推断
DLTPy: Deep Learning Type Inference of Python Function Signatures using Natural Language Context
摘要:
由于机器学习的兴起,Python是一种越来越流行的程序设计语言。Python是动态类型的。动态类型已经证明在项目增长时有缺点,同时它提高了开发人员的生产力。为了获得静态类型的好处,并结合开发人员的高生产力,需要推断类型。在本文中,我们提出了DLTPy:一种深度学习类型推断解决方案,用于基于函数的自然语言上下文(标识符名称,注释和返回表达式)预测函数签名中的类型。我们发现DLTPy是有效的,并且具有91.6%的前3名F1评分。这意味着在大多数情况下,正确的类型是在前3个预测之内。我们的结论是,自然语言中包含的评论和返回表达式是有益的预测类型更准确。DLTPy并没有明显优于或低于之前的NL2Type的JavaScript,但确实表明类似的预测是可能的Python。
英文摘要:
Due to the rise of machine learning, Python is an increasingly popular programming language. Python, however, is dynamically typed. Dynamic typing has shown to have drawbacks when a project grows, while at the same time it improves developer productivity. To have the benefits of static typing, combined with high developer productivity, types need to be inferred. In this paper, we present DLTPy: a deep learning type inference solution for the prediction of types in function signatures based on the natural language context (identifier names, comments and return expressions) of a function. We found that DLTPy is effective and has a top-3 F1-score of 91.6%. This means that in most of the cases the correct type is within the top-3 predictions. We conclude that natural language contained in comments and return expressions are beneficial to predicting types more accurately. DLTPy does not significantly outperform or underperform the previous work NL2Type for Javascript, but does show that similar prediction is possible for Python.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。