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

12/02/2019
by   Casper Boone, et al.
0

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 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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
01/12/2021

Type4Py: Deep Similarity Learning-Based Type Inference for Python

Dynamic languages, such as Python and Javascript, trade static typing fo...
research
12/08/2019

TypeWriter: Neural Type Prediction with Search-based Validation

Maintaining large code bases written in dynamically typed languages, suc...
research
08/04/2023

TIPICAL – Type Inference for Python In Critical Accuracy Level

Type inference methods based on deep learning are becoming increasingly ...
research
05/08/2021

HiTyper: A Hybrid Static Type Inference Framework with Neural Prediction

Type inference for dynamic programming languages is an important yet cha...
research
07/18/2023

Generative Type Inference for Python

Python is a popular dynamic programming language, evidenced by its ranki...
research
04/16/2021

A Gradual Type System for Elixir

Elixir is a functional programming language with dynamic typing. We prop...
research
12/15/2021

torch.fx: Practical Program Capture and Transformation for Deep Learning in Python

Modern deep learning frameworks provide imperative, eager execution prog...

Please sign up or login with your details

Forgot password? Click here to reset