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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev14.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.dev14.tar.gz
Algorithm Hash digest
SHA256 0efe231a53f1245e2466a1541f50b7e7f92c406c102aeec94725a160a76a3769
MD5 e6542b5cedbb3e2a6eb13ca19ce1592c
BLAKE2b-256 9e8055c62e2ed34f477dcce95ec6de66563d9aa4423413ecafc6982198353ba5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev14-py3-none-any.whl
  • Upload date:
  • Size: 23.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","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.dev14-py3-none-any.whl
Algorithm Hash digest
SHA256 9180c7c0b7e8136d7d08b2cc6d63f0507b9babc8ce6d558b3361cbf454bbdb3e
MD5 4c955110b5d5e5d3e49b104dafe14d73
BLAKE2b-256 09b35335ac98f9404e0f8615fad45b173f375ec26f805900c865981bcd86acfd

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