Skip to main content

ng-address-resolver

Resolve free-text Nigerian addresses, such as "back of Fabian Hotel, off NTA Road, Ado Ekiti", to NIPOST digital postcodes (NDAPS). It answers only as precisely as the evidence allows, and asks a question when it cannot.

Status: pre-release. The typed-postcode, location-pin and geocoded paths have run against the live NIPOST API and a live geocoder. The Claude reading step is tested only against a mocked API, and accuracy on real addresses is unmeasured.

How it decides

  1. A postcode written in the text is extracted (never auto-corrected) and confirmed with NIPOST.
  2. A location pin is reverse-geocoded by NIPOST. This is the only route to a high-confidence building code.
  3. Text only is read by Claude into street, landmarks and their relation ("behind", "opposite", "at"), area, LGA and state, then placed with a geocoder and reverse-geocoded by NIPOST.
Evidence Answer
Typed postcode NIPOST confirms, or a pin within 10 m of a building Building code, high confidence
A pin within 25 m, or the landmark the address is Building code, medium confidence
A building near a landmark ("behind", "opposite") Area code, e.g. EK-01-A03-FK
A street only District code, low confidence
A town only, or nothing found No code, plus a question for the user

Text alone rarely identifies a building: a landmark's own building is not the one behind it, and a road's map point is not any house on it. Ask users for a location pin when you need the exact building.

Usage

ng-address "back of Fabian Hotel, off NTA Road, Ado Ekiti"
ng-address "my house" --lat 7.6211 --lng 5.2214

The result is JSON: status (resolved, partial, unresolved), code, level, confidence, method, question and the evidence behind it.

from ng_address import Resolver

result = await Resolver(nipost=..., parser=..., geocoder=...).resolve("...")

The core needs no model. Install ng-address-resolver[claude] to let the CLI and ng_address.parse.ClaudeParser read addresses with Claude. A caller that has already read the address, such as the host model of an MCP server, passes its own ParsedAddress as resolve(..., parsed=...) instead.

Configuration

Variable Purpose
Anthropic credentials Needs the claude extra. Read by the Anthropic SDK (ANTHROPIC_API_KEY or an ant auth login profile). Without them the raw text is searched instead.
NG_POSTCODE_API_KEY NIPOST API key. Without it the only postcode returned is one written in the address as a code, unconfirmed and at medium confidence.
NG_GEOCODER_URL A Nominatim server, ideally your own.
NG_GEOCODER_CONTACT A URL or email sent in the User-Agent to identify you. Required for the public Nominatim.
NG_ADDRESS_MODEL Claude model. Defaults to claude-opus-5-5.

The public Nominatim at https://nominatim.openstreetmap.org allows light personal use only. A service whose main job is geocoding must run its own instance or use a commercial geocoder. Map data © OpenStreetMap contributors.

Each address uses at most one Claude call at low effort, up to three geocoder searches, and one or two NIPOST calls.

License

MIT

Metadata

Release files for ng-address-resolver 0.1.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ng-address-resolver 0.1.7
File Size Uploaded
ng_address_resolver-0.1.7.tar.gz 19.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ng-address-resolver 0.1.7
File Interpreter ABI Platform
ng_address_resolver-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 36.0 kB

Release files / ng_address_resolver-0.1.7.tar.gz

Download URL ng_address_resolver-0.1.7.tar.gz
Size 19.8 kB
Tags Source
SHA-256 checksum
How to use checksums
64ec7e55cc2677a4232033184df70f49a5c11e97b48c51ca422b2f5482574c38
BLAKE2b-256 checksum
How to use checksums
1aa9992ef0145956aad087c864b33f598d7900acc839483ce2206ac8055c9bf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release files / ng_address_resolver-0.1.7-py3-none-any.whl

Download URL ng_address_resolver-0.1.7-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5706ae87239c135380caa21948e7aae7dfabffbb6ad117db83709c0af42b7ff6
BLAKE2b-256 checksum
How to use checksums
c2413b30bce57b269ebf6f70c1cd8442937f2e4978a93353831068858cd22cdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 10, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.9

2 release files

0.1.8

2 release files

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page