SemRegex: A Semantics-Based Approach for Generating Regular Expressions from Natural Language Specifications

SemRegex: A Semantics-Based Approach for Generating Regular Expressions from Natural Language Specifications
复制标题

DOI:
10.18653/v1/d18-1189
复制
发表时间:
2018-10
期刊:
--
影响因子:
--
通讯作者:
Zexuan Zhong;Jiaqi Guo;Wei Yang;Jian Peng;Tao Xie;Jian-Guang Lou;Ting Liu;D. Zhang
Zexuan Zhong;Jiaqi Guo;Wei Yang;Jian Peng;Tao Xie;Jian-Guang Lou;Ting Liu;D. Zhang
中科院分区:
其他
文献类型:
--
作者:
Zexuan Zhong;Jiaqi Guo;Wei Yang;Jian Peng;Tao Xie;Jian-Guang Lou;Ting Liu;D. Zhang

文献摘要

相似文献

最近的研究提出了基于语法的方法来解决从自然语言规范生成程序的问题。这些方法通常使用基于语法的目标:最大似然估计(MLE)来训练序列到序列学习模型。这种基于语法的方法不能有效地解决生成语义正确的程序的目标,因为这些方法不能处理程序别名,即,语义等价的程序可能具有许多语法上不同的形式。为了解决这个问题,本文提出了一种基于语义的方法SemRegex。SemRegex为程序的一个子任务--合成问题提供了解决方案:从自然语言生成正则表达式。与现有的基于语法的方法不同,SemRegex通过最大化生成的正则表达式的预期语义正确性来训练模型。使用DFA等价预言、随机测试用例和区分测试用例来衡量语义正确性。在三个公共数据集上的实验表明,SemRegex比现有的最先进的方法具有更好的性能。
Recent research proposes syntax-based approaches to address the problem of generating programs from natural language specifications. These approaches typically train a sequence-to-sequence learning model using a syntax-based objective: maximum likelihood estimation (MLE). Such syntax-based approaches do not effectively address the goal of generating semantically correct programs, because these approaches fail to handle Program Aliasing, i.e., semantically equivalent programs may have many syntactically different forms. To address this issue, in this paper, we propose a semantics-based approach named SemRegex. SemRegex provides solutions for a subtask of the program-synthesis problem: generating regular expressions from natural language. Different from the existing syntax-based approaches, SemRegex trains the model by maximizing the expected semantic correctness of the generated regular expressions. The semantic correctness is measured using the DFA-equivalence oracle, random test cases, and distinguishing test cases. The experiments on three public datasets demonstrate the superiority of SemRegex over the existing state-of-the-art approaches.