es-normalizer-py
Contact data normalization adapted from the Empreinte Sociométrique's normalizers (in Python)
This is the Python port of es-normalizer, the TypeScript normalization library for contact data (address, phones, etc.) adapted from Edgewhere's Empreinte Sociométrique patented normalizers.
Motivation
When it comes to hashing data, the necessary uniqueness of the source sometimes makes it hard to compare two hashed data, mostly if dealing with postal address. This library helps normalizing any contact data (the postal or e-mail address, the mobile or landline phone number, the title, names or date of birth of an individual) that would feed any hashing algorithm to make hash comparison always trustable. It's based on the work for the Empreinte Sociométrique™ patented by Cyril Dever for Edgewhere.
TypeScript version
The TypeScript library lives at cyrildever/es-normalizer and is published on npm as es-normalizer.
Version 0.2.4 of this port matches its version 2.4.0: both give the same outputs for the same inputs, the test suite of es-normalizer is ported here case by case, and their dictionaries are the same.
An address dictionary key may hold several words (eg. CENTRE COMMERCIAL), translated together before the single words, the longest first.
Usage
pip install es-normalizer-py
IMPORTANT: as of this version, most normalizers are for use on French data.
To get a normalized string, pass the data and a normalizer function to normalize(): it returns the normalized string, or None when nothing usable is left.
There are currently eleven specific normalizer functions and a generic one:
Any: the generic normalizer should be used if no specific normalizer exists;AddressLine: pass any address line through it to get a normalized address, eg.8, rue Hennerbecomes8 RUE HENNER, and eventuallyTrueas parameter when trying to normalize a French address line 1 to also transform the title, eg.Monsieur Cyril Devershould then become1 CYRIL DEVERwhen passedTrueinstead ofMONSIEUR CYRIL DEVERfor the default behaviour;AddressLine6: the French address line 6 with the department inserted in between the zip code and the city as in the Empreinte Sociométrique implementation (eg.75009 75 PARIS);City: for normalizing city names (it removes any Cedex mention in French address, for instance);CodePostalFrance: for French zip code;DateOfBirth: pass a date and up to two parameters: the input format (eg.YYYY-MM-DD) and the output format wished (eg.ISO_DATE), the default values being respectively the ISO format and the French date format;DepartementFrance: extract the French departement number (out of a code postal, for instance);Email: validates the passed e-mail and returns it in lower-case;FirstName: pass a first name and get a normalized one (it uses an enlarged French dictionay of first names to process it making it possible to pass from"J.-Louis"to"JEAN LOUIS");Mobile: to validate a French mobile phone;PhoneNumber: to normalize a French phone or fax number in the international format, eg.+33 (0) 123 456 789;StreetNumber: parses the passed field to normalize it the Empreinte Sociométrique™'s way, eg.1bisor1 bisbecomes1B;Title: returns a code depending on the passed string (1 for gentlemen, 2 for ladies, 0 when undefined or unknown).
from es_normalizer import *
print(normalize('#This is any String(). ', Any))
# THIS IS ANY STRING
print(normalize('Monsieur Cyril Dever', AddressLine(True)))
# 1 CYRIL DEVER
print(normalize('24, rué de Maubeuge', AddressLine()))
# 24 RUE MAUBEUGE
print(normalize('75009 .# Paris', AddressLine6()))
# 75009 75 PARIS
print(normalize('75009 .# Paris', AddressLine6(False)))
# 75009 PARIS
print(normalize('Paris Cedex 09', City))
# PARIS
print(normalize('70/12/01', DateOfBirth('YY/MM/DD', FRENCH_DATE)))
# 01/12/1970
print(normalize(' 75009 ', DepartementFrance))
# 75
print(normalize(' Contact@GMAIL.com', Email))
# contact@gmail.com
DateOfBirth reads dates the way the forgiving parser of moment.js does, which es-normalizer relies on. Both give the same date for an input that fits its format; for an input that does not, eg. a numeric date read with a month name format (DD MMM YYYY), the guess of each may differ.
Tests
$ git clone https://github.com/cyrildever/es-normalizer-py.git
$ cd es-normalizer-py/
$ pip install -e .
$ python3 -m unittest discover
License
This module is distributed under a MIT license.
See the LICENSE file.
© 2026 Cyril Dever. All rights reserved.
Metadata
Release files for es-normalizer-py 0.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| es_normalizer_py-0.2.4.tar.gz | 15.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| es_normalizer_py-0.2.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.2 kB
Release files / es_normalizer_py-0.2.4.tar.gz
| Download URL | es_normalizer_py-0.2.4.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0bf974dc5712be5c43082ea181eff7dbb93b070d6b123cc2514bc2bd6616aa00
|
|
BLAKE2b-256 checksum How to use checksums |
cb35729fdadee1a51c7f4c48cea394125a466e3fe1ff60f2389a055d6e2d397c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Release files / es_normalizer_py-0.2.4-py3-none-any.whl
| Download URL | es_normalizer_py-0.2.4-py3-none-any.whl |
|---|---|
| Size | 12.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bf92435ddd0b1273fabed5b96a326ccb917ab5bdb18b02fa7c50d47a1cdd2b08
|
|
BLAKE2b-256 checksum How to use checksums |
9b41875b02fedc15f2f6031ab1882cfa63c84a6e07152945db4c37206cd4195a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.2
|
Security for es-normalizer-py 0.2.4
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.