Computer Science ›› 2019, Vol. 46 ›› Issue (1): 219-225.doi: 10.11896/j.issn.1002-137X.2019.01.034

• Software & Database Technology • Previous Articles     Next Articles

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

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].<br /> [17]ROLAND H.Foundations of statistical natural language processing[M].The MIT Press,1999.<br /> [18]Github[OL].<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!
Full text



[1] . [J]. Computer Science, 2018, 1(1): 1 .
[2] LEI Li-hui and WANG Jing. Parallelization of LTL Model Checking Based on Possibility Measure[J]. Computer Science, 2018, 45(4): 71 -75, 88 .
[3] XIA Qing-xun and ZHUANG Yi. Remote Attestation Mechanism Based on Locality Principle[J]. Computer Science, 2018, 45(4): 148 -151, 162 .
[4] LI Bai-shen, LI Ling-zhi, SUN Yong and ZHU Yan-qin. Intranet Defense Algorithm Based on Pseudo Boosting Decision Tree[J]. Computer Science, 2018, 45(4): 157 -162 .
[5] WANG Huan, ZHANG Yun-feng and ZHANG Yan. Rapid Decision Method for Repairing Sequence Based on CFDs[J]. Computer Science, 2018, 45(3): 311 -316 .
[6] SUN Qi, JIN Yan, HE Kun and XU Ling-xuan. Hybrid Evolutionary Algorithm for Solving Mixed Capacitated General Routing Problem[J]. Computer Science, 2018, 45(4): 76 -82 .
[7] ZHANG Jia-nan and XIAO Ming-yu. Approximation Algorithm for Weighted Mixed Domination Problem[J]. Computer Science, 2018, 45(4): 83 -88 .
[8] WU Jian-hui, HUANG Zhong-xiang, LI Wu, WU Jian-hui, PENG Xin and ZHANG Sheng. Robustness Optimization of Sequence Decision in Urban Road Construction[J]. Computer Science, 2018, 45(4): 89 -93 .
[9] LIU Qin. Study on Data Quality Based on Constraint in Computer Forensics[J]. Computer Science, 2018, 45(4): 169 -172 .
[10] ZHONG Fei and YANG Bin. License Plate Detection Based on Principal Component Analysis Network[J]. Computer Science, 2018, 45(3): 268 -273 .