skip to main content
10.1145/2491411.2494584acmconferencesArticle/Chapter ViewAbstractPublication PagesfseConference Proceedingsconference-collections
research-article

Lexical statistical machine translation for language migration

Published:18 August 2013Publication History

ABSTRACT

Prior research has shown that source code also exhibits naturalness, i.e. it is written by humans and is likely to be repetitive. The researchers also showed that the n-gram language model is useful in predicting the next token in a source file given a large corpus of existing source code. In this paper, we investigate how well statistical machine translation (SMT) models for natural languages could help in migrating source code from one programming language to another. We treat source code as a sequence of lexical tokens and apply a phrase-based SMT model on the lexemes of those tokens. Our empirical evaluation on migrating two Java projects into C# showed that lexical, phrase-based SMT could achieve high lexical translation accuracy (BLEU from 81.3-82.6%). Users would have to manually edit only 11.9-15.8% of the total number of tokens in the resulting code to correct it. However, a high percentage of total translation methods (49.5-58.6%) is syntactically incorrect. Therefore, our result calls for a more program-oriented SMT model that is capable of better integrating the syntactic and semantic information of a program to support language migration.

References

  1. D. Cer, M. Galley, D. Jurafsky, and C. D. Manning. Phrasal: A statistical machine translation toolkit for exploring new model features. In Proceedings of the NAACL HLT 2010 Demonstration Session, pages 9–12, 2010. Association for Computational Linguistics. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. B. Dagenais and M. P. Robillard. Recommending adaptive changes for framework evolution. In ICSE’08: Proceedings of the 30th International Conference on Software Engineering, pages 481–490. ACM, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. db4o. http://sourceforge.net/projects/db4o/.Google ScholarGoogle Scholar
  4. Google Translate. http://translate.google.com/.Google ScholarGoogle Scholar
  5. A. Hindle, E. T. Barr, Z. Su, M. Gabel, and P. Devanbu. On the naturalness of software. In Proceedings of International Conference on Software Engineering, ICSE’12, pp. 837–847. IEEE Press, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Java2CSharp. http://j2cstranslator.wiki.sourceforge.net/.Google ScholarGoogle Scholar
  7. P. Koehn. Statistical Machine Translation. The Cambridge Press, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Lucene. http://lucene.apache.org/.Google ScholarGoogle Scholar
  9. S. Meng, X. Wang, L. Zhang, and H. Mei. A history-based matching approach to identification of framework evolution. In ICSE’12, pp. 353–363. IEEE. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Mossienko. Automated Cobol to Java recycling. In Proceedings of European Conference on Software Maintenance and Reengineering, CSMR’03. IEEE. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. Nita and D. Notkin. Using twinning to adapt programs to alternative APIs. In Proceedings of ACM/IEEE International Conference on Software Engineering, ICSE ’10, pages 205–214. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. K. Papineni, S. Roukos, T. Ward, and W.-J. Zhu. BLEU: a method for automatic evaluation of machine translation. In Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, ACL’02, pages 311–318. 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. R. C. Waters. Program translation via abstraction and reimplementation. IEEE Trans. Softw. Eng., 14(8):1207–1228, Aug. 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. W. Wu, Y.-G. Guéhéneuc, G. Antoniol, and M. Kim. AURA: a hybrid approach to identify framework evolution. In ICSE ’10, pages 325–334. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. K. Yasumatsu and N. Doi. Spice: A system for translating Smalltalk programs into a C environment. IEEE Trans. Softw. Eng., 21(11):902–912, Nov. 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. H. Zhong, S. Thummalapenta, T. Xie, L. Zhang, and Q. Wang. Mining API mapping for language migration. In ICSE’10, pages 195–204. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Lexical statistical machine translation for language migration

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ESEC/FSE 2013: Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering
        August 2013
        738 pages
        ISBN:9781450322379
        DOI:10.1145/2491411

        Copyright © 2013 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 18 August 2013

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate112of543submissions,21%

        Upcoming Conference

        FSE '24

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader