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

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.1.dev2.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.dev2.tar.gz
Algorithm Hash digest
SHA256 1d6d20260a738b298df2e7dca2c979fd7939b5b4f6d6ba18a4a91f2dc73ea468
MD5 7ac36eb3779eb3502541d9bfb08fa0d7
BLAKE2b-256 69b360e9ee5cfb2be1bb772b3915b12ad1c574d78453ea8a2d4feead2e5d49db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_tool_entityrecognition-0.9.1.dev2-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.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 161ed88a2759cb469557bd46dff1cada99e2dc70dab40db54bc7d376a0191895
MD5 21dcf0fafb6dac1364caecc008148b17
BLAKE2b-256 0623986448d193341cc464d47201c10da2b3f7a9e6cf40b774824fa14adea3ba

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