https://github.com/united-drivers/go-normadresse
:fr: French Postal Addresses Normalizer (Golang port of etalab/normadresse)
https://github.com/united-drivers/go-normadresse
etalab golang-port normalizer postal shorter
Last synced: 4 months ago
JSON representation
:fr: French Postal Addresses Normalizer (Golang port of etalab/normadresse)
- Host: GitHub
- URL: https://github.com/united-drivers/go-normadresse
- Owner: united-drivers
- License: apache-2.0
- Created: 2018-01-30T09:46:05.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-03T08:51:06.000Z (over 8 years ago)
- Last Synced: 2025-12-17T12:15:28.210Z (6 months ago)
- Topics: etalab, golang-port, normalizer, postal, shorter
- Language: Go
- Homepage: https://www.wulo.fr/
- Size: 48.8 KB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-normadresse
[](https://circleci.com/gh/united-drivers/go-normadresse)
[](https://godoc.org/github.com/united-drivers/go-normadresse)
[](https://goreportcard.com/report/github.com/united-drivers/go-normadresse)
[](https://github.com/united-drivers/go-normadresse/blob/master/LICENSE)
[](https://github.com/united-drivers/go-normadresse/releases)
:fr: French Postal Addresses Normalizer (Golang port of [etalab/normadresse](https://github.com/etalab/normadresse)), following the `AFNOR NF Z10-011` specifications.
## Usage
Install with `go get github.com/united-drivers/go-normadresse`
```go
import "github.com/united-drivers/go-normadresse"
fmt.Println(strings.ToUpper(normadresse.Normalize("BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY")))
// Output: BD MAL J M DE LATTRE DE TASSIGNY
```
More usage on [GoDoc](https://godoc.org/github.com/united-drivers/go-normadresse), or in the [test file](https://github.com/united-drivers/go-normadresse/blob/master/normadresse_test.go).
## Under the hood
This library applies rules (sorted with a priority), from the [normadresse.csv](https://github.com/etalab/normadresse/blob/master/normadresse.csv) file, and returns the result as soon as the modified string fits below a max length
Example:

### Disclaimer
The original version written in Python uses [more efficient rule priorities](https://github.com/etalab/normadresse/blob/master/normadresse.py) (than [ours](https://github.com/united-drivers/go-normadresse/blob/master/normadresse.go)), which often results in better outputs
Example:
* Input: `SQUARE DES SOEURS DE SAINT VINCENT DE PAUL`
* Python: `SQ SOEURS DE ST VINCENT DE PAUL` (easy to read)
* Golang: `SQ DES SOEURS DE SAINT V DE P` (correct, but harder to read)
But it gives the exactly same result for others:
* `BOULEVARD DU MARECHAL JEAN MARIE DE LATTRE DE TASSIGNY` -> `BD MAL J M DE LATTRE DE TASSIGNY`
* `RUE DES FRERES MARC ET JEAN MARIE GAMON` -> `RUE DES FRERES M ET J M GAMON`
* `AVENUE GEORGES ET CLAUDE CAUSTIER` -> `AV GEORGES ET CLAUDE CAUSTIER`
* `AVENUE DE LA DIVISION DU GENERAL LECLERC` -> `AV DE LA DIVISION DU GAL LECLERC`
* `RUE EMMANUEL D ASTIER DE LA VIGERIE` -> `RUE E D ASTIER DE LA VIGERIE`
* ...
## License
[Apache 2.0](https://github.com/united-drivers/go-normadresse/blob/master/LICENSE)