Code feature extraction method and system based on hierarchical comparative learning

The invention discloses a code feature extraction method and system based on hierarchical comparative learning. The method comprises: obtaining a to-be-processed code; analyzing the to-be-processed code snippets to generate an AST tree; performing embedding representation on the AST tree to obtain a...

Ausführliche Beschreibung

Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: GAO XUEJIAN, MA ZHENG, LI JI, WANG XIAO, WU QIONG, LIU HONG, LYU LEI, GAO YUEXIU, LYU CHEN
Format: Patent
Sprache:chi ; eng
Schlagworte:
Online-Zugang:Volltext bestellen
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
Beschreibung
Zusammenfassung:The invention discloses a code feature extraction method and system based on hierarchical comparative learning. The method comprises: obtaining a to-be-processed code; analyzing the to-be-processed code snippets to generate an AST tree; performing embedding representation on the AST tree to obtain a feature matrix X, and constructing an adjacent matrix A of the AST tree; establishing a node label according to the level number of each node of the AST tree in the AST tree; updating the feature matrix X based on the node labels to obtain a new feature matrix X'; and inputting the new feature matrix X' and the adjacent matrix A into the trained residual self-attention network model to obtain features of the code to be processed. Grammar information of a program is extracted through AST, meanwhile, labels are given to the analyzed AST according to the level of nodes for classification, a single-label multi-classification relation is established, structural information of the program is fully mined, and the express