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

Code clone detection method based on GAT graph neural network model

A neural network model and detection method technology, which is applied in the field of code clone detection and code clone detection based on GAT graph neural network model, can solve the problems that the model cannot be used directly, and can improve the information feature extraction ability and granularity. The effect of being meticulous and improving the effect of training

Pending Publication Date: 2022-01-21
NANJING UNIV
View PDF0 Cites 9 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Although GCN can effectively process the first-order neighbors of nodes in the graph and avoid complex matrix operations, the model relies heavily on the structure of the graph
Therefore, models trained on specific graph structures often cannot be directly used on other graph structures

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 clone detection method based on GAT graph neural network model
  • Code clone detection method based on GAT graph neural network model
  • Code clone detection method based on GAT graph neural network model

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0038] In order to make the purpose, technical solution and advantages of the present invention clearer, the present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0039] The object of the invention is to solve the problem of code clone detection, and propose a code clone detection method based on a GAT graph neural network model. Add artificially defined additional edges to the abstract syntax tree AST of code fragments to obtain a graph representation structure. Compared with existing code graph representations such as PDG or CFG, this representation has a finer granularity and contains more information; Using the graph neural network model can learn the internal information of the code text graph to represent the information data. The attention mechanism used in it can pay more attention to the key part information of the code graph structure. Combined with the weight parameter sharing technology, the int...

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 clone detection method based on a GAT graph neural network model, and the method comprises the following steps: extracting and generating clone code data of a corresponding definition from a programming competition website and an existing code clone data set according to the definition of a clone code; analyzing the code text to generate an AST abstract syntax tree; adding an artificially defined additional edge on the basis of the AST abstract syntax tree to generate a representation graph; inputting the code representation graph into a GAT network model for training to obtain a graph representation vector; splicing representation vectors of the cloning code pairs and inputting the representation vectors into a binary classification network; and judging an output code cloning prediction result. According to the method, the problem that the code semantic clone detection capability is insufficient in the code clone detection field is solved, the code text is converted into the graph structure representation, clone code information is represented from the semantic and structural level, the internal relation of learning clone codes can be accurately obtained, clone code judgment and prediction are carried out, and the code clone detection accuracy is improved.

Description

technical field [0001] The invention relates to a code clone detection method, in particular to a code clone detection method based on a GAT graph neural network model, and belongs to the technical fields of artificial intelligence natural language processing and graph neural network. Background technique [0002] The problem of code cloning is very common in the software development process, and the method of detecting code cloning is also a very classic problem in the field of software engineering. Generally speaking, there are two reasons for code cloning. The first reason is that developers search for relevant codes through some online question-and-answer websites, such as StackOverflow, etc., and then directly copy and paste the code written by others; the second reason is that Some well-designed code fragments are directly reused. Therefore, it can be seen that the impact of code cloning is two-way, both good and bad. The good effect is that excellent code components...

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 Applications(China)
IPC IPC(8): G06F8/75G06K9/62G06N3/04G06N3/08
CPCG06F8/751G06N3/04G06N3/08G06F18/24G06F18/214
Inventor 葛季栋李传艺惠天宇唐泽
Owner NANJING UNIV
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