Apple file → trustworthy text. A small Swift package that turns any local file an Apple platform can read — PDF, image, plain text — into clean, confidence-scored text. One seam:
let result = try Lesbar.extract(url)
// ExtractedFile { text, kind, method, confidence, degraded }It owns the "legible" problem once, so the German-named on-device tooling family
(apfel, auge, ohr, kern) doesn't each re-implement Vision OCR, PDFKit
text-layer extraction, rasterize-and-OCR fallback, and the async→sync bridge.
augealready shipped Vision OCR + PDFKit extraction (v1.8.0).apfel -f(ticket #210) needs the exact same stack. Rather than duplicate ~1700 lines of Vision/PDFKit, both consumelesbar.- The hard, easy-to-get-wrong part — bridging synchronous CLI code to async Vision requests without deadlocking — lives here, solved and tested once.
Mirrors auge's split so the two read the same way:
LesbarCore— pure logic, no Vision, no PDFKit. File-kind sniffing, method planning, text decoding, confidence/degraded scoring, the error taxonomy. 100% unit-tested by a dependency-free Swift test runner.Lesbar— wiresLesbarCoreto Vision + PDFKit behindextract(_:).
0.2.0 — consumed by auge (v1.9.0+), which
delegates its entire Vision OCR + PDFKit stack here. apfel -f is next. Built test-first
(red → green): 104 pure unit tests + 11 on-device integration checks.
Beyond the simple Lesbar.extract(url) seam, the OCR API mirrors auge's battle-proven
surface: per-line detail with confidence + bounding boxes, multi-language multi-pass merge,
image enhancement, and PDF DPI / embedded-text control.
swift run lesbar-tests # pure-Swift runner, no XCTest neededMIT (matches the ecosystem).