Unlock instant, AI-driven research and patent intelligence for your innovation.

Construction method of code prediction model based on method constraint relationship

A technology for predicting models and constraint relationships, applied in the software field, can solve problems such as insufficient utilization of grammatical structure relationships, and achieve the effect of high code prediction accuracy

Active Publication Date: 2021-05-25
PLA STRATEGIC SUPPORT FORCE INFORMATION ENG UNIV PLA SSF IEU
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0006] The present invention aims at the problem that the existing natural language-based code prediction model makes insufficient use of the grammatical structure relationship between codes, and proposes a method for constructing a code prediction model based on the method constraint relationship. The method prediction model constructed by the present invention has a higher code Prediction accuracy

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Construction method of code prediction model based on method constraint relationship
  • Construction method of code prediction model based on method constraint relationship
  • Construction method of code prediction model based on method constraint relationship

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0048] Such as figure 1 As shown, a method for constructing a code prediction model based on a method constraint relationship of the present invention includes the following steps:

[0049] Step S101: Abstracting the object-oriented code into a set of method call statement sequences involved in an object, the set of method call statement sequences including a plurality of method call statement sequences; the method call statement sequence including all method call statements involved in an object;

[0050] Step S102: According to the constraint relationship between methods, express the method call statement of the method call statement sequence as a quaternary feature group, and obtain the code feature word sequence set of the object-oriented code according to the quaternary feature group;

[0051] Step S103: using the N-gram model to slide and segment the code feature word sequence set into multiple 3-gram sequences, extract and call the 3-gram sequences, and construct a code...

Embodiment 2

[0053] Such as figure 2 As shown, another method for constructing a code prediction model based on the method constraint relationship of the present invention includes the following steps:

[0054] Step S201: abstracting the object-oriented code into a set of method call statement sequences involved in an object, the set of method call statement sequences including multiple method call statement sequences; the method call statement sequence including all method call statements involved in an object;

[0055] The step S201 includes:

[0056] Step S2011: classify the method call statements in the object-oriented code according to different objects, keep the mutual order of the method call statements unchanged, copy multiple copies of the method call statements containing multiple objects, and put them into each object , Code={Object 1 ,Object 2 ,...,Object n}, Object=Method 1 ·Method 2 ...Method n

[0057] where Object n Indicates all method call statements involved in...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention belongs to the technical field of software, and particularly relates to a method for constructing a code prediction model based on a method constraint relationship. A method for constructing a code prediction model based on a method constraint relationship includes: abstracting object-oriented code into a set of method invocation statement sequences related to objects, the method invocation statement sequence set including multiple method invocation statement sequences; the method invocation statement sequence including All method invocation statements involved in an object; according to the constraint relationship between methods, the method invocation statement of the method invocation statement sequence is represented as a four-element feature group, and the object-oriented code is obtained according to the four-element feature group. A set of code feature word sequences; the N-gram model is used to slide the set of code feature word sequences into multiple 3-gram sequences, and the 3-gram sequences are extracted and called to construct a code prediction model. The method prediction model constructed by the invention has higher code prediction accuracy.

Description

technical field [0001] The invention belongs to the technical field of software, in particular to a method for constructing a code prediction model based on a method constraint relationship. Background technique [0002] During the software development process, developers need to call a large number of APIs to realize various functions of the software. Unfortunately, developers often don't know how to use all APIs. When an unfamiliar class needs to be used, even experienced developers need to spend a lot of time learning how to use the class and the dozens of APIs it contains. In order to improve the efficiency of software development, building a code prediction model and implementing code recommendation has become a research hotspot in the field of code analysis. [0003] Previous research has shown that programming languages ​​have good reproducibility. Gabel et al. (Gabel M, Su Z. Astudy of the uniqueness of source code [C]. Eighteenth ACM Sigsoft International Symposi...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F11/36
CPCG06F11/3608
Inventor 刘琰方文渊魏强刘楝张文悦左青松
Owner PLA STRATEGIC SUPPORT FORCE INFORMATION ENG UNIV PLA SSF IEU