Sketch-Driven Regular Expression Generation from Natural Language and Examples

Xi Ye, Qiaochu Chen, Xinyu Wang, Isil Dillig, Greg Durrett
8/16/2019
cs.CL

Official code: xiye17/SketchRegex (17 stars, Python, last commit 2023-04-26).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

xiye17/SketchRegexOfficial100%

Sketch Driven Regular Expression Generation.

174PythonApr 28, 20203 years ago

Similar Papers

Cite this paper

@article{ye2019sketchdriven,
  title  = {Sketch-Driven Regular Expression Generation from Natural Language and Examples},
  author = {Xi Ye and Qiaochu Chen and Xinyu Wang and Isil Dillig and Greg Durrett},
  year   = {2019},
  eprint = {1908.05848},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/1908.05848}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/1908.05848.svg)](https://codeofpaper.com/paper/1908.05848)

Discussion