Font Size: a A A

Research On Code Block Completed Recommendation Algorithm Based On Variance Code Clone Search

Posted on:2020-11-04Degree:MasterType:Thesis
Country:ChinaCandidate:K Q YinFull Text:PDF
GTID:2428330572474161Subject:Computer application technology
Abstract/Summary:PDF Full Text Request
As a method to improve the efficiency of software development,code completed recommendation has always been a popular research in software engineering.The ex-isting code completion recommendation algorithms are mostly for keyword and state-ment granularity.This granularity of recommendation can provide a small amount of code information,so there is a problem of inefficiency.And modern software develop-ment requires a large number of code recommendations such as code blocks.In order to achieve large-granularity code completed recommendation,it is necessary to search similar code in the code repository.However,due to the incompleteness of the code to be completed,there is a large-gap variance from the complete code,which makes it difficult to search for similar code.Recently,a new large-gap code clone algorithm CCAligner has been proposed,which makes it possible to recommend code completion with block granularity.This thesis proposes a new code block completed recommenda-tion algorithm based on the modification of the variance code clone algorithm and the utilization of a large number of existing high-quality code repository.The main work and contributions of the thesis are as follows:(1)Research and modification of variance code clone technologyThis thesis uses the large-gap code clone algorithm to search the code repository for candidate code blocks similar to the code to be completed.But because the large-gap code clone algorithm is used to find all the variance code clone pairs that are cloned in one code set,this thesis searches for the variance code block similar to the code to be completed in the code set.The requirements for algorithm search are different,so the original algorithm needs to be modified to reduce the computational cost and improve the pertinence.In order to solve the above problems,we change the search mode of the large-gap code clone algorithm from many-to-many to one-to-many,increase the pre-processing to filter all the code blocks unrelated to the code to be completed,and select the optimized algorithm parameters through computational experiments.The experimental results show that the modified algorithm has only 10.7%of the original algorithm detection time in the 5M LOC code repository.For the algorithm parameters with 5 sliding windows,1 mismatch and 0.5 similarity threshold,the F value of the original algorithm parameter can be increased by more than 10%.(2)Design and implementation of code block completed recommendation al-gorithmBased on the above work,we further design the completed recommendation al-gorithm for candidate code blocks in search results.Since there are a lot of duplicate codes in the code repository,in order to prevent the same or similar candidate codes from being repeatedly recommended,this thesis makes the same or similar code blocks as a category of recommendation by clustering the searched results(candidate codes).In addition,in order to ensure the usefulness of the recommended code,the candidate code blocks of the cluster need to be scored,so that the candidate code blocks with high correlation are preferentially recommended.According to the characteristics of the problem,DBSCAN is selected as the clustering algorithm to cluster the search re-sults.After clustering,we select a code block from each category as a representative.Then,the code blocks are scored in terms of the frequency of the code blocks,the syn-tax similarity and the semantic similarity of the code blocks,and the code blocks is recommended in the order of scores.The experimental results show that the method of this thesis has been put back and not put back into the calculation experiment on the Android Social Network dataset.The accuracy of Top-3 is 93.75%and 68.75%respec-tively.Compared with the recommendation method which can only complete the tail code block,the accuracy of Top-1 is improved by 20%to 30%.
Keywords/Search Tags:Code Completion, Code Recommendation, Variance Code Clone Search, Feature Extraction, Clustering
PDF Full Text Request
Related items