Font Size: a A A

Declerative Code Generation Based On Templates And Rules

Posted on:2022-12-19Degree:MasterType:Thesis
Country:ChinaCandidate:J H FengFull Text:PDF
GTID:2518306788956859Subject:Automation Technology
Abstract/Summary:PDF Full Text Request
With the development of technology,declarative programming is getting more and more attention.By writing declarative code,programmers can focus on logic control instead of specifying each step with an algorithm.However,writing code is not easy for non-programmers,and programming relies on a lot of expertise.Therefore,natural language synthesis codes have become a research hotspot.Among them,SQL query code,as one of the typical declarative code types,has been deeply studied by academia.This paper focuses the declarative code generation work on the Text2 SQL task,and proposes a template-and rule-based method to realize the synthesis of natural language to SQL query statements.The main work of this paper is as follows:(1)In the past,deep learning models for Text2 SQL tasks did not fully utilize database content,did not consider the impact of entity types involved in table field values on model accuracy,and did not fully utilize database prior knowledge.To this end,this paper proposes a template-and rule-based deep learning method TRSQL,which improves the representation model through database content and entity types involved in table field values.TRSQL first generates a sketch template corresponding to a natural language sequence,and then uses the sketch template and generation rules to constrain the generation of SQL query statements.The TRSQL method is evaluated on the authoritative public dataset Wiki SQL and compared with methods such as Hydra Net,X-SQL,Sea D,etc.Compared with the Coarse2 Fine model with the same prediction task,the accuracy is improved by nearly 11%.(2)The previous solutions based on NLP technology to solve Text2 SQL tasks simply used techniques such as word segmentation and part-of-speech analysis.None of the proposed methods have been verified on authoritative and large-scale data sets,with poor interpretability and insufficient generalization ability.To make up for the deficiencies of previous schemes,this paper proposes a template-and rule-based NLP method—nTRSQL.nTRSQL adds a variety of parsing templates and parsing rules on the basis of previous solutions,and integrates the proposed voting mechanism and coloring tree technology.The experimental results show that the text2 SQL logic accuracy rate of nTRSQL method can be as high as 90.3% under applicable conditions.(3)Two schemes are proposed to combine nTRSQL and TRSQL methods to realize the synthesis of English natural sentences into SQL query codes.One is to implement based on the Drools rule engine,and the other is to improve the traditional classifier based on BERT to solve the selection problem of nTRSQL and TRSQL.(4)Based on the combined method of nTRSQL and TRSQL,a set of database natural language query system is built,which provides users with an interactive interface that can retrieve the database through natural sentences.
Keywords/Search Tags:Rules, Templates, Text2SQL, Drools, Deep Learning
PDF Full Text Request
Related items