Messy delivery addresses: rules first, AI second, a person for the rest

By Hanan Abid, CEO · Published 25 November 2026

To automate address cleaning safely, strip the noise out of the input, parse what you can with rules, check every result against the official postcode reference, and use a language model only for the street-level details the rules cannot settle. Give each address a confidence score. Process the confident ones automatically and send the rest to a person, never to dispatch on a guess.

Delivery forms have neat, separate address fields. Customers ignore them. They put their phone number in line two, the building name in the town field, a note for the driver after the street, and a typo in the postcode. Somebody downstream has to fix it before the parcel can be routed, and in a growing operation that somebody becomes a full-time job.

That was the situation at YourDelivery, an Irish parcel delivery platform. Their system reconstructed roughly 5 or 6 addresses correctly out of every 100, so manual checking was mandatory and took about one full-time role. The pipeline we built took accuracy to over 80 percent, at about 1,000 addresses a day in production.

Below is the approach, written so an operations or data team can build their own version. It includes a confidence routing table and a constrained prompt you can adapt.

Why rules alone fail, and why AI alone is worse

Rules break on messy input. A parser that expects “number, street, town, county” falls over the first time someone writes “c/o Mary, apt 4 over the chemist”. You can keep adding rules, but real customer input is inventive and you never catch up.

Sending everything to a language model looks like the fix, and it fails in a more dangerous way. Models are good at producing an address that looks right. Given input that does not contain enough information, they will still produce one, confidently, and a wrong address that looks clean is harder to catch than a messy one. On data that decides where a van goes, that is the worst failure you can have.

The working answer is both, in a fixed order, with an official reference as the judge and a person for anything still uncertain.

Stage one, clean: pull the address out of the noise

Before parsing anything, pull the address out of the noise. Remove phone numbers, email addresses and names that landed in address fields. Strip driver notes (“leave with neighbour”, “ring twice”) into their own field, because they matter to the driver and confuse the parser. Normalise case, spacing, punctuation and common abbreviations. Join all the address fields into one string as well as keeping them separate, since customers so often put the right text in the wrong box.

Stage two, parse: let rules take what they can

Run a deterministic parser next. It should find the parts it can find reliably (the postcode pattern, house numbers, known town and county names, unit or apartment markers) and leave everything else marked as unresolved. Rules give the same answer every time, which makes them easy to test and easy to trust.

Stage three, anchor: the postcode reference is the judge

Use your country’s postcode or address reference as ground truth. In Ireland we used Eircode, the national postcode system, which identifies individual addresses. At YourDelivery it was barely being used to check addresses, which is a common gap.

Look up the postcode the customer gave, fix obvious typos (a transposed character, a letter O typed as zero), and compare what the reference says lives there with what the customer wrote. Agreement raises confidence. Disagreement is information too: it often means the customer typed an old or neighbouring postcode.

Stage four, resolve: a language model for the leftovers only

Only now, and only for what the rules and the reference could not settle, ask a language model. Keep its job narrow. It should choose between candidates or fill one named gap, and it must be allowed to say it does not know.

Prompt: resolve one unclear address

Raw customer input: [the original text, all fields] Cleaned text: [output of step 1] Parsed so far: [fields found by rules] Reference candidates for this postcode or area: [list from the address reference] Task: decide which candidate the customer meant, or extract the street and house number if they are present in the input. Rules: - Only use information in the input and the candidate list. - Never invent a street, number or town. - If more than one candidate fits, or none does, answer "unresolved". Return JSON: {"choice": candidate id or null, "street": "", "number": "", "unresolved": true/false, "reason": "one sentence"}

Run the model as its own stage, after the rules, so you can switch it off, swap it, or measure it without touching the rest of the pipeline.

Stage five, route: confidence decides who handles it

Each address now has evidence from three places: what the rules found, what the reference says, and what the model chose. Turn that into a confidence level and route on it. A simple three-level version:

ConfidenceExample conditionsRoute
HighPostcode valid, street and number found in the reference, rules and model agreeProcess automatically
MediumPostcode valid, but the street or number needed the model, or two candidates remainProcess, and sample a share for review each day
LowNo valid postcode, or the model and the rules disagree, or nothing matchedSend to a person with the reason; never dispatch on a guess

Set the thresholds from your own labelled sample, not from instinct, and move them as accuracy improves.

Stage six, fall back: a tidy record, never a guess

Low-confidence addresses still need to go somewhere useful. Return the cleaned text, the verified postcode if there is one, and a flag with the reason it was not resolved. The person reviewing it then starts from a tidy record with the problem named, rather than from the customer’s original mess. That alone cuts review time, even before accuracy improves.

Keeping score: accuracy on every batch

Build a labelled sample before you write any code: a few hundred real addresses, corrected by hand. It tells you what accuracy is realistic and becomes the test every change has to pass. For each batch in production, record:

  • the share processed automatically
  • the share sent to review, and the most common reasons
  • accuracy on a daily random sample of the automatic ones, checked by a person
  • deliveries that failed because of the address, fed back as new labelled examples

At YourDelivery accuracy is tracked as a product metric on every batch, and it kept improving with tuning after launch.

How to start

Take one week of real addresses, label a few hundred by hand, and measure how many your current process gets exactly right. That number, and the list of the ways addresses go wrong, tells you how much of the work rules can do and where a model is needed. At YourDelivery, the model’s job stayed limited to street-level ambiguity; cleaning, rules and Eircode carried the rest.

We build this kind of operational data work with FTBI, an Irish logistics group, on real delivery volumes; the wider approach, including delivery documents and proofs of delivery, is on our logistics operational intelligence page.

Frequently asked questions

Why not just send every address to a large language model?

Because a language model will produce a tidy, plausible address even when the input does not support one. On data that decides where a parcel goes, a confident wrong answer costs more than a flagged unclear one. Use rules and an official reference for everything they can settle, and the model only for what is left.

What do we use as ground truth outside Ireland?

Whatever official postcode or address reference your country has. In Ireland that is Eircode, which identifies individual addresses. Where postcodes cover a whole street or area, the reference narrows the options and the street and number have to do more of the work.

How do we know if accuracy is improving?

Keep a labelled sample: a few hundred real addresses that a person has corrected by hand. Run every new version of the pipeline against it and record the share it gets exactly right, and the share it sends to review. Track both on every batch.

Do we need to replace our transport or warehouse system?

No. An address service like this sits beside the systems you run and feeds them cleaned addresses through an API or a daily file.

© 2026 CVision · Islamabad · Wyoming Privacy · Terms · Code of ethics