Skip to main content

Swarmauri Community Entity Recognition Tool

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_tool_entityrecognition

---

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 ToolBase component.
  • 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 entities key.

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

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file swarmauri_tool_entityrecognition-0.9.1.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.1.dev1.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_tool_entityrecognition-0.9.1.dev1.tar.gz
Algorithm Hash digest
SHA256 e878f7debb145031487f170b1115b3bf3c15d14b299ead97cb47ef9245d57f3b
MD5 4989311c3c459a62cdb8e6c82d17d0e6
BLAKE2b-256 88659a4b341efd849e1520a63352cd0c30b4b82998933e62eb7c0ad66563a662

See more details on using hashes here.

File details

Details for the file swarmauri_tool_entityrecognition-0.9.1.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.1.dev1-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","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

Hashes for swarmauri_tool_entityrecognition-0.9.1.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 d505326e447e03efae091b1b23d4727b656b767fa46a8812cda70151eade0757
MD5 3c27f42520b103aae4d5136b07336fe6
BLAKE2b-256 c7f28508faab5e66e359da2afc83d43538bb7cf4629c03bd11ae87e3f99c0e92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page