The answer involves two distinct steps that most document tools quietly combine: optical character recognition (OCR), which turns pixels into text, and language model classification, which turns text into meaning. Understanding the difference matters if you want to know what the system can and cannot do — and why scan quality affects the results you get.
Step one: turning an image into text
A scanned document, at the start of processing, is just an image. Pixels. There is no text in it — not from the computer's perspective. A JPEG of an invoice is, structurally, no different from a JPEG of a mountain range.
OCR is the process of finding the text in that image. Traditional OCR systems worked by pattern-matching: recognising individual characters by comparing them against stored templates. They were effective on clean, typeset documents in standard fonts, and brittle on anything else — handwriting, poor scans, unusual typefaces, small print, two-column layouts, or documents with embedded tables.
Modern OCR uses neural networks instead. Rather than pattern-matching characters, these systems learn — from millions of training examples — what text looks like across the full range of conditions it appears in: varying lighting, angles, fonts, degraded paper, mixed scripts, handwritten annotations. The result is dramatically better performance on difficult documents that would have produced garbage output from traditional systems.
The output of OCR is a string of text — ideally, an accurate transcription of everything on the page. In practice, OCR output is imperfect. Common issues include: merged characters ("cl" read as "d"), incorrect line ordering on multi-column layouts, numbers confused with letters ("0" and "O", "1" and "l"), and content dropped from image regions the model could not confidently read.
Step two: turning text into meaning
Once there is text, the classification problem begins. The question "what kind of document is this?" is not a search problem — you cannot answer it by looking for a keyword. An invoice might not contain the word "invoice." A lease might not say "lease." Legal documents are named by their content and structure, not by their label.
Classification uses a language model: a system trained on large quantities of text that has learned, statistically, how different kinds of documents are written. Given the OCR output from a document, the language model assigns a category — invoice, contract, bank statement, government letter, medical document, and so on.
This works because different document types have different characteristic patterns. An invoice in any European language tends to contain: a reference number, a date, line items with amounts, a total, and either a VAT breakdown or an exemption statement. A lease agreement tends to contain: parties, property address, rental amount, duration, and termination conditions. These patterns are consistent enough across languages and formats that a well-trained language model can reliably detect them.
Confidence scores and what they mean
The language model does not just produce a category — it produces a probability distribution across all categories, and the category with the highest probability is reported as the result. The confidence score shown in PaperSweep's output is a simplified version of this: how certain the model is that the assigned category is correct.
A clearly formatted invoice from a German company, with VAT number and Rechnungsnummer visible in the OCR output, might score 0.97. A single-page letter from a municipal authority with unusual formatting might score 0.62. These scores appear alongside the categorisation in the results table so you can prioritise which documents to review manually.
As a practical rule: scores above 0.85 are generally reliable; scores below 0.6 warrant a check. In a well-scanned batch, most documents score above 0.85. The low-confidence documents are usually either unusual in format, short in content, or degraded in scan quality.
What this means for real documents
The two-step pipeline has a practical implication: the quality of classification depends on the quality of OCR. If the text extraction step produces garbled output, the classification step works with garbled input — and is more likely to be wrong. The confidence score will usually reflect this, dropping for documents where the OCR output is poor.
This is why scan quality matters. A document photographed under good lighting, held flat against a surface, produces better OCR output than one photographed at an angle in dim light. Contrast matters too: a faded photocopy produces worse results than the original document. Higher-quality input produces higher-quality output throughout the pipeline.
Handwritten documents are harder for a structural reason: handwriting varies between individuals in ways that printed text does not. Modern OCR handles common handwriting styles well, but unusual or cramped handwriting will produce more OCR errors — which translate into lower classification confidence. This is expected and visible in the scores.
What the system cannot do
Language model classification is probabilistic. It produces the most likely category given the text — which is correct the vast majority of the time, but not always. Documents with very short content, unusual formats, or highly domain-specific terminology may be miscategorised or produce low-confidence results.
The system also works on text, not on meaning in the human sense. It cannot verify that a contract is legally valid, determine whether an invoice has been paid, assess whether a document is important to you specifically, or identify errors in the document content. These remain human judgements.
What it can do is handle the first pass — reliably, quickly, at scale — so that those human judgements apply to the right documents. Sorting 200 pages by hand takes hours. Reviewing the 12 documents that scored below 0.7 takes minutes. That is the trade the system is designed to offer.
Why multilingual documents work
One question we get regularly: does PaperSweep handle documents in multiple languages in the same upload?
Yes, because the classification operates on content patterns, not on language-specific keyword matching. An invoice is an invoice whether it is written in German, Spanish, French, or Italian — the structural patterns that identify it (reference number, line items, totals, VAT) are present across all of them. The language model is trained on documents in multiple languages and recognises these patterns regardless of the language they appear in.
This means a mixed German-Spanish upload — the kind generated by a cross-border business — is categorised by document content, not by which country the document comes from. The categories in the output are consistent across all documents in the batch, making cross-language comparison straightforward.