Lesson 1 of 2 Information Extraction Concepts

Extracting Structured Data from Text and Documents

This lesson explains how information extraction turns documents such as invoices, contracts, forms and reports into structured data that systems can store, search and act on.

Learning outcomes

After completing this lesson, you will be able to:

  • Explain the role of OCR and layout analysis.
  • Explain how field extraction with a schema returns named, typed values.
  • Describe how information is extracted from text that is already digital.

From pixels to text: OCR

Scanned documents and photos are images, so the first step is optical character recognition (OCR), which detects lines and words and converts them into text, with their positions on the page. OCR handles printed and handwritten text in many languages. By itself, OCR only produces text: it does not know that 1,240.00 is the invoice total.

Layout analysis

Layout analysis recognizes the structure of a page: paragraphs, headings, tables with rows and columns, selection marks such as ticked boxes, and figures. Preserving structure matters because meaning often depends on it; a value in a table only makes sense with its row and column headers. Representing the result as Markdown keeps headings and tables in a form that both people and language models can read.

Field extraction with a schema

Field extraction returns specific values as named, typed fields: VendorName (string), InvoiceDate (date), Total (number), Items (an array of objects with description, quantity and price). A schema lists the fields to return and describes each one. Modern extraction is semantic: it understands meaning, so it finds the invoice number whether the label says Invoice No., Inv # or nothing at all.

Fields can be extracted (the value appears in the document), classified (the document or value is assigned one of a set of categories, such as document type) or generated (a value is inferred, such as a one-sentence summary). Each value comes with a confidence score and its location in the source, so that uncertain values can be checked by a person.

The following table recaps how the three techniques build on each other.

TechniqueOutputExample
OCRText and its positionsAll words on a scanned invoice
Layout analysisStructure: paragraphs, headings, tables, selection marksThe line-item table with its columns
Field extractionNamed, typed values with confidenceTotal = 1,240.00 (confidence 0.97)

The following diagram shows how the techniques build on each other and the three field methods.

How OCR, layout analysis and field extraction build on each other. OCR reads the text and its positions. Layout analysis adds structure, such as paragraphs, headings, tables and selection marks. Field extraction returns named, typed values defined by a schema, each with a confidence score and its location. Fields can be extracted when the value appears, classified into one of a set of categories, or generated, such as a summary; extraction is semantic, so a label such as Inv # is still recognized.
Field extraction returns business data, not just text.
Sort into groups

OCR, layout or fields?

Exam skills 1.3.5

Decide which extraction technique produces each output.

Log in to try this activity Interactive activities are free with an account.

Extraction from plain text

Text that is already digital, such as emails and chat messages, skips OCR. Entity detection finds standard entities, and generative models or schema-based analyzers extract custom fields, such as the order number and requested action from a customer email.

True or false

From text to fields

Exam skills 1.3.5

Check four statements about extracting information from documents and text.

Log in to try this activity Interactive activities are free with an account.
Worked example

OCR or field extraction

An accounts team receives supplier invoices in many layouts. It needs the supplier name, invoice date and total entered into its finance system automatically, and wants uncertain values reviewed. A developer proposes running OCR and searching the text for the word Total.

OCR plus keyword search breaks when a supplier labels the total Amount due or places it in a table. Schema-based field extraction finds the values by meaning across layouts and returns confidence scores, so values below a threshold can go to a review queue.

Check yourself

Why do extracted fields come with confidence scores?

Show answer

So that uncertain values can be sent to a person for review instead of being used automatically.

Exam Tips

Remember for the exam

  • OCR produces text; layout analysis adds structure; field extraction returns typed values.
  • Schemas define the fields; semantic extraction works even when labels differ.
  • Confidence scores let uncertain values be reviewed by a person.