Fast, accurate OCR with correctness assessment.
from minicpmvocr.postprocess.otsl import convert_otsl_to_html
def test_raw_special_chars_escaped_once():
out = convert_otsl_to_html("<fcel>A & B<fcel>it's<nl>")
assert "A & B" in out
assert "it's" in out
def test_model_emitted_entities_not_double_escaped():
out = convert_otsl_to_html("<fcel>Children & Families<fcel>it's<nl>")
assert "&amp;" not in out
assert "&#x27;" not in out
assert "Children & Families" in out
assert "it's" in out
def test_html_escaped_otsl_tags_convert():
raw = "<fcel>A<fcel>B<nl><fcel>C<fcel>D<nl>"
assert convert_otsl_to_html(raw) == (
"<table><tr><td>A</td><td>B</td></tr>"
"<tr><td>C</td><td>D</td></tr></table>"
)