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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev7.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.dev7.tar.gz
Algorithm Hash digest
SHA256 845b0300fac4f42dbfb6bf6c723f502e055e288fe7b70f4af32f9716ac9a995f
MD5 4e679b27260a32a0453ca34413867c5b
BLAKE2b-256 d2bdffb739d696bd37d465b09d25778fa55083a11d3e3de2af9e70a33a20553e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev7-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.dev7-py3-none-any.whl
Algorithm Hash digest
SHA256 5a724ca6f3572f73d61fd1df9f43cf2a28a83ae1d6189b9d097485e85b3c640b
MD5 fd29da48c22d43d51e2ade377652ab5d
BLAKE2b-256 477974e78532b0ff2904350d54be6ed23df31e76a7dbf51f529874d3b911d01c

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