arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1908.03316cs.PL
收藏

正则表达式的多模态综合

Multi-modal Synthesis of Regular Expressions

Qiaochu Chen, Xinyu Wang, Xi Ye, Greg Durrett, Isil Dillig

摘要:

在本文中,我们提出了一个多模态合成技术,自动构造正则表达式(regex)的组合的例子和自然语言。在这种情况下,使用多模态是有用的,因为单独的自然语言通常是高度模糊的,而孤立的示例通常不足以传达用户意图。我们提出的技术首先将英文描述解析成一个所谓的分层草图,指导我们的编程的例子(PBE)引擎。由于分层草图捕获了关键提示,PBE引擎可以利用该信息来对搜索进行优先级排序,并进行有用的推断以修剪搜索空间。我们已经实现了所提出的技术在一个叫做Regel的工具,并评估了超过300个regex。我们的评估表明,Regel实现了80%的准确性,而仅NLP和仅PBE基线分别实现了43%和26%。我们还将我们提出的PBE引擎与AlphaRegex(一种最先进的正则表达式合成工具)的适应进行了比较,并表明我们提出的PBE引擎速度快了一个数量级,即使我们采用AlphaRegex的搜索算法来利用草图。最后,我们进行了一项涉及20名参与者的用户研究,结果表明,与没有Regel相比,使用Regel的用户成功找到所需正则表达式的可能性是没有Regel的用户的两倍。

英文摘要:

In this paper, we propose a multi-modal synthesis technique for automatically constructing regular expressions (regexes) from a combination of examples and natural language. Using multiple modalities is useful in this context because natural language alone is often highly ambiguous, whereas examples in isolation are often not sufficient for conveying user intent. Our proposed technique first parses the English description into a so-called hierarchical sketch that guides our programming-by-example (PBE) engine. Since the hierarchical sketch captures crucial hints, the PBE engine can leverage this information to both prioritize the search as well as make useful deductions for pruning the search space. We have implemented the proposed technique in a tool called Regel and evaluate it on over three hundred regexes. Our evaluation shows that Regel achieves 80% accuracy whereas the NLP-only and PBE-only baselines achieve 43% and 26% respectively. We also compare our proposed PBE engine against an adaptation of AlphaRegex, a state-of-the-art regex synthesis tool, and show that our proposed PBE engine is an order of magnitude faster, even if we adapt the search algorithm of AlphaRegex to leverage the sketch. Finally, we conduct a user study involving 20 participants and show that users are twice as likely to successfully come up with the desired regex using Regel compared to without it.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑