Code Monkey home page Code Monkey logo

structuredregex's Introduction

StructuredRegex

Data and Code for paper Benchmarking Multimodal Regex Synthesis with Complex Structures .

Data

We provide raw data, tokenized data, and data with anonymized const strings.

Natural Language Descriptions of raw version contain the original raw annotations from Turkers. In tokenized version, we preprocessed and tokenized the descriptions. In anonymized version, we further replaced the contants mentioned in the descriptions with anonymous symbols. E.g., given the NL-regex pair [it must contain the string "ABC". --> contain(<ABC>)], we replace "ABC" with symbol const0 in both NL and regex, and hence the const-anonymized NL-regex pair should be [it must contain the string const0. --> contain(const0)].

All data is presented in TSV format, with fields including:

  • problem_id -- unique ID of the target regex.
  • description -- Turker annotated description.
  • regex -- target regex.
  • pos_examples -- positive examples.
  • neg_examples -- negative examples.
  • const_values -- mapping from symbols to the real string values, only existing in anonymized version.

Code

Requirements

  • pytorch > 1.0.0

We've attached pretrained checkpoints in code/checkpoints/pretrained.tar, which is ready to use. You can also reproduce the experimental results following the steps below (Please execute the commands in code directory)

Train

python train.py StReg --model_id <model_id>. The models will be stored in checkpoints/StReg directory with names following model_id*.tar.

Decode

python decode.py StReg <model_id> --split test*. The derivations will be generated using the checkpoints/StReg/<model_id>.tar and be outputed to decodes/StReg/ directory.

Evaluate

python eval.py StReg <decode_id> --split test*. Note that we report DFA accuracy (refer to the paper for more details).

Sampling Regexes and I/O Examples

see README and usage_example.py in toolkit.

Easy API for Checking Equivalence and I/O Consistency

see 'easy_eval/usage_example.py`

It also contains code for parsing the specification into AST that is easy to operate, and some code skeletons that can be completed to convert the specification in our DSL into standard regex.

structuredregex's People

Contributors

xiye17 avatar

Stargazers

张斐然(Feiran Zhang) avatar  avatar Ruiqi Zhong avatar ciuji avatar Jie Yang avatar 爱可可-爱生活 avatar Tsu-Jui Fu avatar Hadi Gharibi avatar  avatar Jiacheng Xu avatar  avatar  avatar Jocelyn Chen avatar

Watchers

 avatar

structuredregex's Issues

Parsing data

I am trying to parse the positive and negative examples, is it guaranteed that the examples themselves don't have spaces in them? If not how do I separate the examples?

Converting DSL into regex and backward

Hi, thanks a lot for a nice code release!
Do you by any chance have code that converts the DSL you use into regular python regex and vice versa? That would be super useful!
Best,
Anton

Code for generating examples using regex

Hi!

Thanks for your code and dataset!
Do you by any chance share the code for generating positive and negative examples under specific regex? (As Section3.1 Positive/Negative Example Generation introduced in the paper)
I want to generate more examples of given regexes.

Thanks!
Chaoji Zuo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.