DLTPy: Deep Learning Type Inference of Python Function Signatures using Natural Language Context

Casper Boone, Niels de Bruin, Arjan Langerak, Fabian Stelmach
12/2/2019
cs.SEcs.LG

Official code: casperboone/dltpy (17 stars, Jupyter Notebook, MIT, last commit 2024-05-03).

Abstract

Due to the rise of machine learning, Python is an increasingly popular programming language. Python, however, is dynamically typed.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

casperboone/dltpyOfficial100%
MIT

 🐍 Deep Learning Type Inference of Python Function Signatures using their Natural Language Context

176Jupyter Notebook, TeXSep 19, 20192 years agoMIT
deep-learningpythontypeinference

Similar Papers

Cite this paper

@article{boone2019dltpy,
  title  = {DLTPy: Deep Learning Type Inference of Python Function Signatures using Natural Language Context},
  author = {Casper Boone and Niels de Bruin and Arjan Langerak and Fabian Stelmach},
  year   = {2019},
  eprint = {1912.00680},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1912.00680}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1912.00680.svg)](https://codeofpaper.com/paper/1912.00680)

Discussion