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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev17.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.dev17.tar.gz
Algorithm Hash digest
SHA256 51bfda1db454d4fd57be0906e2156953b9f1902d442084d5983168bf59d72846
MD5 5287e908eb28370242cb28ee2359c6d2
BLAKE2b-256 f76e2de63ae13e40e8432ec85cbdbd839a52571052f7413db5fbfeee0566f785

See more details on using hashes here.

File details

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

File metadata

  • Download URL: swarmauri_evaluatorpool_accessibility-0.3.0.dev17-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.dev17-py3-none-any.whl
Algorithm Hash digest
SHA256 74fba7e69f72f2b23eec88404c62735ec5c8c52302526fde0c1874e0c72e8682
MD5 4dbb9f3cfcfddd0782d60cd5ce9ef3f6
BLAKE2b-256 4948cc86553376be28ed3e6db3886571d0c3ac432bdf4ebddd13758124bc8cc0

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