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

By Rohan Bavishi, Michael Pradel, Koushik Sen. 2017

65 citations recorded by the source corpus.

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% of all minified 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% additional identifiers that are missed by both existing tools.

Subfields: Artificial Intelligence, Information Systems, Natural Language Processing

How researchers see this paper

The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.

In Artificial Intelligence

  1. Miltiadis Allamanis
  2. Charles Sutton
  3. Romain Robbes
  4. Hlib Babii
  5. Andrea Janes
  6. Rafael-Michael Karampatsis
  7. Earl T. Barr
  8. Premkumar T. Devanbu

In Information Systems

  1. Charles Sutton
  2. Miltiadis Allamanis
  3. Michael Pradel
  4. Rafael-Michael Karampatsis
  5. Earl T. Barr
  6. Romain Robbes
  7. Hlib Babii
  8. Andrea Janes

In Natural Language Processing

  1. Charles Sutton
  2. Michael Pradel
  3. Miltiadis Allamanis
  4. Premkumar T. Devanbu
  5. Rafael-Michael Karampatsis
  6. Earl T. Barr
  7. Baptiste Rozière
  8. Marie-Anne Lachaux

Citations in the corpus