Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lesbar

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.

Why it exists

  • auge already 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 consume lesbar.
  • The hard, easy-to-get-wrong part — bridging synchronous CLI code to async Vision requests without deadlocking — lives here, solved and tested once.

Architecture

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 — wires LesbarCore to Vision + PDFKit behind extract(_:).

Status

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.

Test

swift run lesbar-tests   # pure-Swift runner, no XCTest needed

License

MIT (matches the ecosystem).

About

Apple file → trustworthy text. Shared Swift lib (Vision OCR + PDFKit) for the apfel/auge/ohr/kern family. Built test-first.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages