Lesson 4: Choosing a parser, then cleaning what it returns
21 min read·13 Oct 2026
Module 2 · Lesson 4 · About 50 minutes · Needs: Lessons 2 and 3 of this module (pypdf, pdfplumber, Docling), basic Python dictionaries and regular expressions
The situation
Kwame has 1,840 pages of manuals to load (a simulated count) and four parsers that all "work". He wants one answer: which parser, and how sure are we that it keeps the answers? Owen, in Finance, asks a second question: what will parsing every page cost in machine time?
Both need numbers. This lesson runs page 2 of the P9 guide through four parsers, measures what each loses and how long each takes against its answer key P9_PAGE, then cleans the output: odd characters, broken words, other languages and repeated boilerplate.