Doclingdocling 2.127.0 · Python 3.10+
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
26 small wins to finish your pathNext lesson

What you are going to build

Docling reads a PDF, a Word file, a spreadsheet or a web page and gives you back one Python object with the same shape every time. This course builds a searchable handbook for an online shop out of four files in four different formats, and every lesson runs on your machine.

A document is easy for a person to read and awkward for a program. A PDF is drawing instructions. A spreadsheet is cells. An HTML page is tags. Getting the words out of each one is a different job with a different library, and none of them tells you that a line was a heading.

Docling does that job once, for every format, and hands back the same object. This lesson runs the finished thing so you can see where the course goes.

The shop handbook, answering a question

Example
from handbook import build, ask

index, report = build()
print(ask(index, "how long does a refund take?"))

The answer came out of a table inside an HTML file. The line under it says which file, which heading it sat under, and, when the file was a PDF, which page. That is the whole point of the course: an answer you can check.

Example
from handbook import build, ask

index, report = build()
print(ask(index, "can I return a damaged item?"))

Same call, different file. This one came from a two page PDF, and the citation says which page of it. handbook.py is yours by lesson 29; nothing in it is longer than the pieces you build one at a time along the way.

Four files, four formats

The shop keeps its support handbook in whatever format each person happened to use. That is normal, and it is why a tool like this exists.

FileFormatWhat is in it
shipping.mdMarkdownDelivery times and tracking, under two headings
refunds.htmlHTMLA paragraph and a table of refund times
orders.csvCSVThree orders and their status
returns.pdfPDFA two page returns policy

All four are on this page, in the lessons that first use them, and you can build the PDF yourself with a script shown in lesson 13. No file here is bigger than a screen.

What you will have built

PieceWhat it doesLesson
convertOne call that reads any of the four files2
The document objectText, tables and their order, in one shape5 to 9
ExportsMarkdown, plain text, HTML and DocTags back out10 to 12
The PDF pipelinePages, boxes, heading levels and a quality grade13 to 17
Batch conversionFour files at once, and the ones that failed18 to 21
ChunkingCutting a document into pieces worth searching22 to 25
The handbookAn index, a report and an answer with a citation28 and 29
Where the course goes
ReadingThe documentWriting back outPDFsRetrievalDocling

What you need

  • Python 3.10 or newer.
  • pip install docling. That is the only install in the whole course.
  • No account, no API key, no card. Docling runs its models on your machine.
  • About half a gigabyte of disk for the PDF models, downloaded the first time you convert a PDF in lesson 13. Lessons 1 to 12 need none of it.
Parts 1 to 3 download nothing. Markdown, HTML and CSV are read by ordinary parsing code with no machine learning in it at all. The models arrive when the PDF does, which is why the PDF waits until part 4.
Try it yourself
  • Read the table above and pick the row you want most. That is the lesson to look forward to.
  • Find a document on your own machine that a program has never been able to read. That is what this course is for.
Back toAll frameworks

Every expert started right here.