Download scripts/r5_testpass2/tp2_a5_show.py from treoa/turkic-ocr-code: direct link, hf CLI and curl.
- Browser
- Download file 861 Bytes
-
https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_a5_show.py
- Command line
-
hf download hf://treoa/turkic-ocr-code/scripts/r5_testpass2/tp2_a5_show.py
-
curl -L -o tp2_a5_show.py https://huggingface.co/treoa/turkic-ocr-code/resolve/main/scripts/r5_testpass2/tp2_a5_show.py
861 Bytes
| """Prints the aggregate CER (plain profile) and per-language CER of one score file (no label text). | |
| usage: tp2_a5_show.py SCORE_JSON | |
| """ | |
| import json | |
| import sys | |
| d = json.load(open(sys.argv[1], encoding="utf-8")) | |
| pl = d["profiles"]["plain"] | |
| m = pl["groups"]["all"]["metrics"] | |
| print(d["evalset"], "n", d["set_info"]["n_scored"], "complete", d["coverage"]["complete"], "CER %.4f [%.4f, %.4f]" % (m["cer"]["value"], m["cer"]["lo"], m["cer"]["hi"]), | |
| "WER %.4f EM %.4f HR3 %.4f HR4 %.4f fab %.4f empty %.4f" % (m["wer"]["value"], m["exact_match"]["value"], m["hr3"]["value"], m["hr4"]["value"], | |
| m["fabricated_word_rate"]["value"], m["empty_output_rate"]["value"])) | |
| print(" per lang", {g[5:]: round(100 * v["metrics"]["cer"]["value"], 2) for g, v in pl["groups"].items() if g.startswith("lang:")}) | |