|
|
@ -58,3 +58,18 @@ def test_cli_json_cer_is_infinity(tmp_path):
|
|
|
|
j = json.load(jsonf)
|
|
|
|
j = json.load(jsonf)
|
|
|
|
assert j["cer"] == pytest.approx(float("inf"))
|
|
|
|
assert j["cer"] == pytest.approx(float("inf"))
|
|
|
|
assert j["fca"] == pytest.approx(-13)
|
|
|
|
assert j["fca"] == pytest.approx(-13)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_cli_json_cer_0_in_report(tmp_path):
|
|
|
|
|
|
|
|
"""Test that the cli/process() yields a loadable JSON report when CER == 0"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with working_directory(str(tmp_path)):
|
|
|
|
|
|
|
|
with open("gt.txt", "w") as gtf:
|
|
|
|
|
|
|
|
gtf.write("Lorem Ipsum")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
process("gt.txt", "gt.txt", "report", metrics="cer,wer,fca")
|
|
|
|
|
|
|
|
with open("report.json", "r") as jsonf:
|
|
|
|
|
|
|
|
j = json.load(jsonf)
|
|
|
|
|
|
|
|
assert j["cer"] == pytest.approx(0)
|
|
|
|
|
|
|
|
assert j["wer"] == pytest.approx(0)
|
|
|
|
|
|
|
|
assert j["fca"] == pytest.approx(1)
|
|
|
|