All jobs / AI engineer / Document AI
AI engineer interview question · 0–1 years
Why is “just extract the text from the PDF” harder than it sounds?
The strongest answer
A PDF stores characters at positions, not paragraphs. Reading order, columns, headers and footers, hyphenation and tables must be reconstructed, and naive extraction interleaves columns — so inspect the output before building on it
Why it works
Exactly — PDF is a page-description format. Structure is something the parser infers, which is why two-column papers and tables come out scrambled.
What a good answer covers
- PDF stores positions, not structure.
- Reading order and columns are inferred.
- Strip running headers and footers.
- Read the extracted text yourself.
Answers that fall short
- Close, but not the strongest: PDFs come in many versions and some libraries are buggy, so you need to pick a well-maintained parser
A good parser matters, but the reason is the format itself: the file usually holds no paragraph or table for the library to read. - Weak: It is not hard; a PDF is a text file with formatting, so any library returns the text in the right order
The file describes where glyphs are drawn. Order and structure are inferred, and the inference fails on columns, tables and running headers. - Red flag: I would not look at the extracted text at all; the embedding model copes with messy input well enough
Garbage text gives garbage chunks and confident wrong answers. Not looking at your own pipeline’s output is the red flag.
Who gets asked this
More Document AI questions
- Your document Q&A is good on prose but wrong on figures that come from tables. In the extracted text, a table…
- How do you chunk a long contract or manual that has headings, numbered clauses, tables and figures?
- A legal team will only use your contract assistant if every answer points to a real page and clause. How do…
- In your equipment manuals the wiring diagrams and annotated screenshots carry the key information. The…
- A customer’s legal team asked your contract assistant whether a 300-page agreement had an auto-renewal…
- Your service extracts supplier, totals and bank details from invoices in hundreds of layouts. Finance wants…
- Two PDFs look identical on screen, but your parser gets clean text from one and nothing from the other. Why…