Context2Name: A Deep Learning-Based Approach to Infer Natural Variable Names from Usage Contexts

08/31/2018
by   Rohan Bavishi, et al.
0

Most of the JavaScript code deployed in the wild has been minified, a process in which identifier names are replaced with short, arbitrary and meaningless names. Minified code occupies less space, but also makes the code extremely difficult to manually inspect and understand. This paper presents Context2Name, a deep learningbased technique that partially reverses the effect of minification by predicting natural identifier names for minified names. The core idea is to predict from the usage context of a variable a name that captures the meaning of the variable. The approach combines a lightweight, token-based static analysis with an auto-encoder neural network that summarizes usage contexts and a recurrent neural network that predict natural names for a given usage context. We evaluate Context2Name with a large corpus of real-world JavaScript code and show that it successfully predicts 47.5 identifiers while taking only 2.9 milliseconds on average to predict a name. A comparison with the state-of-the-art tools JSNice and JSNaughty shows that our approach performs comparably in terms of accuracy while improving in terms of efficiency. Moreover, Context2Name complements the state-of-the-art by predicting 5.3

READ FULL TEXT
research
06/08/2019

Recovering Variable Names for Minified Code with Usage Contexts

In modern Web technology, JavaScript (JS) code plays an important role. ...
research
12/12/2021

Nalin: Learning from Runtime Behavior to Find Name-Value Inconsistencies in Jupyter Notebooks

Variable names are important to understand and maintain code. If a varia...
research
02/25/2019

Neural Reverse Engineering of Stripped Binaries

We address the problem of predicting procedure names in stripped executa...
research
03/01/2021

Roosterize: Suggesting Lemma Names for Coq Verification Projects Using Deep Learning

Naming conventions are an important concern in large verification projec...
research
03/26/2018

code2vec: Learning Distributed Representations of Code

We present a neural model for representing snippets of code as continuou...
research
06/13/2019

Figurative Usage Detection of Symptom Words to Improve Personal Health Mention Detection

Personal health mention detection deals with predicting whether or not a...
research
09/19/2021

Rethnicity: Predicting Ethnicity from Names

I provide an R package, , for predicting ethnicity from names. I use the...

Please sign up or login with your details

Forgot password? Click here to reset