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 Discord

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.11.0.dev1.tar.gz.

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.11.0.dev1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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.11.0.dev1.tar.gz
Algorithm Hash digest
SHA256 0a13397ef7557c42fa9e9c8db62de7d24346e7249ce20a2fc6ff77379ffe8f03
MD5 902d715a571232e536856e1ebad0ddd4
BLAKE2b-256 39443ad0abdc8cde554f2debda59583d78c41178bfd8798b2a7768722cb40e66

See more details on using hashes here.

File details

Details for the file swarmauri_evaluatorpool_accessibility-0.11.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.11.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","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.11.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 89d55807f44efadf29bdebb6e16054852a000455c0e3be6a96cc81a7c30a102c
MD5 fa35797c699d23773acde080055d2ee5
BLAKE2b-256 0b3054af66a338d5293b6920812cb85ffb843fe0cf145b54d50973e7060a08f2

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