Skip to content

Document classification and splitting

Scanned bundles arrive as one long file. Document classification reads every page, finds where each document starts and ends, labels it from your catalog and sends it where it belongs, with uncertain items held for review.

At a glance

Identify document types in mixed batches, split combined files into individual documents and route each one by type against your catalog.

Document intake
  • PDF
  • Folder watcher
  • REST API
  • OCR engine
Classification engine
  • Python
  • Regex anchors and keyword rules
  • Boundary detection
  • YAML catalogs
Language model tier
  • Provider-agnostic client
  • Hosted or local models
  • Optional vision mode

The challenge

Documents rarely arrive one at a time. A single scan can hold an ID card, a contract, three statements and a cover letter, merged in no particular order. Teams then sort pages by hand, name files by guesswork and discover mistakes only when a downstream process fails or an audit asks for the right record.

The problem grows with the catalog. Enterprises handle hundreds or thousands of document types, and every customer or business unit names and groups them differently. A rigid classifier breaks when a new type appears, and a black box that cannot explain its label is hard to trust, tune or defend.

What it does

  • Mixed-batch classification

    Reads each page of a mixed batch and assigns a document type from your catalog, using text extracted from the page, with a confidence score and the evidence behind the label.

  • Combined-file splitting

    Detects where one document ends and the next begins, then splits a merged file into individual documents with page ranges, including repeated types such as monthly statements kept apart.

  • Catalog-driven routing

    Routes each document by its type against a catalog you control, with per-customer subsets, so the same engine serves different business units without mixing their document lists.

  • Rules first, model second

    Fast rule matching on distinctive phrases and patterns handles most pages. A language model of your choice verifies only the uncertain ones, which keeps cost and latency down.

  • Human review queue

    Low-confidence or model-verified documents are flagged and copied to a review queue, so people check only what needs a second look instead of every file.

  • Onboarding and tracing

    A guided onboarding flow maps a customer's document types and rules, and a trace viewer shows each page's label, the rules that fired and why, so tuning is evidence-based.

How it works

  1. Ingest the batch

    A multi-page PDF arrives by upload, API call or watched folder. Text is read directly where present and extracted by the OCR engine for scanned pages.

  2. Classify each page

    Rules score every page against the catalog using anchor patterns and keywords, producing a type, a confidence and the evidence that fired. Distinctive phrases weigh more than generic ones.

  3. Find boundaries

    Page results are grouped into documents using expected document sizes and boundary signals. Uncertain segments go to the model for verification, and overlaps or gaps are resolved before splitting.

  4. Split and route

    Each document is written as its own file with a metadata record holding type, page range and confidence. Items needing attention go to review; failures keep an error log.

Under the hood

Technology
Document intake
  • PDF
  • Folder watcher
  • REST API
  • OCR engine
Classification engine
  • Python
  • Regex anchors and keyword rules
  • Boundary detection
  • YAML catalogs
Language model tier
  • Provider-agnostic client
  • Hosted or local models
  • Optional vision mode
Platform and apps
  • FastAPI
  • PostgreSQL
  • React onboarding app
  • Docker

Business outcome

  • Sorted batches without manual triage. Mixed bundles become labelled, separate documents automatically, so staff stop paging through scans and naming files by hand before work can start.

  • Right document reaches the right process. Routing by catalog type sends each document to the queue, system or team that expects it, which reduces misfiled records and rework downstream.

  • People review exceptions, not everything. Confidence scores and a review queue focus human attention only on the uncertain documents, while confident results flow through untouched.

  • Explainable labels you can tune. Every label carries its evidence, so teams can see why a page was classified, adjust rules for their own document types and trust changes they can inspect.

Where it is used

  • Employee onboarding bundles: one scanned file of identity proofs, certificates, letters and forms split and filed by type.
  • Lending files: application packs separated into identity, income, property and agreement documents for each downstream check.
  • Insurance and claims intake: combined submissions broken into forms, invoices, reports and correspondence before adjudication.
  • Back-office mailrooms: scanned post and email attachments sorted by type and sent to the right team queue.

Frequently asked questions

Can it handle files where several documents are merged together?

Yes. It classifies each page, then groups pages into documents using boundary signals and expected document sizes. Repeated types, such as separate monthly statements, are split apart, and each document is saved with its page range.

Do we need a language model?

No. The pipeline runs rules-only without one, and low-confidence pages are flagged for review. If you add a model for verification, it is your choice of hosted or local provider, and it sees only uncertain segments.

Can we add our own document types?

Yes. Types are defined in a catalog with a label, description and keywords, and can be added globally or kept local to one customer. Anchor patterns and expected sizes can then be tuned in the onboarding and rules tools.

What happens to documents it is unsure about?

They are flagged for review with their metadata and copied to a review folder. Unreadable or protected files are moved aside with an error log rather than guessed at, so nothing is mislabelled silently.

See it on your own documents and data

Tell us what you want to automate and we will show you how it runs inside the harness.