Git Product home page Git Product logo

gci's Introduction

GCI

Source code and data for Everything Has a Cause: Leveraging Causal Inference in Legal Text Analysis (NAACL 2021 oral paper).


Dependencies

  • Python>=3.7
  • Spacy (for word segmentation)
  • Numpy
  • Pandas
  • Sklearn
  • Pke (for keyword extraction)
  • Py-Causal (for causal discovery)
  • Networkx (for analyzing causal graphs)
  • Pydot (for saving causal graphs)
  • Dowhy (for causal inference)
  • Pytorch>=1.1
  • Gensim (for loading word vectors)
  • Pgmpy (for calculating BIC score)

Prepare Data

The dataset used is provided in data/data.zip. Before running the models, some preprocessing is needed:

(Optional) If you want to start from the raw data, please run:

Run GCI

python gci.py --charge DATASET_NAME --ratio TRAINING_DATA_RATIO

Argment DATASET_NAME is chosen from:

  • II-M-N (Personal Injury: Intentional Injury & Murder & Involuntary Manslaughter),
  • R-K-S (Violent Acquisition: Robbery & Kidnapping & Seizure),
  • F-E (Fraud & Extortion),
  • E-MPF (Embezzlement & Misappropriation of Public Funds),
  • AP-DD (Abuse of Power & Dereliction of Duty).

And TRAINING_DATA_RATIO is chosen from {0.01, 0.05, 0.1, 0.3, 0.5}.

Integrate GCI with Neural Networks

This part of code is modified from https://github.com/649453932/Chinese-Text-Classification-Pytorch. As causal knowledge is needed, GCI should be executed first.

Impose Strength Constraint

python run_nn.py --model BiLSTM_Att_Cons --charge DATASET_NAME --ratio TRAINING_DATA_RATIO

Leverage Causal Chains

python run_nn.py --model CausalChain --charge DATASET_NAME --ratio TRAINING_DATA_RATIO

Citation

Please cite our paper if this repository inspires your work.

@inproceedings{liu2021everything,
  title={Everything Has a Cause: Leveraging Causal Inference in Legal Text Analysis},
  author={Liu, Xiao and Yin, Da and Feng, Yansong and Wu, Yuting and Zhao, Dongyan},
  booktitle={Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies},
  pages={1928--1941},
  year={2021}
}

Contact

If you have any questions regarding the code, please create an issue or contact the owner of this repository.

gci's People

Contributors

xxxiaol avatar

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.