information_extractor
Overview
information_extractor is a Python package that combines spaCy, coreferee, and SpanBERT to extract structured relationships between entities in natural language text. It's purpose-built for anyone who wants to bridge NER, coreference resolution, and relation extraction into one streamlined pipeline.
Features
✅ Entity Linking & Coreference Resolution
- Uses
spaCywithcorefereeto resolve pronouns and link entity mentions. - Flexible support for multiple entity types:
PERSON,ORG,LOC,DATE, etc.
✅ Relation Extraction with SpanBERT
- Uses fine-tuned SpanBERT model trained on TACRED.
- Handles subject/object marking and context-aware classification.
- Confidence scoring and de-duplication of extracted relations.
- GPU acceleration supported out of the box.
✅ CLI Interface
ie --text "Barack Obama was born in Hawaii." [--deps]
--deps: Downloads and installs required pretrained models if not present.
Installation
pip install information_extractor
Optional: Download model dependencies
Run the following once to download SpanBERT, spaCy model, coreferee model:
ie --deps
Alternatively, you can import and run the dependency script directly:
from information_extractor.dependency import setup_dependencies
setup_dependencies()
Example Usage
from information_extractor.pipeline import RelationExtractor
text = "Sundar Pichai is the CEO of Google. He lives in California."
extractor = RelationExtractor()
results = extractor.extract(text)
for relation in results:
print(relation)
Sample Output
[
{
"subject": "Sundar Pichai",
"object": "Google",
"relation": "per:employee_of",
"confidence": 0.92
},
...
]
Project Structure
information_extractor/
├── assets/
│ └── pretrained_spanbert/
├── dependency.py # Downloads all model dependencies
├── pipeline.py # Core logic for NLP + SpanBERT
├── main.py # CLI entrypoint
Pretrained Assets
Models are downloaded from hosted GitHub release assets:
- ✅
SpanBERTweights & config - ✅
en_core_web_mdspaCy model - ✅
coreferee_model_enfor coreference resolution - ✅
torchwheel for reproducibility
Citation
This project builds on the work of Facebook Research. If you use SpanBERT, please cite:
@article{joshi2019spanbert,
title={{SpanBERT}: Improving Pre-training by Representing and Predicting Spans},
author={Mandar Joshi and Danqi Chen and Yinhan Liu and Daniel S. Weld and Luke Zettlemoyer and Omer Levy},
journal={arXiv preprint arXiv:1907.10529},
year={2019}
}
License
MIT. See LICENSE for full terms.
Note: This project redistributes pretrained model weights for convenience under fair use for research.
Metadata
Release files for information-extractor 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| information_extractor-0.2.0.tar.gz | 32.1 kB | With provenance | Details for information_extractor-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| information_extractor-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for information_extractor-0.2.0-py3-none-any.whl |
Total release size: 65.9 kB
Release files / information_extractor-0.2.0.tar.gz
| Download URL | information_extractor-0.2.0.tar.gz |
|---|---|
| Size | 32.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a4703acc60ee4a730fecfece24654f9a41cd509f60056807a1eb9de57d67557a
|
|
BLAKE2b-256 checksum How to use checksums |
1a834d3e7bf6fe265b6b277de172fa74ae5471863a39d9e3d684d4d04be6a91a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.
Transparency logRelease files / information_extractor-0.2.0-py3-none-any.whl
| Download URL | information_extractor-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e96ce3573753cfb4673f3fa837f979e6a4afbe78b0815e25d4553cf6e55cd476
|
|
BLAKE2b-256 checksum How to use checksums |
ede1a02944f96986c877fd1cf8619034851505bd4f413bbd7fd84d585fb94194
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.
Transparency logSecurity for information-extractor 0.2.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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for information_extractor-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.
Transparency logA 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.