RegexExplainer: Automatic Description Generation for Regular Expressions via Transformer
Regular expressions can describe specific matching rules, which can be used to determine the string format or extract the string content. Until now, regular expressions have been widely used in various operating systems and have been supported by most programming languages. However, the understanding of regular expressions is challenging for end-users or developers, who may not familiar with the syntax of regular expressions. Therefore, it is pressing for researchers to put forward effective methods to automatically generate functional descriptions for regular expressions. In this study, we formalize the description generation of the regular expression as a neural machine translation task. Then we propose a fully data-driven method RegexExplainer based on Transformer. Specifically, it uses Regex Encoder and AST Encoder to jointly learn the encoding information of regular expressions. In order to confirm the effectiveness of RegexExplainer, we build a high-quality corpus that consists of 107,851 pairs of regular expressions along with their corresponding descriptions. The final experimental results demonstrate that RegexExplainer is able to attain better performance compared to the state-of-the-art baselines when it comes to three performance measures.
Authors
- Tianyue Liu (ORCID: https://orcid.org/0009-0000-6823-0783)
- Shanshan Cao (ORCID: https://orcid.org/0000-0001-7280-1657)
- Xiao Yang (ORCID: https://orcid.org/0000-0002-5691-3189)
- Guang Yang (ORCID: https://orcid.org/0000-0001-7344-7733)
- Yun Wu (ORCID: https://orcid.org/0000-0002-1136-3902)
Institutions
- Minzu University of China (CN)
- Wuhan University (CN)
- Wuhan University of Engineering Science
- Nanjing University of Aeronautics and Astronautics (CN)
Publication Details
- Published
- 2024-12-27
- DOI
- https://doi.org/10.1109/icctit64404.2024.10928415
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00
Funders
- Hubei Provincial Department of Education