Using machine translation for converting Python 2 to Python 3 code
By Karan Aggarwal, Mohammad Salameh, Abram Hindle. 2015
41 citations recorded by the source corpus.
In this paper, we have tried to use Statistical machine translation in order to convert Python 2 code to Python 3 code. We use data from two projects and achieve a high BLEU score. We also investigate the cross-project training and testing to analyze the errors so as to ascertain differences with previous case. We have described a pilot study on modeling programming languages as natural language to build translation models on the lines of natural languages. This can be further worked on to translate between versions of a programming language or crossprogramming-languages code translation.
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
- Baptiste Rozière
- Mohit Bansal
- Marc Szafraniec
- Gabriel Synnaeve
- Percy Liang
- Yoshua Bengio
- Jie M. Zhang
- Marie-Anne Lachaux
Citations in the corpus
- Unsupervised Translation of Programming Languages (2020, methodology): “The majority of studies in source code translation use the BLEU score to evaluate the quality of generated functions [1, 10, 22, 36], or other metrics based on the relative overlap between the tokens in the translation and in the reference.”
- Multi-lingual Evaluation of Code Generation Models (2022, methodology): “Subsequent works used libraries and transcompilers to construct parallel corpora in Python 2 and Python 3 (Aggarwal et al., 2015), and CoffeeScript and JavaScript (Chen et al.”
- Leveraging Automated Unit Tests for Unsupervised Code Translation (2021, methodology): “Early methods extracted parallel datasets and trained phrase-based models to translate between C# and Java (Nguyen et al., 2013; Karaivanov et al., 2014) or from Python 2 to Python 3 (Aggarwal et al., 2015).”
- Code Translation with Compiler Representations (2022, methodology): “Similarly, 2to3 9 , a Python library porting Python 2 code to Python 3, was used in Aggarwal et al. (2015) to create a parallel dataset and train a machine learning model.”