Skip to main content

Easy Natural Language Processing

Project description

Easy Natural Language Processing

Overparameterized neural networks are often described as lazy (Chizat et al., 2019), which motivates us to design architectures and objectives that are easier to optimize.

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

This repository also contains code for our published papers:

  • See this link for Deep Span Representations for Named Entity Recognition, presented at Findings of ACL 2023.
  • See this link for Boundary Smoothing for Named Entity Recognition, presented at ACL 2022.
  • See the annotation scheme and HwaMei-500 dataset described in A Unified Framework of Medical Information Annotation and Extraction for Chinese Clinical Text published in Artificial Intelligence in Medicine.

Installation

Create an Environment

We recommend using Docker. The latest tested image is pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel.

$ docker run --rm -it --gpus=all --mount type=bind,source=${PWD},target=/workspace/eznlp --workdir /workspace/eznlp pytorch/pytorch:2.6.0-cuda12.6-cudnn9-devel

Alternatively, you can create a virtual environment. For example:

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

Install eznlp

If you wish to use eznlp as a package, install it from PyPI:

$ pip install eznlp

If you plan to develop on this project, install it in editable mode:

$ pip install -e .

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:

@inproceedings{zhu2023deep,
  title={Deep Span Representations for Named Entity Recognition},
  author={Zhu, Enwei and Liu, Yiyang and Li, Jinpeng},
  booktitle={Findings of the Association for Computational Linguistics: ACL 2023},
  month={jul},
  year={2023},
  address={Toronto, Canada},
  publisher={Association for Computational Linguistics},
  url={https://aclanthology.org/2023.findings-acl.672},
  doi={10.18653/v1/2023.findings-acl.672},
  pages={10565--10582}
}
@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},
  doi={10.18653/v1/2022.acl-long.490},
  pages={7096--7108}
}
@article{zhu2023framework,
  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 Liu, Yiyang and Cai, Ting and Li, Jinpeng},
  journal={Artificial Intelligence in Medicine},
  volume={142},
  pages={102573},
  year={2023},
  publisher={Elsevier}
}

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.4.0.tar.gz (149.1 kB view details)

Uploaded Source

File details

Details for the file eznlp-0.4.0.tar.gz.

File metadata

  • Download URL: eznlp-0.4.0.tar.gz
  • Upload date:
  • Size: 149.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.11

File hashes

Hashes for eznlp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a3b999f69cb819630d76fc17bafc1c315575d08a70a83d9797afd2a36cc9cd92
MD5 74987fd71aa7329d69dd314d649d0719
BLAKE2b-256 76c2d871c4a155eb45ae82b82719f3ce5f579dfe7ac6fb9f3d2a3faaa352dedb

See more details on using hashes here.

Supported by

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