计算机科学 ›› 2019, Vol. 46 ›› Issue (1): 219-225.doi: 10.11896/j.issn.1002-137X.2019.01.034

• 软件与数据库技术 • 上一篇    下一篇

基于方法约束关系的代码预测模型

方文渊, 刘琰, 朱玛   

  1. (数学工程与先进计算国家重点实验室 郑州450000)
  • 收稿日期:2017-12-17 出版日期:2019-01-15 发布日期:2019-02-25

Code-predicting Model Based on Method Constraints

FANG Wen-yuan, LIU Yan, ZHU Ma   

  1. (State Key Laboratory of Mathematical Engineering and Advanced Computing,Zhengzhou 450000,China)
  • Received:2017-12-17 Online:2019-01-15 Published:2019-02-25

摘要: 最新的研究表明,从大量源代码中提取代码特征,建立统计语言模型,对代码有着良好的预测能力。然而,现有的统计语言模型在建模时,往往采用代码中的文本信息作为特征词,对代码的语法结构信息利用不充分,预测准确率仍有提升空间。为提高代码预测性能,提出了方法的约束关系这一概念;在此基础上,研究Java对象的方法调用序列,抽象代码特征,构建统计语言模型来完成代码预测,并研究基于方法约束关系的代码预测模型在Java语言中的适用范围。实验表明,该方法较现有的模型提高了8%的准确率。

Abstract: The state-of-the-art study shows that extracting the code features from a large amount of source codes and building the statistical language model have good predictive ability for the codes.However,the present methods still can be polished in the predicting accuracy,because when they build the existing statistical language model,the text information in the codes is often used as feature words,which means that the syntax structure information of the codes can not be fully utilized.In order to improve the predicting performance of the code,this paper proposed the concept of the constraint relation of methods.Based on this,this paper studied the method invocation sequence of Java objects,abstracted code features,and built the statistical language model to complete the code prediction.Moreover,this paper studied the application scope of the prediction model based on the method constraint relationship in Java language.Experiments show that this method improves the accuracy by 8% compared with the existing model.

[1]BECKMAN N E,KIM D,ALDRICH J.An Empirical Study of Object Protocols in the Wild[C]//European Conference on Object-Oriented Programming.Springer-Verlag,2011:2-26.<br /> [2]WASYLKOWSKI A,ZELLER A.Mining Temporal Specifications from Object Usage[C]//IEEE/ACM International Confe-rence on Automated Software Engineering.IEEE,2009:295-306.<br /> [3]WEIMER W,NECULA G C.Mining temporal specifications for error detection//International Conference on Tools and Algorithms for the Construction and Analysis of Systems.Sprin-ger,Berlin,Heidelberg,2005:461-476.<br /> [4]GABEL M,SU Z.A study of the uniqueness of source code[C]//Eighteenth ACM Sigsoft International Symposium on Foundations of Software Engineering.ACM,2010:147-156.<br /> [5]HINDLE A,BARR E T,SU Z,et al.On the naturalness of soft-ware[C]//International Conference on Software Engineering.IEEE,2012:837-847.<br /> [6]RAYCHEV V,VECHEV M,YAHAV E.Code completion with statistical language models[C]//Acm Sigplan Symposium on Programming Language Design & Implementation.ACM,2014:419-428.<br /> [7]HOLMES R,MURPHY G C.Using structural context to recommend source code examples[C]//International Conference on Software Engineering.2005:117-125.<br /> [8]ZHONG H,XIE T,ZHANG L,et al.MAPO:Mining and Recommending API Usage Patterns[C]//ECOOP 2009-Object-Oriented Programming.Springer Berlin Heidelberg,2009:318-343.<br /> [9]HAN S,WALLACE D R,MILLER R C.Code Completion from Abbreviated Input[C]//IEEE/ACM International Conference on Automated Software Engineering.IEEE,2009:332-343..<br /> [10]MISHNE A,SHOHAM S,YAHAV E.Typestate-based semantic code search over partial programs[J].Acm Sigplan Notices,2012,47(10):997-1016.<br /> [11]ALLAMANIS M,SUTTON C.Mining idioms from source code//Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering.ACM,2014:472-483.<br /> [12]NGUYEN A T,NGUYEN T N.Graph-Based Statistical Language Model for Code[C]//IEEE/ACM,IEEE International Conference on Software Engineering.IEEE,2015:858-868.<br /> [13]HSIAO C H,CAFARELLA M,NARAYANASAMY S.Using web corpus statistics for program analysis[J].ACM Sigplan Notices,2014,49(10):49-65.<br /> [14]NGUYEN T T,NGUYEN A T,NGUYEN H A,et al.A statistical semantic language model for source code[C]//Joint Mee-ting on Foundations of Software Engineering.2013:532-542.<br /> [15]ECKEL B.Thinking in Java (4th Edition)[M].Prentice Hall PTR,2005.<br /> [16]Stackoverflow[OL].http://www.stackoverflow.com.<br /> [17]ROLAND H.Foundations of statistical natural language processing[M].The MIT Press,1999.<br /> [18]Github[OL].https://github.com.<br /> [19]GAGNON V S P L E,VALLÉE-RAI R,HENDREN L.Soo-a java optimization framework//Proceedings of CASCON.1999:125-135.
No related articles found!
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!