The application discloses a multimodal code search method based on fine-grained attention alignment, constructs a new mechanism to learn the rich
semantics of
source code and
natural language queries from two modalities of text and structure, uses a multimodal feature network to construct a code search model, adopts different construction methods for different
modal features, and fully expresses different features of corresponding codes and texts; meanwhile, a fine-grained alignment mechanism is adopted in the model training process, and the same
modal features are aligned respectively, thereby facilitating the matching of code entities and text entities; after the construction of all features is completed, a
cosine similarity function is used to calculate the similarity between a given query and code samples in all code libraries, so that the code samples are ranked according to the similarity. The application gets rid of the insufficiency of code representation and
feature extraction in the existing code search field, can more completely utilize the information contained in different
modal features for code representation and matching, and has higher recognition accuracy and better convergence performance.