The invention discloses a
software defect prediction method and terminal based on a bidirectional long short-
term memory neural network, and the method comprises the steps: enabling an
abstract syntax tree of a
source code file and a
source code to correspond to code change information between different versions through the bidirectional long short-
term memory neural network; screening and extracting an
abstract syntax tree point node sequence and a code change node sequence, connecting and constructing a combined sequence, inputting the combined sequence into a Word2Vec
word embedding model, encoding the combined sequence into a word vector, fusing semantic features and traditional features by utilizing traditional measurement features provided by a PROMISE
library and combining a gating fusion strategy to form combined features, and constructing a word vector; and inputting the combined features and the corresponding labels into a classifier to
train a defect prediction model. According to the method, richer code semantic features are extracted from a
source code abstract syntax tree and code change data, traditional features provided by a PROMISE storage
library are combined, a classifier model is better helped to learn the semantic features, and a more accurate defect prediction result is obtained.