Skip to main content

A package providing accessibility and readability evaluators for SwarmAuri

Project description

Swarmauri Logo

PyPI - Downloads Hits PyPI - Python Version PyPI - License PyPI - swarmauri_evaluatorpool_accessibility


Swarmauri Evaluatorpool Accessibility

Accessibility-focused evaluator pool for Swarmauri programs. The pool bundles a set of classic readability metrics (Automated Readability Index, Coleman–Liau, Flesch–Kincaid Grade, Flesch Reading Ease, and Gunning Fog) and normalises their scores onto a single 0–1 scale where higher values mean easier-to-read content.

Installation

pip

pip install swarmauri_evaluatorpool_accessibility

Poetry

poetry add swarmauri_evaluatorpool_accessibility

uv

# Install into the current environment
uv pip install swarmauri_evaluatorpool_accessibility

# Or add it to the project pyproject.toml
uv add swarmauri_evaluatorpool_accessibility

Usage

AccessibilityEvaluatorPool is a registered EvaluatorPoolBase component. It expects a sequence of Swarmauri Program objects, runs the configured evaluators concurrently, then returns standard EvalResultBase instances with the aggregated score and detailed metadata for every evaluator.

Example

from swarmauri_evaluatorpool_accessibility.AccessibilityEvaluatorPool import AccessibilityEvaluatorPool
from swarmauri_standard.programs.Program import Program

program = Program(content={"example.txt": "This is a simple sentence. Here is another one."})

pool = AccessibilityEvaluatorPool()
pool.initialize()  # spin up the thread pool once before evaluating

results = pool.evaluate([program])
result = results[0]

print(f"Aggregate accessibility score: {result.score:.2f}")
print("Per-evaluator scores:", result.metadata["evaluator_scores"])
flesch_meta = result.metadata["evaluator_metadata"].get(
    "FleschReadingEaseEvaluator", {}
)
print(
    "Flesch interpretation:",
    flesch_meta.get("readability_interpretation", flesch_meta.get("error", "not available")),
)

pool.shutdown()  # release resources when finished

Result structure

Each entry returned from evaluate is an EvalResultBase with:

  • score: the weighted mean of the evaluator scores mapped to the 0–1 range.
  • metadata["evaluator_scores"]: raw scores keyed by evaluator name.
  • metadata["evaluator_metadata"]: evaluator-specific metadata (e.g. sentence counts, syllable estimates, interpretation strings).
  • metadata["aggregate_score"]: mirrors .score for convenience.

You can customise the weighting of each evaluator by passing a weights dictionary (name → float) when constructing the pool.

Notes

  • The pool automatically registers the bundled evaluators when no explicit list is provided. You can pass your own evaluators that satisfy the IEvaluate interface to override or extend the defaults.
  • FleschReadingEaseEvaluator downloads NLTK's punkt tokenizer and cmudict pronunciation dictionary on first use. Set NLTK_DATA_DIR to point to a writable cache location if required. When these resources are not available the evaluator reports an "error" entry in its metadata instead of raising an exception.

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


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_evaluatorpool_accessibility-0.3.0.dev8.tar.gz.

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev8.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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_evaluatorpool_accessibility-0.3.0.dev8.tar.gz
Algorithm Hash digest
SHA256 8466cf3d112b595339387464b0dd6af7a2ce2f614066b41bb945a587183d574c
MD5 7d2fcc98bac5e4c16373edfde152cbf1
BLAKE2b-256 8b7253117ec84567cdd9d2e477b8036eeb13f1482dd6b40987c7ee6bda1752e5

See more details on using hashes here.

File details

Details for the file swarmauri_evaluatorpool_accessibility-0.3.0.dev8-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev8-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.3 {"installer":{"name":"uv","version":"0.10.3","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_evaluatorpool_accessibility-0.3.0.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 bb06c4b18c4a9d23eddc995a0e2495608b1277af0049796c774dac53308f4482
MD5 bf0160f0864992bfc19c84232162ed16
BLAKE2b-256 0f36512209fabc166b99ec912d70c2fb7d95ba42b7852e1511e1f363806352d6

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