| Method naming technology is to automatically generate method names through the method body.The main purpose of this task is to help developers quickly obtain accurate method names to speed up the software development process.Previous research mainly used neural network technology to encode source code,train encoder and decoder models,and automatically generate method names.There are three problems with this kind of technology:(1)Long-range dependence problem.In the method,the definition statement of the variable is often far away from the use statement of the variable,which makes it difficult for the model to extract its characteristic information.(2)The code structural encoding problem.The programming language has strong structural characteristics,and the existing methods cannot effectively extract the structural information of the code.(3)The code semantic encoding problem.The existing methods do not consider the relationship between characters and words,resulting in insufficient word vector information.The existence of these three problems can not be unable to effectively extract the structure information and semantic information of the program,which restricts the effect of automatic method naming.In order to better extract the structural and semantic information in the program,this paper proposes a neural network model based on Graph Convolutional Network(GCN)—TrGCN(a Transformer and GCN based automatic method naming technique).Aiming at the three existing problems of the existing technology,TrGCN uses Transformer to alleviate the long-dependency problem,and introduces graph convolutional network,which can model the source code structure information well.And TrGCN adopts Character-word Attention mechanism to extract the semantic information of the code.TrGCN can effectively alleviate the long-range dependence problem in the method automatic naming task,and can effectively extract the structure and semantic information of the code.In the empirical research,this paper uses three data sets of different scales to evaluate the effectiveness of TrGCN.The experimental results show that TrGCN can outperform previous widely used approaches,code2seq and Sequence-GNNs,by 5.2 percentage points and 2.1 percentage points in terms of F1 metric,respectively. |