Machine Translation from Natural Language to Code Using Long-Short Term Memory
Making computer programming language more understandable and easy for the human is a longstanding problem. From assembly language to present day’s object-oriented programming, concepts came to make programming easier so that a programmer can focus on the logic and the architecture rather than the code and language itself. To go a step further in this journey of removing human-computer language barrier, this paper proposes machine learning approach using Recurrent Neural Network (RNN) and Long-Short Term Memory (LSTM) to convert human language into programming language code. The programmer will write expressions for codes in layman’s language, and the machine learning model will translate it to the targeted programming language. The proposed approach yields result with 74.40% accuracy. This can be further improved by incorporating additional techniques, which are also discussed in this paper.
KeywordsText to code Machine learning Machine translation NLP RNN LSTM
We would like to thank Dr. Khandaker Tabin Hasan, Head of the Department of Computer Science, American International University-Bangladesh for his inspiration and encouragement in all of our research works. Also, thanks to Future Technology Conference - 2019 committee for partially supporting us to join the conference and one of our colleague - Faheem Abrar, Software Developer for his thorough review and comments on this research work and supporting us by providing fund.
- 1.Allamanis, M., Barr, E.T., Devanbu, P., Sutton, C.: A survey of machine learning for big code and naturalness. CoRR abs/1709.0 (2017). http://arxiv.org/abs/1709.06182
- 2.Birch, A., Osborne, M., Koehn, P.: Predicting success in machine translation. In: Proceedings of the Conference on Empirical Methods in Natural Language Processing - EMNLP 2008, pp. 745–754, October 2008. https://doi.org/10.3115/1613715.1613809
- 4.Gvero, T., Kuncak, V., Gvero, T., Kuncak, V.: Synthesizing Java expressions from free-form queries. In: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications - OOPSLA 2015, vol. 50, pp. 416–432. ACM Press, New York (2015). http://dl.acm.org/citation.cfm?doid=2814270.2814295
- 5.Klein, G., Kim, Y., Deng, Y., Senellart, J., Rush, A.M., Seas, H.: OpenNMT: open-source toolkit for neural machine translation. In: Proceedings of the ACL, pp. 67–72 (2017). https://doi.org/10.18653/v1/P17-4012
- 7.Lei, T., Long, F., Barzilay, R., Rinard, M.C.: From natural language specifications to program input parsers. In: Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics 1, pp. 1294–1303 (2013). http://www.aclweb.org/anthology/P13-1127
- 9.Mikolov, T., Chen, K., Corrado, G., Dean, J.: Distributed representations of words and phrases and their compositionality. CrossRef Listing of Deleted DOIs 1, pp. 1–9 (2000). https://arxiv.org/abs/1310.4546
- 10.Oda, Y., Fudaba, H., Neubig, G., Hata, H., Sakti, S., Toda, T., Nakamura, S.: Learning to generate pseudo-code from source code using statistical machine translation. In: 2015 30th IEEE/ACM International Conference on Automated Software Engineering (ASE), pp. 574–584. IEEE, November 2015. http://ieeexplore.ieee.org/document/7372045/
- 11.Quirk, C., Mooney, R., Galley, M.: Language to code: learning semantic parsers for if-this-then-that recipes. In: Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 878–888. Association for Computational Linguistics, Stroudsburg (2015). http://aclweb.org/anthology/P15-1085
- 12.Yin, P., Neubig, G.: A syntactic neural model for general-purpose code generation. In: Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (2017). http://arxiv.org/abs/1704.01696