Files
surya-ocr/tests/test_cer_divergence.py
T
Fu DaiandClaude Opus 4.8 1a585693be Suya OCR API — vLLM-backed, OpenAI-compatible OCR service
FastAPI service wrapping the Surya-OCR-2 model (datalab-to) served through vLLM:
legacy /v1/api/ai/* endpoints, an OpenAI-compatible /v1/chat/completions endpoint,
a coalescing request batcher, a local OCR CLI, Docker packaging, multilingual
example outputs, and quantization/concurrency benchmarks.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-17 10:20:02 +04:00

19 lines
383 B
Python

from scripts.cer_divergence import cer
def test_identical_text_is_zero():
assert cer("hello world", "hello world") == 0.0
def test_single_substitution():
# 1 edit over 5 reference chars
assert cer("hello", "hallo") == 0.2
def test_empty_reference_with_output_is_one():
assert cer("", "abc") == 1.0
def test_empty_both_is_zero():
assert cer("", "") == 0.0