Intermediate level · Module 5: Structured Outputs and Data Validation · Lesson 2 of 3
Information Extraction from Documents
Learners extract structured fields (dates, amounts, locations, activities, results) from NGO reports or business documents into validated records.
In this lesson you will
- Design extraction schemas
- Extract fields reliably from documents
Key concepts
information extractionextraction schemaoptional vs required fieldsevidence quotesunknown values
The lesson
Extraction turns unstructured text into records: from an activity report, extract date, location, activity type, number of participants and outcomes. The NLP programme covers classical extraction methods; here the LLM does the extraction under a schema.
Allow fields to be null when the document does not state them, and instruct the model never to guess. Ask for a short evidence quote for each important value.
Check each extracted value against its quote automatically: the number in the record must appear in the quote, and the quote must appear in the document.
Step by step
- Define an ActivityRecord schema with evidence quotes.
- Extract records from five fictional reports.
- Check values against quotes and quotes against documents.
- Count and fix errors.
Practice activity
Build a validated extractor for fictional activity reports.
Expected result: Records with evidence quotes and automatic checks that catch invented values.
Check your understanding
-
Why allow null fields in extraction?
Show answer
So the model does not guess values the document does not state.
-
How can evidence quotes help?
Show answer
Values can be checked automatically against text that appears in the document.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.