Skip to main content

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.

Metadata

Release files for eznlp 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eznlp 0.4.0
File Size Uploaded Provenance Actions
eznlp-0.4.0.tar.gz 149.1 kB Without provenance Details for eznlp-0.4.0.tar.gz

Release files / eznlp-0.4.0.tar.gz

Download URL eznlp-0.4.0.tar.gz
Size 149.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a3b999f69cb819630d76fc17bafc1c315575d08a70a83d9797afd2a36cc9cd92
BLAKE2b-256 checksum
How to use checksums
76c2d871c4a155eb45ae82b82719f3ce5f579dfe7ac6fb9f3d2a3faaa352dedb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Security for eznlp 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page