The invention discloses a code abstract generation method based on a code
knowledge graph and knowledge migration. The method comprises the following steps: 1, extracting and fusing multi-source datato construct the code
knowledge graph; 2, generating an
abstract syntax tree by using a code
parsing tool, and traversing method calling nodes in the
abstract syntax tree to obtain an API calling sequence; 3, searching API description information in the API calling sequence from the code
knowledge graph; 4, mining large-scale
open source projects, constructing an API sequence abstract generation
data set, training a text abstract generation model, and learning background knowledge related to API functions; 5, constructing a code abstract generation model; and 6, training a code abstract generation model on the code abstract
data set, and generating a code abstract by utilizing the model. According to the method, the code knowledge graph and knowledge migration are used for the code abstract generation task, the ability of the model to extract code functional
semantic information can be enhanced, the model is assisted in understanding codes, and the code abstract generation quality is improved.