草图驱动的自然语言正则表达式生成及实例
Sketch-Driven Regular Expression Generation from Natural Language and Examples
摘要:
最近用于将自然语言描述转换为正则表达式(regex)的系统已经取得了一些成功,但是通常处理简短的公式化文本并且只能产生简单的regex。现实世界的正则表达式是复杂的,很难用简短的句子来描述,有时需要例子来充分传达用户的意图。我们提出了一个正则表达式合成的框架,在这种情况下,自然语言(NL)和例子。首先,语义解析器(基于语法的或神经的)将自然语言描述映射到中间草图中,该草图是一个不完整的正则表达式,其中包含用于表示缺失组件的孔。然后,程序合成器搜索由草图定义的正则表达式空间,并找到与给定字符串示例一致的正则表达式。我们的语义解析器可以纯粹从基于合成正则表达式的正确性的弱监督中进行训练,或者它可以利用抽象派生的草图。我们评估了两个先前的数据集(Kushman和Barzilay,2013; Locascio等人,2016)和来自Stack Overflow的真实世界数据集。我们的系统在现有数据集上实现了最先进的性能,并解决了57%的现实世界数据集,现有神经系统完全失败。
英文摘要:
Recent systems for converting natural language descriptions into regular expressions (regexes) have achieved some success, but typically deal with short, formulaic text and can only produce simple regexes. Realworld regexes are complex, hard to describe with brief sentences, and sometimes require examples to fully convey the user's intent. We present a framework for regex synthesis in this setting where both natural language (NL) and examples are available. First, a semantic parser (either grammar-based or neural) maps the natural language description into an intermediate sketch, which is an incomplete regex containing holes to denote missing components. Then a program synthesizer searches over the regex space defined by the sketch and finds a regex that is consistent with the given string examples. Our semantic parser can be trained purely from weak supervision based on correctness of the synthesized regex, or it can leverage heuristically-derived sketches. We evaluate on two prior datasets (Kushman and Barzilay, 2013; Locascio et al., 2016) and a real-world dataset from Stack Overflow. Our system achieves state-of-the-art performance on the prior datasets and solves 57% of the real-world dataset, which existing neural systems completely fail on.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。