Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Code fragment recommendation method considering code statement sequence information

A technology of code fragments and code statements, which is applied in the field of code fragment recommendation considering the sequence information of code statements, can solve the problems of insufficient consideration of similarity, poor sorting effect, loss of structural information and sequence information, etc., and achieve good sorting effect

Active Publication Date: 2019-04-16
NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF4 Cites 11 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Existing code recommendation technologies mostly use code text information to make relevant recommendations. Only using text information for code recommendation will cause the loss of the structural information and sequence information of the code itself, resulting in inaccurate recommendation results.
And the existing code recommendation technology does not fully consider the similarity between the final recommendation result and the current programming context, which will lead to poor final ranking effect

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
  • Code fragment recommendation method considering code statement sequence information
  • Code fragment recommendation method considering code statement sequence information
  • Code fragment recommendation method considering code statement sequence information

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0043] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.

[0044] like figure 1 As shown, a method for recommending code fragments that considers the sequence information of code statements disclosed in the embodiment of the present invention mainly involves two stages, a data processing stage and a recommendation stage, and its core lies in the recommendation stage.

[0045] In the data processing stage, the input is the open source Java application project collected from the open source software hosting platform Github, and the output is the code database, which consists of 4 parts: formatted code snippets, declared variable types, structural information, and LC sequences ( Last Column Sequence, LC sequence refers to the new sequence generated by the conversion step of the BWT algorithm by taking the cleaned code fragment as input). Its specific steps can be divided into 5 steps:

[0046] 1) Extrac...

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 discloses a code fragment recommendation method considering code statement sequence information, which comprises the following steps: obtaining a current code context, carrying out formatting, structure information and declarated variable type extraction, and converting a cleaned code fragment into an LC sequence; calculating BWT similarity and variable type similarity of the code segments in the code database and the current code context, and obtaining a plurality of code segments with the highest similarity with the current code context as candidate sets; and reordering the candidate code segments according to the BWT similarity, variable similarity and structural similarity of the code segments in the candidate set and the current code context, and presenting a reordered list to the user. Compared with the prior art, the sequence information between the code statements is used, so that the similarity between the recommended code snippets and the query is higher, and auser can better use the recommended code snippets. And moreover, structural information is introduced in the sorting process, so that a better sorting effect can be achieved.

Description

technical field [0001] The invention relates to code recommendation, in particular to a method for recommending code fragments considering the sequence information of code statements. Background technique [0002] A code fragment refers to a set of code sequences, which can guide developers to quickly grasp the usage of a certain program interface or the implementation method of a certain programming task. In recent years, research in the direction of code recommendation has focused on how to use information retrieval or machine learning for code recommendation. The code features used in these studies are relatively single, and they all focus on the text information of the code. Taking ROSF as an example, in the data preparation stage, it first divides the Java project into multiple class files, and then divides the class files into multiple code fragments. Afterwards, for each code fragment, it uses topic models, code metrics, etc. to extract three features of code fragme...

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
IPC IPC(8): G06F8/33G06F8/36
CPCG06F8/33G06F8/36
Inventor 李伟湋艾磊黄志球周宇陶传奇张智轶
Owner NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products