| Computers have been widely used in various fields such as medical treatment,business,and tourism.People’s study,life,and work are increasingly inseparable from computers,and the demand for computers is becoming more and more diverse.To meet the growing demand,automatic code generation technology has gradually entered people’s vision,which is used to improve the efficiency of software development and lower the technical threshold of professional operation.Although early code generation methods have high reliability,they often need to create formal specifications.And the process of creating formal specifications is very challenging.In recent years,the field of artificial intelligence has developed rapidly,and it has made outstanding achievements in data mining,computer vision,and other fields.Therefore,combining artificial intelligence technology with code generation technology to explore new automatic code generation methods has gradually attracted attention.This paper focuses on the pseudocode-tocode generation task.On the one hand,it studies the pseudocode-to-code generation model.On the other hand,it explores how to obtain high-quality pseudocode-to-code datasets.The specific work contents are as follows:(1)Aiming to improve the success rate of the pseudocode-to-code generation task,a pseudocode-to-code generation model based on adaptive global and local information is designed and implemented.Firstly,it extracts the features of each line of pseudocode through the multi-scale pyramid feature extractor in multiple directions to obtain the corresponding predicted code with weights so as to improve the accuracy of the predicted code.In the search synthesis stage,the predicted code with weights is searched and combined according to the preset search combination rules to synthesize a candidate program.And the given test case will verify the candidate program.Meanwhile,a code repair model based on adaptive global and local information is designed.The feedback information of the compiler is reasonably used to find the real error line and repair the error code,thereby improving the success rate from pseudocode to code.(2)Aiming at the quantity problems of the existing open-source pseudocode-tocode datasets,a fully automatic data selection and correction model is proposed.This model iterates from code-to-pseudocode repairer and pseudocode-to-code generator step by step to automatically filter and fix the problematic pseudocode data to obtain the optimized dataset.Concretely,the dataset is initially classified into good and bad pseudocode datasets by a pseudocode-to-code generator.Then,the code-to-pseudocode repairer uses the correct code to rewrite the bad pseudocode data to get the good pseudocode data.To sum up,the pseudocode-to-code generation model based on adaptive global and local information has achieved excellent accuracy of 46.1%and 63.5%on the test sets TestP and TestW of the open-source SPoC dataset.The experimental results indicate that the model can improve the success rate of code generation tasks.In addition,the new dataset is verified on the existing pseudocode-to-code generation model,and good accuracy of 63.1%and 82.4%are achieved,respectively.The experimental results show that the fully automatic data selection and correction model is able to obtain high-quality data. |