Interactive API code snippet recommendation method based on deep learning

A code snippet, deep learning technology, applied in the field of interactive API code snippet recommendation, which can solve problems such as difficulty in being familiar with usage patterns

Pending Publication Date: 2020-11-20
FUDAN UNIV
View PDF0 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, the number of APIs is huge and each API contains a large number of method calls and member variables, and API codes have certain usage patterns and rules (such as API usage combinations, call sequences, and matching control structures (such as conditional judgments) , loops, etc.), which makes it difficult for developers to familiarize themselves with all API code usage patterns

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Interactive API code snippet recommendation method based on deep learning

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0035] A specific embodiment for the Java program and the JDK API is as follows.

[0036] (1) The implementation of code representation parsing is to use JavaParser to parse the Java code with the statement as the basic unit to obtain AST (Abstract Syntax Tree), use the visitor mode to traverse the nodes of the AST corresponding to each statement, and use the Java reflection mechanism to obtain the API The complete list to extract the API, so as to get the complete method signature of the API. According to the control flow and data flow relationship between APIs, the graph structure representation of the code can be obtained. Based on the graph structure representation of the code and following a certain traversal order, the serialized representation of the code can be obtained.

[0037] (2) Heuristic beam search is implemented based on the Java language. The API obtained by decoding at each step will be judged by heuristic rules 1 and 2, and the API code fragments in the can...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention belongs to the technical field of software engineering and particularly relates to an interactive API code fragment recommendation method based on deep learning. The method comprises steps of a large number of source codes containing target APIs being analyzed to construct a large number of training samples; instantiating the deep learning network by using an Encoder-Decoder model framework in the deep learning model, including a Seq2Seq model, a Transformer model or a Graph2Seq model, and training the deep learning model by using the training sample so as to predict recommendations; optimizing the recommendation result through a post-processing mode according to the recommendation result of the deep learning model; wherein the post-processing mode comprises heuristic beam search, clustering and interactive intention selection. The method is advantaged in that intelligent multi-row API code recommendation based on the code context is provided for software developers, multi-row API codes are recommended for the developers on the basis of codes written by the developers, and therefore developers are assisted in completing development of current codes.

Description

technical field [0001] The invention belongs to the technical field of software engineering, and in particular relates to a method for recommending interactive API code fragments in software development. Background technique [0002] In software development tasks, software developers rely on API (Application Programming Interface, application programming interface) codes (ie, API code fragments) (such as JDK, Android) to achieve the required software features. However, the number of APIs is huge and each API contains a large number of method calls and member variables, and API codes have certain usage patterns and rules (such as API usage combinations, call sequences, and matching control structures (such as conditional judgments) , loops, etc.), which makes it difficult for developers to familiarize themselves with all API code usage patterns. Therefore, how to use appropriate API code fragments in the current code context to complete the functional features currently unde...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F16/335G06F16/35G06F16/34G06N3/08G06F8/33
CPCG06F16/335G06F16/353G06F16/358G06F16/345G06N3/082G06F8/33
Inventor 彭鑫陈驰赵文耘
Owner FUDAN UNIV
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products