43,240 research outputs found
Does BLEU Score Work for Code Migration?
Statistical machine translation (SMT) is a fast-growing sub-field of
computational linguistics. Until now, the most popular automatic metric to
measure the quality of SMT is BiLingual Evaluation Understudy (BLEU) score.
Lately, SMT along with the BLEU metric has been applied to a Software
Engineering task named code migration. (In)Validating the use of BLEU score
could advance the research and development of SMT-based code migration tools.
Unfortunately, there is no study to approve or disapprove the use of BLEU score
for source code. In this paper, we conducted an empirical study on BLEU score
to (in)validate its suitability for the code migration task due to its
inability to reflect the semantics of source code. In our work, we use human
judgment as the ground truth to measure the semantic correctness of the
migrated code. Our empirical study demonstrates that BLEU does not reflect
translation quality due to its weak correlation with the semantic correctness
of translated code. We provided counter-examples to show that BLEU is
ineffective in comparing the translation quality between SMT-based models. Due
to BLEU's ineffectiveness for code migration task, we propose an alternative
metric RUBY, which considers lexical, syntactical, and semantic representations
of source code. We verified that RUBY achieves a higher correlation coefficient
with the semantic correctness of migrated code, 0.775 in comparison with 0.583
of BLEU score. We also confirmed the effectiveness of RUBY in reflecting the
changes in translation quality of SMT-based translation models. With its
advantages, RUBY can be used to evaluate SMT-based code migration models.Comment: 12 pages, 5 figures, ICPC '19 Proceedings of the 27th International
Conference on Program Comprehensio
Cross-Language Learning for Program Classification using Bilateral Tree-Based Convolutional Neural Networks
Towards the vision of translating code that implements an algorithm from one programming language into another, this paper proposes an approach for automated program classification using bilateral tree-based convolutional neural networks (BiTBCNNs). It is layered on top of two tree-based convolutional neural networks (TBCNNs), each of which recognizes the algorithm of code written in an individual programming language. The combination layer of the networks recognizes the similarities and differences among code in different programming languages. The BiTBCNNs are trained using the source code in different languages but known to implement the same algorithms and/or functionalities. For a preliminary evaluation, we use 3591 Java and 3534 C++ code snippets from 6 algorithms we crawled systematically from GitHub. We obtained over 90% accuracy in the cross-language binary classification task to tell whether any given two code snippets implement a same algorithm. Also, for the algorithm classification task, i.e., to predict which one of the six algorithm labels is implemented by an arbitrary C++ code snippet, we achieved over 80% precision
- …