Mailwoman turns free-text postal addresses into structured components (house number,
street, locality, region, postcode, country) and resolves them to coordinates against an
open gazetteer. It is a small transformer encoder (~30M params) that performs BIO token
classification over a 33-label schema. It **isn't** an LLM, and no part of it is
generative. It performs conventional entity recognition. That method suits short, structured strings.
It runs in Node.js and the browser, without Elasticsearch or a multi-gigabyte libpostal
install. The model is about 30 MB. It resolves coordinates from a SQLite gazetteer at the finest
tier available: admin, postcode, street, or rooftop (US and French national registers).
```sh
npx mailwoman parse "1600 Amphitheatre Parkway, Mountain View, CA 94043"
```
## Installation
```sh npm2yarn
npm install mailwoman
```
That installs the CLI, the neural runtime, and the US-English model weights. For French
addresses, add `@mailwoman/neural-weights-fr-fr`. For coordinate resolution, add
`@mailwoman/resolver-wof-sqlite`.
> [!IMPORTANT]
> Requires Node.js ≥ 24.18.0.
## CLI
```sh
# Parse an address into components
mailwoman parse "350 5th Ave, New York, NY 10118"
# Other output formats
mailwoman parse "350 5th Ave, New York, NY 10118" --format tuple # or: xml, outline
# Resolve components to a Who's On First place + coordinate (needs a gazetteer DB)
mailwoman parse "350 5th Ave, New York, NY 10118" --resolve --resolve-db ./wof.sqlite
# Geocode (admin/postcode coordinate)
mailwoman geocode "1600 Amphitheatre Pkwy, Mountain View, CA 94043"
```
## Library
```ts
import { createParser, decodeAsJSON } from "mailwoman"
await using parser = await createParser()
const { tree } = await parser.parse("1600 Amphitheatre Parkway, Mountain View, CA 94043")
console.log(decodeAsJSON(tree))
// { region: "CA", locality: "Mountain View", street: "Amphitheatre",
// house_number: "1600", street_suffix: "Parkway", postcode: "94043" }
```
The [`mailwoman` package README](./packages/mailwoman/README.md) describes the package's
library and CLI usage. The [first parse](https://mailwoman.post/docs/start) shows an executed
parser call, and the [library reference](https://mailwoman.post/docs/reference/library) lists
the published interfaces.
## Drop-in servers
If you already run a geocoding stack, three HTTP servers speak the wire formats your clients
use today. They need neither PostgreSQL, Elasticsearch, nor an `osm2pgsql` import:
| Package | Speaks | Start it |
| ---------------------------------------------- | ----------------------------------------------------- | -------------------------------- |
| [`@mailwoman/nominatim`](./packages/nominatim) | Nominatim — `/search`, `/reverse`, `/status` | `npx @mailwoman/nominatim serve` |
| [`@mailwoman/photon`](./packages/photon) | Photon autocomplete — `/api`, `/reverse` (GeoJSON) | `npx @mailwoman/photon serve` |
| [`@mailwoman/libpostal`](./packages/libpostal) | libpostal — `/parse`, `/expand` (no gazetteer needed) | `npx @mailwoman/libpostal serve` |
Point geopy's `Nominatim(domain="localhost:8080")` at the first one, and forward and reverse
geocoding keep working. The API returns an OpenCage-style `annotations` block with the
IANA timezone, UN/LOCODE, EU NUTS codes, coordinate formats, sun times, and currency.
[`@mailwoman/annotations`](./annotations) composes that block.
## How it compares
This table compares what each system needs to run. It doesn't compare accuracy. Mailwoman
began as a fork of Pelias Parser and ships wire-compatible drop-ins for the other three.
| | Mailwoman | libpostal | Nominatim | Photon |
| ----------------------------- | ------------------------------- | ------------------ | -------------------------- | ------------------------------ |
| Footprint | ~30 MB model + SQLite gazetteer | multi-GB data blob | PostgreSQL + planet import | Elasticsearch/OpenSearch index |
| Runs in the browser | Yes (WebGPU / WASM) | No | No | No |
| Parse → labeled components | Yes, with calibrated confidence | Yes | — | — |
| Forward + reverse geocoding | Yes (Who's On First gazetteer) | No (parse only) | Yes | Yes |
| Autocomplete / type-ahead | Yes (Photon-compatible API) | No | No | Yes |
| Annotations (tz, currency, …) | Yes, OpenCage-style block | No | No | No |
## Drop-in servers
If you're migrating off Nominatim, Photon, or libpostal, each has a compatible server. The
server keeps the same wire interface and reads a SQLite file instead of a cluster. A hosted
Photon-compatible endpoint is live for evaluation:
```sh
curl "https://photon.mailwoman.post/api?q=berlin&limit=3" # hosted — nothing to install
npx @mailwoman/photon serve # Photon-compatible /api, /reverse
npx @mailwoman/nominatim serve # Nominatim-compatible /search, /reverse, /status
npx @mailwoman/libpostal serve # libpostal-compatible /parse, /expand
```
OpenAPI 3.1 specifications for all three ship in each package and at
[mailwoman.post/openapi](https://mailwoman.post/openapi/photon.yaml).
## How it works
The work splits into two parts:
- **The model learns the grammar.** A sequence labeler trained from scratch on a diverse
corpus of real and synthetic addresses decides which span is a street, a locality, or a
postcode.
- **The gazetteer supplies place knowledge.** A provenance-tracked Who's On First database
resolves parsed components to real-world places and coordinates.
Gazetteer knowledge reaches the model at inference as _soft input features_ (anchors). The
features inform the model's decision and never override it. If you know RAG from the LLM
world, this is RAG for token classification. The confidence numbers the parser returns are
calibrated probabilities. When it reports `0.88`, it is right about 88%
of the time.
For the longer version, read [What Mailwoman
Is](https://mailwoman.post/product).
## Locale coverage
A locale appears here only when a coordinate-graded eval backs it.
| Tier | Locales | What backs the claim |
| ------------------------------------ | ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------ |
| **1 — first-class, floor-enforced** | US, FR | Per-tag eval floors block every release. FR coordinate panel (n=3000): 100% resolve, resolved-p90 6.6 km |
| **2 — trained + coordinate-paneled** | IT, PT, PL, AT, CZ, DE, AU, BE, ES, NL, CH, HR, DK, FI | Per-locale coordinate panels (n=1000 each), resolved-p90 ≤ 10 km across the set, and NL resolved-p50 0.05 km |
| **3 — trained, thinly measured** | NO, SE | Coordinate panels exist, but residual misses are not yet fully characterized. Claims beyond this: unverified |
The [browser demo](https://mailwoman.post/demo) covers the same locales. Full
receipts live in the [scope declaration](./docs/engineering/SCOPE.mdx) and the [eval
reports](./docs/records/evals/).
## Points of interest, for agents
Not every query is an address. "coffee near Honolulu" is a category search. Mailwoman
distinguishes it from an address, splits the category from the location constraint, and
resolves it against `poi.db`, a sealed spatial layer built from Overture Places (US, Canada,
Mexico, France). Categories without a permissively licensed source, such as fire hydrants and
post boxes, abstain intentionally instead of returning an empty result that looks like an
answer. You can build that layer yourself from your own OSM extract.
`@mailwoman/mcp` exposes the whole toolset through an MCP server over stdio for any
MCP-compatible agent: parse, geocode, POI search, and an OverpassQL export. Both features ship
on npm as of `mailwoman` 7.2.1.
```sh
mailwoman poi "gas station near Springfield, IL" --db poi.db
```
## Beyond parse + geocode
`mailwoman` is the entry point to 33 published packages. The rest of the toolkit includes:
| Package | What it does |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| [`@mailwoman/match`](./match) | Geocode-first record matcher: block → score → cluster (Fellegi-Sunter) |
| [`@mailwoman/entity-resolution`](./entity-resolution) | Resolve messy address records to geocoded entities, export GeoJSON |
| [`@mailwoman/address-id`](./address-id) | Stable address primary key (`..`) for joins + dedup |
| [`@mailwoman/annotations`](./annotations) | The OpenCage-style annotation composer behind the drop-in servers |
| [`@mailwoman/timezone-lookup`](./timezone-lookup) | Coordinate → IANA timezone (point-in-polygon, `node:sqlite`) |
| [`@mailwoman/un-locode-lookup`](./un-locode-lookup) | Place → UN/LOCODE trade-location codes |
| [`@mailwoman/nuts-lookup`](./nuts-lookup) | EU coordinate → NUTS statistical regions |
| [`@mailwoman/codex`](./codex) | Postal address formatter (components → a per-country string) + the reference data behind it |
| [`@mailwoman/mcp`](./mcp) | MCP server exposing parse/geocode/POI-search/OverpassQL-export to agents over stdio |
| [`@mailwoman/poi-taxonomy`](./poi-taxonomy) | Category lexicon behind POI-query detection: Overture taxonomy snapshot + synonym table |
## License
Mailwoman is dual-licensed:
- **[AGPL-3.0-only](https://www.gnu.org/licenses/AGPL-3.0.html)** for open-source use. You
may use, modify, and redistribute the software, but you must share your modifications and,
for network services, your source.
- **A commercial license** for closed-source/commercial use without the AGPL's source-sharing
obligation. Contact `hello@sister.software`.
Release notes live on the [GitHub releases page](https://github.com/sister-software/mailwoman/releases).
The [privacy policy](https://mailwoman.post/privacy)
states what we do and do not collect. Funders and sponsors can read our machine-readable
[funding.json](https://mailwoman.post/funding.json).
Report security vulnerabilities privately per [`SECURITY.md`](./SECURITY.md).
Portions of Mailwoman derived from [Pelias Parser](https://github.com/pelias/parser) remain
under the MIT license, and Mailwoman bundles third-party data under its own terms. See
[`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md) for the full attribution list.
---
## Mailwoman development
> [!NOTE]
> **This section is for working _on_ Mailwoman in this repository.** If you only want to
> _use_ Mailwoman, the published packages above are all you need. You do not need to clone
> the repo, build anything, or read further.
Mailwoman is a Yarn 4 monorepo: one root package (`mailwoman`) plus the scoped
`@mailwoman/*` workspaces that compose it. Start with [`AGENTS.md`](./AGENTS.md) for the
orientation map (workspaces, where to read next, the release pipeline) and
[`docs/records/plan/`](./docs/records/plan/) for the design record.
```sh
git clone https://github.com/sister-software/mailwoman.git
cd mailwoman
yarn install
yarn compile # tsc -b across all workspaces
yarn test # vitest (runs from source, no precompile)
```
### The legacy rule engine
Mailwoman began as a TypeScript fork of [Pelias Parser](https://github.com/pelias/parser), a
rule-based engine: a tokenizer, a set of dictionary/pattern classifiers, and an
`ExclusiveCartesianSolver` that enumerated consistent solutions. As the neural sequence
labeler matured into the primary parse path, the rule engine was retired, and v7.0.0 deleted it
from the tree (`@mailwoman/classifiers` and the `@mailwoman/core/{solver,classification}`
implementation). The last standalone release is the frozen `@mailwoman/classifiers@6.x`.
Consumers of the published package use only the neural pipeline.
### Contributions
Fork and open a pull request against `main` on a feature branch. Please include unit tests.
The model-work runbook (which evals a change must pass, how to add a training-data subset) is
[`docs/engineering/CONTRIBUTING_MODEL_WORK.mdx`](./docs/engineering/CONTRIBUTING_MODEL_WORK.mdx).
## Acknowledgements
This project stands on the work of the Pelias community, OpenStreetMap, Who's On First,
OpenAddresses, and the wider open-geo ecosystem. See
[`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md).