A way to automatically generate python code from natural language

A natural language, automatic generation technology, applied in the creation/generation of source code, code compilation, program code conversion, etc., can solve problems such as lack of semantic constraints and loss of semantics

Active Publication Date: 2021-06-18
NORTHEASTERN UNIV LIAONING
View PDF4 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, when the above-mentioned Encoder-Decoder model handles the conversion from natural language to programming language, Encoder and Decoder process two different languages ​​respectively. Due to the difference in the neural network used by Encoder and Decoder, and the depth of the network, natural language description The semantics of the program will be gradually lost in the process of code generation, so there is a lack of a training model with strong semantic constraints

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
  • A way to automatically generate python code from natural language
  • A way to automatically generate python code from natural language
  • A way to automatically generate python code from natural language

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0036] The specific embodiments of the present invention will be described in detail below in conjunction with the technical solutions and accompanying drawings.

[0037] A method to automatically generate Python code from natural language. The proposed GANCoder system is generally a generative confrontation network, including two parts, the generator and the discriminator, such as image 3 shown. Where the generator is an Encoder-Decoder model, such as Figure 4 As shown, the Encoder is responsible for encoding the natural language description sequence, using a two-way LSTM network, while the Decoder decodes the semantics encoded by the Encoder into the abstract syntax tree of the program, using a one-way LSTM network; and the discriminator is mainly responsible for judging the natural language description and Whether the semantics of the abstract syntax tree are consistent, the generator Encoder is used for the semantic encoding of the natural language description, and the ...

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 natural language processing, and in particular relates to a method for automatically generating Python codes from natural language. The steps of the method are as follows: Step 1: The generator of the GAN network is used to generate the abstract syntax tree of the program fragment according to the natural language description. Step 2: Use the discriminator of GAN to judge whether the semantics of the abstract syntax tree generated by the generator is consistent with the semantics of the given natural language description. Step 3: Train the generator and discriminator of the GAN network together. The present invention generates a code generation system by generating a confrontation network optimization training, and the system can generate a section of program code with the same function according to a natural language description given by a user. Compared with the traditional optimization method, using the generative confrontation network for confrontation game training, the generator can learn the language model of natural language and programming language more effectively.

Description

technical field [0001] The invention belongs to the technical field of natural language processing, and in particular relates to a method for automatically generating Python codes from natural language. Background technique [0002] Semantic analysis task is a type of task in the field of natural language processing. It mainly studies how to convert a given natural language description text into a logical representation that a computer can understand and execute, such as SQL, Python, Java, etc. . The traditional method is to design a fixed template according to the characteristics of the programming language, and then use pattern matching to parse the natural language description into each instance in the template. With the development of deep learning technology, deep learning frameworks such as Encoder-Decoder have also been introduced into semantic analysis and analysis tasks, such as using machine translation to directly translate natural description language sequences ...

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 Patents(China)
IPC IPC(8): G06F8/30G06F8/41
CPCG06F8/30G06F8/436
Inventor 祝亚兵张岩峰
Owner NORTHEASTERN UNIV LIAONING
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