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

swarmauri_tool_entityrecognition-0.9.0.tar.gz (7.4 kB view details)

Uploaded Source

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.0.tar.gz.

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for swarmauri_tool_entityrecognition-0.9.0.tar.gz
Algorithm Hash digest
SHA256 055213d42637725f241b1e75fe0bca60fd405cd60a012e049eadcb64cf265c15
MD5 7b832936ce035a6acf664e674d68df80
BLAKE2b-256 5f044161a662e2dfd5f80cf559298513207e0b03322b4425d3ec2a03690bacf5

See more details on using hashes here.

File details

Details for the file swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for swarmauri_tool_entityrecognition-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c8e6d90b6723eab5f68432e94194f779933768d31f5936132a6c8a5c020ca51
MD5 2b581b8773d07af43da6ed7d4e94e6ec
BLAKE2b-256 57016fd13888b8b88e1f43f802c2f5c93e99c5a8962ef5815a8ebeded3ba0dde

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