🇫🇷 French Postal Addresses Normalizer (Golang port of etalab/normadresse), following the AFNOR NF Z10-011 specifications.
Install with go get github.com/united-drivers/go-normadresse
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 TASSIGNYMore usage on GoDoc, or in the test file.
This library applies rules (sorted with a priority), from the normadresse.csv file, and returns the result as soon as the modified string fits below a max length
Example:
The original version written in Python uses more efficient rule priorities (than ours), 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 TASSIGNYRUE DES FRERES MARC ET JEAN MARIE GAMON->RUE DES FRERES M ET J M GAMONAVENUE GEORGES ET CLAUDE CAUSTIER->AV GEORGES ET CLAUDE CAUSTIERAVENUE DE LA DIVISION DU GENERAL LECLERC->AV DE LA DIVISION DU GAL LECLERCRUE EMMANUEL D ASTIER DE LA VIGERIE->RUE E D ASTIER DE LA VIGERIE- ...