Skip to main content

Easy Natural Language Processing

Project description

Easy Natural Language Processing

Overparameterized neural networks are lazy (Chizat et al., 2019), so we design structures and objectives that can be easily optimized.

eznlp is a PyTorch-based package for neural natural language processing, currently supporting the following tasks:

This repository also maintains the code of our papers:

  • Check this link for "Deep Span Representations for Named Entity Recognition" accepted to Findings of ACL 2023.
  • Check this link for "Boundary Smoothing for Named Entity Recognition" in ACL 2022.
  • Check this link for the annotation scheme described in "A Unified Framework of Medical Information Annotation and Extraction for Chinese Clinical Text".

Installation

Create an environment

$ conda create --name eznlp python=3.8
$ conda activate eznlp

Install dependencies

$ conda install numpy=1.18.5 pandas=1.0.5 xlrd=1.2.0 matplotlib=3.2.2 
$ conda install pytorch=1.7.1 torchvision=0.8.2 torchtext=0.8.1 {cpuonly|cudatoolkit=10.2|cudatoolkit=11.0} -c pytorch 
$ pip install -r requirements.txt 

Install eznlp

  • From source (recommended)
$ python setup.py sdist
$ pip install dist/eznlp-<version>.tar.gz --no-deps
  • With pip
$ pip install eznlp --no-deps

Running the Code

Text classification

$ python scripts/text_classification.py --dataset <dataset> [options]

Entity recognition

$ python scripts/entity_recognition.py --dataset <dataset> [options]

Relation extraction

$ python scripts/relation_extraction.py --dataset <dataset> [options]

Attribute extraction

$ python scripts/attribute_extraction.py --dataset <dataset> [options]

Citation

If you find our code useful, please cite the following papers:

@article{zhu2022deep-span,
  title={Deep Span Representations for Named Entity Recognition},
  author={Zhu, Enwei and Liu, Yiyang and Li, Jinpeng},
  journal={arXiv preprint arXiv:2210.04182},
  year={2022}
}
@inproceedings{zhu2022boundary,
  title={Boundary Smoothing for Named Entity Recognition},
  author={Zhu, Enwei and Li, Jinpeng},
  booktitle={Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  month={may},
  year={2022},
  address={Dublin, Ireland},
  publisher={Association for Computational Linguistics},
  url={https://aclanthology.org/2022.acl-long.490},
  pages={7096--7108}
}
@article{zhu2021framework,
  title={A Unified Framework of Medical Information Annotation and Extraction for {C}hinese Clinical Text},
  author={Zhu, Enwei and Sheng, Qilin and Yang, Huanwan and Li, Jinpeng},
  journal={arXiv preprint arXiv:2203.03823},
  year={2021}
}

References

  • Chizat, L., Oyallon, E., and Bach, F. On lazy training in differentiable programming. In NeurIPS 2019.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eznlp-0.2.4.tar.gz (121.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page