ek.tools#

Small, CLI-friendly functions over the ek core (the dispatch surface).

These are thin, string-in/value-out wrappers designed for triple dispatch (CLI today, HTTP/UI later). The single _dispatch_funcs list is the SSOT of what ek.__main__ exposes, so there is no duplicated command registration, and each function’s signature is its command-line interface.

Run them from the shell:

python -m ek cer "hello wrld" "hello world"
python -m ek where
python -m ek check tesseract

Functions

cer(prediction, gold, *[, normalize])

Character Error Rate between a prediction and a gold string (lower is better).

check(engine)

Report what an OCR engine needs to run (delegates to ocracy when installed).

cost_per_success(total_dollars, successes, *)

Cost-of-Pass: dollars per successfully completed task (inf if none succeeded).

engines()

List installed OCR backends (requires the ek[ocr] extra).

pass_k(n, c[, k])

pass@k (capability) and pass^k (reliability) from c successes in n trials.

rover(*hypotheses[, confidence])

ROVER-fuse 2+ transcriptions into a consensus + mean agreement (reference-free).

version()

Print the installed ek version.

wer(prediction, gold, *[, normalize])

Word Error Rate between a prediction and a gold string (lower is better).

where()

Print the local data folder where ek persists gold/results/runs.

ek.tools.cer(prediction, gold, *, normalize=None)[source]#

Character Error Rate between a prediction and a gold string (lower is better).

Return type:

float

ek.tools.check(engine)[source]#

Report what an OCR engine needs to run (delegates to ocracy when installed).

Return type:

dict

ek.tools.cost_per_success(total_dollars, successes, *, attempts=None)[source]#

Cost-of-Pass: dollars per successfully completed task (inf if none succeeded).

The unit that matters for an agent – tokens spent on a failed episode are pure waste.

Example:

python -m ek cost-per-success 12.50 5 --attempts 20
Return type:

dict

ek.tools.engines()[source]#

List installed OCR backends (requires the ek[ocr] extra).

Return type:

list

ek.tools.pass_k(n, c, k=1)[source]#

pass@k (capability) and pass^k (reliability) from c successes in n trials.

pass@k asks “can it ever do this?”; pass^k asks “does it do this every time?” – and only the second is a production number.

Example:

python -m ek pass-k 10 9 --k 8      # a 90%-reliable agent, judged over 8 trials
Return type:

dict

ek.tools.rover(*hypotheses, confidence=True)[source]#

ROVER-fuse 2+ transcriptions into a consensus + mean agreement (reference-free).

Example:

python -m ek rover "the cat sat" "the cat sit" "the bat sat"
Return type:

dict

ek.tools.version()[source]#

Print the installed ek version.

Return type:

str

ek.tools.wer(prediction, gold, *, normalize=None)[source]#

Word Error Rate between a prediction and a gold string (lower is better).

Return type:

float

ek.tools.where()[source]#

Print the local data folder where ek persists gold/results/runs.

Return type:

str