school

Exclusive content for registered members

Join the Academy for free

Sign in / Register for free
school

Document Intelligence

Smart document processing and analysis with AI

clock 8 hours
trending_up All levels
verified Certificate on completion

check_circle What you will learn in the course?

verified_user Understanding OCR and character-recognition technologies
verified_user Managing document-automation processes
verified_user Using AI for accurate data extraction
verified_user Implementing Document Intelligence solutions in the business
1

Introduction to Document Intelligence

45 minutes

Lessons in this section:

  • play_circle

    What is Document Intelligence

    An introduction to the basic concept of Document Intelligence and its importance in the modern digital world

  • play_circle

    Applications and business scenarios

    Practical examples of how organizations use this technology to improve processes

  • play_circle

    Current technologies in the field

    A review of the leading tools on the market - Azure Document Intelligence, Google Document AI and more

In-depth content

Document Intelligence is a revolutionary field that combines OCR (Optical Character Recognition) technologies with advanced AI. In this module we will explore the fundamentals of this field and understand how it changes the way documents are managed in businesses.

The original problem: For decades, document processing was a time-consuming manual process. Forms, invoices, contracts and document handling required a human to read, understand and extract information. It was a significant bottleneck in every large organization.

💡 Professional tip

Document Intelligence is no longer just reading text - it is understanding the context, the meaning and the relationships between information within a document

The modern solution: With Machine Learning and computer-vision technologies, we can now automate this whole process. The system can not only read text, but also understand the structure, identify tables, detect signatures and extract smart information from complex documents.

Example: processing invoices
Input: a PDF file of a supermarket invoice ↓ 1. Identify the document type (invoice) 2. Detect the boundaries of the important areas 3. Extract: supplier name, order number, total amount 4. Validate the data 5. Pass to the target system Output: structured data, ready for automatic processing

This process, which used to require hours of manual work, can now be done in seconds with 99%+ accuracy

Real business applications
  • Banks and insurance: Processing loan applications, approving documents
  • Legal: Analyzing contracts, extracting important terms
  • Healthcare: Processing medical records, insurance claims
  • Retail: Supply-chain management and receipts
  • Human resources: Processing resumes, verifying documents

A question to consider: In which process at your company could Document Intelligence be applied?

2

OCR and recognition technologies

60 minutes

Lessons in this section:

  • play_circle

    OCR principles

    A deep understanding of how systems convert text images into digital data

  • play_circle

    Recognizing text and figures

    Modern techniques for recognizing handwriting, special figures and text at various angles

  • play_circle

    Handling different images and files

    Working with JPEG, PNG, PDF, scans at different resolutions

In-depth content

OCR (Optical Character Recognition) is the basic technology that lets computers read text from images. But it is much more complex than it first appears.

The process stages in modern OCR

Stage 1: initial image processing (Preprocessing)

Noise removal, contrast adjustment, rotation correction, improving image quality

Stage 2: spatial segmentation (Segmentation)

Dividing the image into logical areas - a header area, body text, tables, a signature area

Stage 3: character recognition (Character Recognition)

Using deep Neural Networks to recognize each character separately

Stage 4: error correction (Post-Processing)

Comparison against a dictionary, error correction, identifying known issues

⚡ Essential knowledge

Modern OCR uses Deep Learning Networks (CNN + RNN) trained on millions of images. Accuracy can reach 99.9% for good-quality documents

Image types and challenges

📄 Black-and-white scans (problem: low quality)

Solution: algorithms for dynamic contrast enhancement and repairing broken characters

🖼️ Color images (problem: complex background)

Solution: separating text from background, appropriate color filters

✍️ Handwriting (problem: large variation between people)

Solution: special models trained on handwriting, lower accuracy (70-80%)

📋 Complex tables (problem: recognizing the structure)

Solution: line detection, understanding relationships between cells, preserving the data structure

Code example: basic image processing
import pytesseract from PIL import Image, ImageEnhance, ImageFilter # load image img = Image.open('document.png') # preprocessing step enhancer = ImageEnhance.Contrast(img) img = enhancer.enhance(2) # increase contrast img = img.filter(ImageFilter.SHARPEN) # sharpen # extract text with OCR text = pytesseract.image_to_string(img, lang='heb') print(text)
Comparison of the main tools
Tool OCR accuracy Table detection Hebrew support
Google Vision API 98%+ ✅ Excellent ✅ Yes
Azure Document Intelligence 99%+ ✅ Excellent ✅ Yes
Tesseract (Open Source) 85-95% ⚠️ Basic ✅ Yes
3

Data processing and analysis

60 minutes

Lessons in this section:

  • play_circle

    Extracting structured information

    Turning free text into structured, ordered data

  • play_circle

    Data cleaning and sanitization

    Techniques for removing errors, duplicates and incorrect data

  • play_circle

    Identifying patterns and categories

    Using ML techniques for automatic classification of documents and the information within them

In-depth content

After we extract text from the image, we must turn it into structured, usable data. This is one of the most important engineering steps in the process, since bad data leads to bad results.

The data-processing stages

1️⃣ Tokenization stage (Tokenization)

Splitting the text into individual tokens (words, numbers, symbols)

2️⃣ Named Entity Recognition (NER)

Identifying people, companies, dates, monetary amounts, locations, etc.

3️⃣ Normalization (Normalization)

Format alignment - removing extra spaces, aligning dates to a single format

4️⃣ Linking (Linking)

Connecting information from different parts of the document to an existing database

Example: processing text from an invoice
# raw data from OCR raw_text = """ Tikva Ltd. ID: 123456789 Date: 15/04/2024 Amount: 1,250.50 ILS Tax rate: 17% Tax amount: 212.59 ILS Total due: 1,463.09 """ # step 1: Tokenization and NER import spacy nlp = spacy.load('he_core_news_sm') doc = nlp(raw_text) # step 2: entity extraction for ent in doc.ents: print(f"{ent.text}: {ent.label_}") # step 3: extracting specific fields import re date = re.search(rr'(\d{1,2}/\d{1,2}/\d{4})', raw_text).group(1) amount = re.search(rr'Amount:\s*([\d.,]+)', raw_text).group(1) # step 4: normalization amount = amount.replace(',', '').replace('.', ',') # to a standard format date_obj = datetime.strptime(date, "%d/%m/%Y") structured_data = { "company": "Tikva Ltd.", "date": date_obj.isoformat(), "amount": float(amount.replace(',', '.')), "currency": "ILS" }
Data sanitization - common problems and solutions

❌ Problem: duplicates

Example: the same order number appears twice in the table

✅ Solution: hashless comparison of fields, identifying repeating patterns

❌ Problem: inconsistent formats

Example: a date written as "15/4/24" or "2024-04-15" or "15 April"

✅ Solution: Regex patterns and date parsing libraries

❌ Problem: missing values

Example: a required field like price does not exist in a certain line

✅ Solution: Rule-based imputation, inference models or flagging the datum

🎯 Food for thought

Statistically, 80% of the time in AI Data projects is spent on cleaning and processing data. It is not sexy work, but it is critical!

4

Practical applications and automation

45 minutes

Lessons in this section:

  • play_circle

    Automating business processes

    How to integrate Document Intelligence into RPA and Workflow Automation

  • play_circle

    Integration with existing systems

    Connecting to ERP, CRM, document-management systems

  • play_circle

    Final project — a document-processing system

    Building a full invoice-processing pipeline in production

5

Capstone project — building a full document-processing Pipeline

90 minutes

Lessons in this section:

  • play_circle

    Planning the project architecture

    Defining requirements, planning components and choosing the right technologies for an end-to-end pipeline

  • play_circle

    Step-by-step implementation

    Coding and testing each layer — PDF input, OCR, data extraction, validation and saving to a database

  • play_circle

    Testing and release to production

    Writing unit tests, error handling, logs and Deployment to a Production environment

In-depth content

In the capstone project we bring together everything we learned into a full working system. We build a real Pipeline that receives a PDF file as input, passes it through OCR and data-extraction layers, performs validation and produces structured output to a database.

The Pipeline architecture: The system we build works on the principle of "one input, clean output" — each step in the chain is responsible for a single task, and passes clear data to the next step. This modular approach makes debugging and future upgrades easier.

The full Pipeline schema
# document_pipeline.py — a full document-processing Pipeline import fitz # PyMuPDF — opening PDF import pytesseract from PIL import Image, ImageEnhance import openai import json, re, logging from datetime import datetime import psycopg2 # connection to PostgreSQL logging.basicConfig(level=logging.INFO) logger = logging.getLogger("doc_pipeline") # ---- step 1: PDF input ---- # def pdf_to_images(pdf_path: str) -> list: """converts a PDF into a list of PIL images""" doc = fitz.open(pdf_path) images = [] for page in doc: pix = page.get_pixmap(dpi=300) img = Image.frombytes("RGB", [pix.width, pix.height], pix.samples) images.append(img) logger.info(f"Loaded {len(images)} pages from {pdf_path}") return images # ---- step 2: OCR ---- # def run_ocr(images: list) -> str: """runs OCR on a list of images and returns unified text""" full_text = [] for i, img in enumerate(images): enhancer = ImageEnhance.Contrast(img) img = enhancer.enhance(1.8) page_text = pytesseract.image_to_string(img, lang='heb+eng') full_text.append(page_text) logger.info(f"OCR completed for page {i+1}") return "\n\n".join(full_text) # ---- step 3: data extraction with AI ---- # def extract_fields(raw_text: str) -> dict: """sends text to GPT-4o and returns structured JSON""" client = openai.OpenAI() prompt = f"""Extract the following fields from the text below, in JSON format only: supplier_name, invoice_number, date (ISO 8601), total_amount (number), currency Text: {raw_text}""" response = client.chat.completions.create( model="gpt-4o", messages=[{"role": "user", "content": prompt}], response_format={"type": "json_object"} ) return json.loads(response.choices[0].message.content) # ---- step 4: validation ---- # def validate(data: dict) -> dict: """checks that all required fields exist and are valid""" required = ["supplier_name", "invoice_number", "date", "total_amount"] for field in required: if not data.get(field): raise ValueError(f"Missing field: {field}") data["total_amount"] = float(str(data["total_amount"]).replace(",", ".")) datetime.fromisoformat(data["date"]) # ensures a valid date format return data # ---- step 5: saving to the database ---- # def save_to_db(data: dict, conn) -> None: """saves the structured data to PostgreSQL""" with conn.cursor() as cur: cur.execute(""" INSERT INTO invoices (supplier_name, invoice_number, date, total_amount, currency) VALUES (%s, %s, %s, %s, %s) ON CONFLICT (invoice_number) DO NOTHING """, (data["supplier_name"], data["invoice_number"], data["date"], data["total_amount"], data.get("currency", "ILS"))) conn.commit() logger.info(f"Invoice {data['invoice_number']} saved successfully") # ---- running the Pipeline ---- # def run_pipeline(pdf_path: str, db_conn) -> dict: logger.info(f"Starting processing: {pdf_path}") images = pdf_to_images(pdf_path) raw_text = run_ocr(images) fields = extract_fields(raw_text) clean = validate(fields) save_to_db(clean, db_conn) logger.info("Pipeline finished successfully") return clean # direct execution if __name__ == "__main__": conn = psycopg2.connect("postgresql://user:pass@localhost/docs_db") result = run_pipeline("invoice_sample.pdf", conn) print(json.dumps(result, ensure_ascii=False, indent=2))

Recommended practices for Production

  • Logs at every stage — always log the input and output of every function. When something breaks in Production, logs are the difference between one hour and two of debugging.
  • Explicit error handling — wrap every external call (OCR API, OpenAI, DB) in try/except with clear error messages.
  • Idempotency — use ON CONFLICT DO NOTHING or a duplicate check before writing, so that running the Pipeline twice does not create duplicate records.
  • Unit tests — write a test for each function separately with sample PDF files. A whole Pipeline is hard to test; individual functions — easy.
  • Monitoring and costs — track the number of calls to GPT-4o and their cost. Consider caching results for identical PDFs by hash.
Testing and release to production

Before pushing the Pipeline to Production, it is important to verify three things: first, that the system handles corrupt or empty PDFs correctly without crashing. Second, that processing times meet the business requirements (usually under 30 seconds per page). Third, that the saved data matches the database schema and does not cause constraint errors.

After Deployment, set up automatic monitoring (Prometheus, Datadog, or simply email alerts) that alerts when the error rate rises above 5%, or when the daily API cost exceeds the budget you set.

emoji_events

Congratulations — you finished the course!

You completed all 5 modules of Document Intelligence. You now have the knowledge to build an end-to-end Pipeline that receives a PDF, extracts data with high accuracy, and produces structured output for any business system. The capstone project you wrote is the starting point for real Document Intelligence solutions in a Production environment.