Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Method for automatically generating Java code annotation based on Transformer and mixed code representation

An automatic generation and code representation technology, applied in code compilation, program code conversion, instruments, etc., can solve the problems of increased software development and maintenance costs, poor program readability, poor understandability, etc., to improve the quality of software products and facilitate the The effect of duplicating and speeding up the maintenance process

Pending Publication Date: 2021-01-01
NANTONG UNIVERSITY
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The purpose of the present invention is to provide a method for automatically generating Java code annotations based on Transformer and mixed code representation, to solve the problem of poor program readability and poor comprehensibility caused by the lack of code annotations in the software development and maintenance process in the prior art , The problem of increased software development and maintenance costs, this method is used for code comment generation, especially at the encoding layer to encode Code and AST-based SBT traversal sequences, and combine the semantic information learned by the two to capture the semantics of the source code Information; the present invention realizes the automation of code annotation generation, generates concise and accurate annotations for codes, improves the readability and comprehensibility of codes, reduces code development and maintenance costs, and improves code development and maintenance efficiency

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
  • Method for automatically generating Java code annotation based on Transformer and mixed code representation
  • Method for automatically generating Java code annotation based on Transformer and mixed code representation
  • Method for automatically generating Java code annotation based on Transformer and mixed code representation

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0024] see Figure 1 to Figure 3 The technical solution provided by the present invention is a method for automatically generating Java code annotations based on Transformer and mixed code representation, which includes the following steps:

[0025] S1. Download the Java project and build the code library;

[0026] S2. In the serialization processing layer, based on AST traversal, it is converted into code token vector and SBT vector;

[0027] To address insufficient vocabulary, identifiers from code tokens and AST nodes are split into words based on camelCase;

[0028] S3. At the encoding layer, use a Code encoder and an SBT encoder, the Code encoder extracts lexical information from the source code, and uses the SBT encoder to obtain the structural information of the code;

[0029] S4. At the decoding layer, the semantic information is decoded to generate annotations.

[0030] As a further optimization scheme of the Java code annotation automatic generation...

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 provides a method for automatically generating a Java code annotation based on Transformer and mixed code representation, which comprises the following steps of: S1, downloading a Java project and constructing a code library; S2, in a serialization processing layer, converting into a code token vector and an SBT vector based on AST traversal; S3, in the coding layer, using a Code coder and an SBT coder, enabling the Code coder to extract lexical information from the source code, and using the SBT coder for obtaining structural information of the code; and S4, in a decoding layer,decoding the semantic information to generate annotations. The method has the beneficial effects that the method is used for generating code annotations, particularly encoding Codes and AST-based SBTtraversal sequences on an encoding layer, and combining semantic information learned by the Codes and the AST-based SBT traversal sequences to capture semantic information of source codes.

Description

technical field [0001] The invention relates to the technical field of computer applications, in particular to a method for automatically generating Java code annotations based on Transformer and mixed code representation. Background technique [0002] In the process of software development and maintenance, the comments corresponding to the code often have problems such as missing, insufficient or mismatching with the actual content of the code, but manually writing code comments is time-consuming and laborious for developers, and the quality of comments is difficult to guarantee, so it is urgent Researchers need to come up with effective methods for automatically generating code comments. [0003] Code comment generation aims to generate a natural language description of the source code, which can help developers understand the program, thereby reducing the time cost of software maintenance. Recently, most state-of-the-art techniques utilize Seq2Seq models based on RNN (Re...

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): G06F8/73G06F8/41
CPCG06F8/73G06F8/42G06F8/425G06F8/427G06F8/436
Inventor 陈翔杨光刘珂田丹贾焱鑫于池胡新宇
Owner NANTONG UNIVERSITY
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products