Skip to main content

Machine Translation from Natural Language to Code Using Long-Short Term Memory

  • Conference paper
  • First Online:
Proceedings of the Future Technologies Conference (FTC) 2019 (FTC 2019)

Part of the book series: Advances in Intelligent Systems and Computing ((AISC,volume 1069))

Included in the following conference series:

Abstract

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 169.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 219.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://en.m.wikipedia.org/wiki/List_of_programming_languages.

  2. 2.

    http://www.99-bottles-of-beer.net.

  3. 3.

    Dataset: https://ahclab.naist.jp/pseudogen/ [10].

  4. 4.

    https://pytorch.org/.

References

  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

  3. George, D., Priyanka Girase, N., Mahesh Gupta, N., Prachi Gupta, N., Aakanksha Sharma, N., Navi, V.: Programming language inter-conversion. Int. J. Comput. Appl. 1(20), 975–8887 (2010). https://doi.org/10.5120/419-619

    Article  Google Scholar 

  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

  6. Knuth, D.E.: Literate programming. Comput. J. 27(2), 97–112 (1984). http://www.literateprogramming.com/knuthweb.pdf

    Article  Google Scholar 

  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

  8. Mihalcea, R., Liu, H., Lieberman, H.: NLP (natural language processing) for NLP (natural language programming). In: Linguistics and Intelligent Text Processing, pp. 319–330 (2006). https://doi.org/10.1007/11671299_34

    Chapter  Google Scholar 

  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

Download references

Acknowledgment

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.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to K. M. Tahsin Hassan Rahit .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Rahit, K.M.T.H., Nabil, R.H., Huq, M.H. (2020). Machine Translation from Natural Language to Code Using Long-Short Term Memory. In: Arai, K., Bhatia, R., Kapoor, S. (eds) Proceedings of the Future Technologies Conference (FTC) 2019. FTC 2019. Advances in Intelligent Systems and Computing, vol 1069. Springer, Cham. https://doi.org/10.1007/978-3-030-32520-6_6

Download citation

Publish with us

Policies and ethics