Swarmauri Tool Entity Recognition
Named-entity recognition tool for Swarmauri based on Hugging Face transformers. Uses the default pipeline("ner") model to detect tokens labeled as PERSON, ORG, LOC, etc., and returns a JSON-encoded dictionary of entities grouped by label.
Features
- Wraps the transformers NER pipeline in a Swarmauri
ToolBasecomponent. - Auto-downloads the default model on first run (usually
dslim/bert-base-NER). - Aggregates entity tokens by label and returns them as a JSON string in the
entitieskey.
Prerequisites
- Python 3.10 or newer.
transformers,torch, and associated dependencies (installed automatically). Ensure GPU/CPU compatibility for PyTorch according to your environment.- Internet access on first run to download model weights.
Installation
# pip
pip install swarmauri_tool_entityrecognition
# poetry
poetry add swarmauri_tool_entityrecognition
# uv (pyproject-based projects)
uv add swarmauri_tool_entityrecognition
Quickstart
import json
from swarmauri_tool_entityrecognition import EntityRecognitionTool
text = "Apple Inc. is an American multinational technology company."
tool = EntityRecognitionTool()
result = tool(text=text)
entities = json.loads(result["entities"])
print(entities)
Example output:
{"B-ORG": ["Apple", "Inc."], "B-MISC": ["American"], "I-MISC": ["multinational"], ...}
Tips
- The default pipeline tokenizes into subwords; reconstruct phrases by joining consecutive tokens with the same label when needed.
- Specify a different model by subclassing and passing
pipeline("ner", model="<model>")if you require language-specific NER. - Cache Hugging Face models (
HF_HOME) in CI or container builds to avoid repeated downloads.
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_tool_entityrecognition 0.9.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 |
|---|---|---|---|---|
| swarmauri_tool_entityrecognition-0.9.0.tar.gz | 7.4 kB | Without provenance | Details for swarmauri_tool_entityrecognition-0.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl | Python 3 | none | any | Details for swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl |
Total release size: 15.8 kB
Release files / swarmauri_tool_entityrecognition-0.9.0.tar.gz
| Download URL | swarmauri_tool_entityrecognition-0.9.0.tar.gz |
|---|---|
| Size | 7.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
055213d42637725f241b1e75fe0bca60fd405cd60a012e049eadcb64cf265c15
|
|
BLAKE2b-256 checksum How to use checksums |
5f044161a662e2dfd5f80cf559298513207e0b03322b4425d3ec2a03690bacf5
|
| 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_tool_entityrecognition-0.9.0-py3-none-any.whl
| Download URL | swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c8e6d90b6723eab5f68432e94194f779933768d31f5936132a6c8a5c020ca51
|
|
BLAKE2b-256 checksum How to use checksums |
57016fd13888b8b88e1f43f802c2f5c93e99c5a8962ef5815a8ebeded3ba0dde
|
| 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_tool_entityrecognition 0.9.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.