Swarmauri Parser Entityrecognition
Named-entity recognition (NER) parser for Swarmauri built on spaCy. Extracts entities (PERSON, ORG, GPE, etc.) from unstructured text and returns Document objects with entity metadata.
Features
- Uses spaCy's
en_core_web_smmodel by default (downloads automatically if missing). - Falls back to a blank English pipeline with minimal regex-based tagging when the full model is unavailable (best-effort mode).
- Emits
Documentinstances containing the entity text and metadata (entity_type,entity_id).
Prerequisites
- Python 3.10 or newer.
- spaCy and its English model. The parser attempts to download
en_core_web_smif missing; setSPACY_HOMEor pre-install the model in production deployments. - If running without internet access, install the model ahead of time:
python -m spacy download en_core_web_sm.
Installation
# pip
pip install swarmauri_parser_entityrecognition
# poetry
poetry add swarmauri_parser_entityrecognition
# uv (pyproject-based projects)
uv add swarmauri_parser_entityrecognition
Quickstart
from swarmauri_parser_entityrecognition import EntityRecognitionParser
text = "Barack Obama was born in Hawaii and served as President of the United States."
parser = EntityRecognitionParser()
entities = parser.parse(text)
for entity_doc in entities:
print(entity_doc.content, entity_doc.metadata["entity_type"])
Batch Processing
texts = [
"Apple Inc. unveiled new MacBooks in California.",
"Tim Cook met investors in New York City.",
]
parser = EntityRecognitionParser()
results = [parser.parse(t) for t in texts]
for doc_set in results:
for doc in doc_set:
print(doc.content, doc.metadata["entity_type"])
Handling Fallback Mode
When spaCy's English model is unavailable, the parser performs best-effort matching using a blank pipeline and simple regex patterns. Check for entity_type values and the entity_id metadata to understand which mode produced the result.
parser = EntityRecognitionParser()
entities = parser.parse("Tim Cook announced new products in New York City for Apple Inc.")
print([d.metadata for d in entities])
Install spaCy models before production use to avoid fallback accuracy losses.
Tips
- For languages beyond English, load a different spaCy model by changing the initialization logic (e.g., subclass the parser and load
es_core_news_sm). - Preprocess text to remove noise (HTML tags, markup) before parsing to improve NER accuracy.
- Combine with Swarmauri middleware or pipelines to fuse entity data with downstream tasks (e.g., knowledge graph enrichment, anonymization).
Want to help?
If you want to contribute to swarmauri-sdk, read up on our guidelines for contributing that will help you get started.
Metadata
Release files for swarmauri_parser_entityrecognition 0.8.3
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 |
|---|---|---|---|---|
| swarmauri_parser_entityrecognition-0.8.3.tar.gz | 8.7 kB | Without provenance | Details for swarmauri_parser_entityrecognition-0.8.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_parser_entityrecognition-0.8.3-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_parser_entityrecognition-0.8.3-py3-none-any.whl |
Total release size: 18.5 kB
Release files / swarmauri_parser_entityrecognition-0.8.3.tar.gz
| Download URL | swarmauri_parser_entityrecognition-0.8.3.tar.gz |
|---|---|
| Size | 8.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3e4a00ddd218b30d0be8732280f5512acde444cdc92bb35fe67343e55a97a824
|
|
BLAKE2b-256 checksum How to use checksums |
689db7c80585f17a1d11950a2162c61fe1857e425b0f8b7b033109a9596eabfe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / swarmauri_parser_entityrecognition-0.8.3-py3-none-any.whl
| Download URL | swarmauri_parser_entityrecognition-0.8.3-py3-none-any.whl |
|---|---|
| Size | 9.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c33d60f82d0ce901a595d602eee37cc977da888711fa8e3643661e868ceb0ba4
|
|
BLAKE2b-256 checksum How to use checksums |
8f26db964017723beefbe2c5449a6ade662eb3978259aa47f1114217d6a93ff4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for swarmauri_parser_entityrecognition 0.8.3
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.