Swarmauri Community Entity Recognition Tool
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_entityrecognition-0.8.2.dev4.tar.gz.
File metadata
- Download URL: swarmauri_tool_entityrecognition-0.8.2.dev4.tar.gz
- Upload date:
- Size: 7.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c070cd26c3d516bacded9ae78d7c197271bc1ab34c8a7ab331581826ff00c564
|
|
| MD5 |
e7e37e7e70fb4c58c595f393569cdfb8
|
|
| BLAKE2b-256 |
82edc54228e929dbd28daa7966f4b4f2e19b3c2930b3904d2de54170904b9bee
|
File details
Details for the file swarmauri_tool_entityrecognition-0.8.2.dev4-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_entityrecognition-0.8.2.dev4-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f50c8e746cbca588806df66cfcf75f3bc66392db2ff2cc79f69efc5810d5654
|
|
| MD5 |
c2529eb153b5418619e81054289fb6e5
|
|
| BLAKE2b-256 |
bf966bcb98751f290ccaf46aa1934e30f376ac6d282b12910b2d213493f25796
|