Despite recent research efforts, the vision of automatic code generation through API recommendation has not been realized. Accuracy and expressiveness challenges of API recommendation needs to be systematically addressed. We present a new neural network-based approach, Multi-HyLSTM for API recommendation --targeting cryptography-related code. Multi-HyLSTM leverages program analysis to guide the API embedding and recommendation. By analyzing the data dependence paths of API methods, we train embedding and specialize a multi-path neural network architecture for API recommendation tasks that accurately predict the next API method call. We address two previously unreported programming language-specific challenges, differentiating functionally similar APIs and capturing low-frequency long-range influences. Our results confirm the effectiveness of our design choices, including program-analysis-guided embedding, multi-path code suggestion architecture, and low-frequency long-range-enhanced sequence learning, with high accuracy on top-1 recommendations. We achieve a top-1 accuracy of 91.41% compared with 77.44% from the state-of-the-art tool SLANG. In an analysis of 245 test cases, compared with the commercial tool Codota, we achieve a top-1 recommendation accuracy of 88.98%, which is significantly better than Codota's accuracy of 64.90%. We publish our data and code as a large Java cryptographic code dataset.
翻译:尽管最近进行了研究努力,但通过API建议自动代码生成的愿景尚未实现。需要系统地应对API建议的准确性和清晰度挑战。我们展示了一种新的神经网络方法,即多HyLSTM,用于AIP建议 -- -- 定位密码相关代码。多HyLSTM利用程序分析来指导API嵌入和建议。通过分析API方法的数据依赖路径,我们为API建议任务培训嵌入并专门建立一个多路神经网络架构,以准确预测下一个API方法电话。我们应对了两个先前未报告的针对语言的具体编程挑战,在功能上相似的API和捕捉低频远程影响。我们的结果证实了我们设计选择的有效性,包括程序分析引导嵌入、多路码建议架构和低频远程强化序列学习。通过分析,在头1级建议中,我们实现了91.41%的最高准确度,而从最新工具SLING中获得了77.44%的准确度。在对245个测试案例的分析中,我们做了一个高度的精确度的COIAI的准确度数据,比我们做了一个高度的COBI的精确度数据,我们实现了一个高度数据,我们为285的精确度为88。我们的一个高度的CODOVAVAV的精确度数据,我们实现了一个高度数据,比我们的CO值的精确度为8。