Code Monkey home page Code Monkey logo

auto-rule-transform's Introduction

Auto Rule Transform

Automated rule transformation for automated rule checking.

This repo contains the dataset, codes, and documents for the paper entitled "Deep natural language processing-based rule transformation for automated regulatory compliance checking" (DOI: http://dx.doi.org/10.13140/RG.2.2.22993.45921).

example

Dataset Information

In data/xiaofang/sentences_all.json, it contains all sentences (in Chinese) with labels developed in this research.

In src/logs/rulecheck-eval.log, it shows the parsing result of these sentences in a text-based format (note: if you are using VSCode, you can install the Log File Highlighter extension and configure it with the log-file-highlighter.txt to enable our customized syntax highlight).

Setup

  • Clone or download the repo
    git clone https://github.com/Zhou-Yucheng/auto-rule-transform.git
    cd auto-rule-transform
    
  • Install the requirements

Semantic labeling

This repo uses Pytorch for training deep learning models. You can follow the official get-started to install it.

Note: if you want to use FP16 acceleration to train the model, please ensure your Pytorch version >= 1.6, because we use the Pytorch native module torch.cuda.amp which is introduced in Pytorch 1.6. Otherwise, you may would like to comment the from torch.cuda.amp import autocast, GradScaler and remove relevant statements in train.py.

Run train.py in src/, and then you will get the trained model in src/models/ and the log file in src/logs/train.log.

python3 train.py

For more information about usages, run python3 train.py -h

To report the performance of a model in src/models/, rename it to _BertZh0_best.pth and run:

python3 train.py --report # it will report the model named _BertZh0_best.pth

Parsing

Run ruleparse.py in src/, and then it will read the sentences in data/xiaofang/sentences_all.json and log the result in src/logs/ruleparse.log & src/logs/ruleparse-eval.log

python3 ruleparse.py -d json

If you want to change the dataset of parsing to data/xiaofang/sentences.txt, use the -d argument to specify:

python3 ruleparse.py -d text

To generate the XML check set rules for Autodesk Revit model checker after the parsing, add -g switch (in beta version now):

python3 ruleparse.py -d text -g

If you want to perform interactive rule transformation, run:

python3 ruleparse.py -i
# then, input the id of a sentence (see data/xiaofang/sentence_all.json),  
# it will read the sentence and show the parsing result immediately

License

This project is free and open source for universities, research institutes, enterprises and individuals for research purposes only, and the commercial purpose is not permitted.
本项目面向大学、研究所、企业以及个人用于研究目的免费开放源代码,不得将其用于任何商业目的。

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.