arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 1809.05193cs.SEcs.LGcs.PLstat.ML
收藏

Context2Name:一种基于深度学习的从使用上下文推断自然变量名称的方法

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

University of California, Berkeley(加州大学伯克利分校);TU Darmstadt(达姆施塔特工业大学)

Rohan Bavishi, Michael Pradel, Koushik Sen

摘要:

大多数部署在野外的JavaScript代码都被缩小了,在这个过程中,标识符名称被替换为简短、任意和无意义的名称。精简的代码占用更少的空间,但也使代码非常难以手动检查和理解。本文介绍了Context2Name,这是一种基于深度学习的技术,通过预测缩小名称的自然标识符名称来部分逆转缩小的效果。核心思想是根据变量的使用上下文预测一个捕获变量含义的名称。该方法结合了一个轻量级的,基于令牌的静态分析与自动编码器神经网络,总结使用上下文和一个循环神经网络,预测一个给定的使用上下文的自然名称。我们评估的Context2Name与现实世界的JavaScript代码的大型语料库,并表明,它成功地预测了47.5%的所有缩小的标识符,而平均只需2.9毫秒预测一个名字。与最先进的工具JSNice和JSNaughty的比较表明,我们的方法在准确性方面表现出色,同时在效率方面有所提高。此外,Context2Name通过预测5.3%的额外标识符来补充现有工具所遗漏的最新技术。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑