Search across 30 Polish textbooks
Find exercises by topic and open the exact page in the original book.
- Problem
- Preparing one 60-minute Polish lesson meant opening a dozen 200-page PDFs one by one just to find five drills on the same grammar case.
- My role
- I designed and built the vision extraction pipeline, deterministic Python verifier, hybrid search engine, and page reader for one teacher. Textbook content belongs to its publishers.
- Solution
- Vision-assisted task detection backed by strict Python invariants, semantic + lexical ranking, and a split-pane reader anchored to the original book and page.
- Outcome
- By September 2026, the library indexed 30 textbooks with 5,973 verified exercises ready to assign across 29 of them.
My girlfriend started teaching Polish on Preply. She had around 30 textbooks and workbooks covering A1 through C1, packed with great exercises. The catch? Preparing a single 60-minute lesson on the genitive plural meant opening a dozen 200-page PDFs one by one and scrolling until her eyes hurt.
So I built a library around one rule: search the exercise, not the book. Type a grammar topic, pick a level, and compare drills from different publishers side by side, with the original book and page number attached to every single crop.
Why standard OCR makes a mess of language workbooks
A language textbook page is not a novel. It is a collage of two-column drills, fill-in-the-blank tables, dialogue bubbles, crossword grids, and answer keys. Run plain text OCR and you destroy the visual layout that makes an exercise usable in class. Run naive object detection and a 10-line drill gets chopped into 10 orphan sentences without their instruction.
Instead, a vision model first decides whether a page contains learner tasks at all (skipping covers, tables of contents, and transcripts). Then it draws bounding boxes that keep each governing instruction glued to all ten of its numbered lines.
Instructions and answer spaces stay together.HURRA, p. 116 - artwork by the publisher.
The model proposes; the code checks. Python clamps every bounding box so a neighbouring column cannot bleed into the crop, drops duplicate detections, and throws out boxes that captured only a section heading.
When an exercise spills onto the next page
Textbooks love putting a reading passage at the bottom of page 60 and the questions at the top of page 61. My cross-page reconciler compares unfinished fragments on consecutive pages by numbering, column position, and wording, joining only the pairs that actually belong together.
If an instruction is still missing its body, the pipeline re-examines both pages together as a spread. Anything that still looks incomplete is quarantined from search. A teacher prepping ten minutes before class should never be handed half a drill.
Some magazine-style spreads still beat automation. In this football exercise, the instruction sits above one column while the stadium illustration stretches across the gutter of both pages. For cases like that, I built a manual repair tool: pick three regions across the spread, keep their original scale, and stitch them into one clean task.

Rank twelve, pick four, check every ID
When the teacher wants a full 45-minute lesson draft, the backend ranks verified exercises by CEFR level, Polish keyword matches, and embedding similarity, then hands the top 12 candidates to the model to sequence two to five tasks from warm-up to practice.
Here too, the server has the last word: FastAPI verifies every returned exercise ID against SQLite, strips duplicates, and checks that the minutes add up. If the model times out or invents an ID, a deterministic fallback builds the lesson directly from the ranked shortlist.
Back to the classroom
Day to day, the read-only search view does most of the heavy lifting: type a topic, filter by level, and open the exercise right next to its full original textbook page so the teacher can check surrounding grammar notes in one click.

In September 2026 the library held 30 books, with 5,973 exercises marked complete from 29 of them. That is an operational snapshot, not a vanity score: levels and topic tags are estimates, and wild page layouts still need a human eye. What changed is simpler: lesson prep now starts with a two-second search instead of a pile of 30 PDFs.





