FRAPARS (France-parse-addresses)
Simple script that permits to parse addresses in France format.
Install
To install the package from pypl use the command
pip install frapars
or with Poetry:
poetry add frapars
Example of usage
The package can be used to process multiple or single addresses. Here few example.
Use this to import the library:
from frapars.functions.addresses import parse_from_address, parse_all_parallel
Then, for single usage:
address = "3 Rue Industrie (De l')"
result = parse_from_address(address)
print(result)
Obtaining
[{'raw': 'Jaures (128, Avenue Jean)', 'urba_names': ['avenue'], 'city': [], 'address_num': ['128'], 'department': [], 'street_name': ['jaures', 'jean'], 'formatted': '128 Avenue Jaures Jean'}, {'raw': 'Ferdinand Buisson (42, Rue)', 'urba_names': ['rue'], 'city': ['buisson'], 'address_num': ['42'], 'department': [], 'street_name': ['ferdinand'], 'formatted': '42 Rue Ferdinand Buisson'}]
Use the fields .raw and .formatted and .details to retrieve the specifica value that you need.
For List of addresses:
adresses_list = ["Hommelet (31, rue de l'), 59512, ROUBAIX", ' Allée Combes (Des)', " 3 Rue Industrie (De l')", ' Route Départementale 49', ' 02210 Rozet Saint Albin', ' Pont Romain, 12, Rue Du', ' Chaussée (11, Rue de la )', ' Jaures (128, Avenue Jean) et Ferdinand Buisson (42, Rue)', ' Jacquart (50, 52 Rue) ', ' Lecat (50, Rue)', ' Deguise Olivier (3, Rue) Rd360', " Lieu Dit 'L'Italie"]
parsed_addresses = parse_all_parallel(adresses_list)
for entry in result:
print(f"Raw: {entry.raw} --> Formatted: {entry.formatted}")
This will print something like:
Raw: Hommelet (31, rue de l'), 59512, ROUBAIX --> Formatted: 31 Rue De L Hommelet Roubaix 59512
Raw: Allée Combes (Des) --> Formatted: Allée Des Combes
Raw: 3 Rue Industrie (De l') --> Formatted: 3 Rue De L Industrie
Raw: Route Départementale 49 --> Formatted: 49 Route Départementale
Raw: 02210 Rozet Saint Albin --> Formatted: Rozet Saint Albin 02210
Raw: Pont Romain, 12, Rue Du --> Formatted: 12 Rue Du Pont Romain
Raw: Chaussée (11, Rue de la ) --> Formatted: 11 Rue De La Chaussée
Raw: Jaures (128, Avenue Jean) et Ferdinand Buisson (42, Rue) --> Formatted: 128 Avenue Jaures Jean et 42 Rue Ferdinand Buisson
Raw: Jacquart (50, 52 Rue) --> Formatted: 50-52 Rue Jacquart
Raw: Lecat (50, Rue) --> Formatted: 50 Rue Lecat
Raw: Deguise Olivier (3, Rue) Rd360 --> Formatted: 3 Rue Deguise Olivier
Raw: Lieu Dit 'L'Italie --> Formatted: Lieu Dit L Italie
In case you want a specific format template there is a Format() object to do so.
from frapars.helper.formatter import Formatter, AddressFields
address = "Jaures (128, Avenue Jean) 10141, France, FR"
result = parse_from_address(address, Formatter(
template=f"{AddressFields.ADDRESS_NUM.value} - {AddressFields.CITY.value} - {AddressFields.POSTCODE.value}"
))
print(result.formatted)
print('/n')
print(result)
Returning:
42 - Ferdinand - Buisson
[{'raw': 'Jaures (128, Avenue Jean)', 'urba_names': ['avenue'], 'city': [], 'address_num': ['128'], 'department': [], 'street_name': ['jaures', 'jean'], 'formatted': '128 - Jaures Jean -'}, {'raw': 'Ferdinand Buisson (42, Rue)', 'urba_names': ['rue'], 'city': ['buisson'], 'address_num': ['42'], 'department': [], 'street_name': ['ferdinand'], 'formatted': '42 - Ferdinand - Buisson'}]
To-Do List
- Write junit tests
- More example
- Update insee file - create a task that do it
Enjoy and Rate!!
Metadata
Release files for frapars 0.2.6
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 | Actions |
|---|---|---|---|---|
| frapars-0.2.6.tar.gz | 778.6 kB | Without provenance | Details for frapars-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| frapars-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for frapars-0.2.6-py3-none-any.whl |
Total release size: 1.6 MB
Release files / frapars-0.2.6.tar.gz
| Download URL | frapars-0.2.6.tar.gz |
|---|---|
| Size | 778.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
62550b5464447d9cf2bc8368cf3fb6a065f7e5c8e7f8abf4a2d1823878b25dac
|
|
BLAKE2b-256 checksum How to use checksums |
9b5fc4b9760ae6b9c8e796b71b3c2caa68934c0c10e34a1805a663b918dee8c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.5 Darwin/23.5.0
|
Release files / frapars-0.2.6-py3-none-any.whl
| Download URL | frapars-0.2.6-py3-none-any.whl |
|---|---|
| Size | 785.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
824f5a0da91d2d3632487f23862ecd912c6313eb2ebc43c112a188da202eed96
|
|
BLAKE2b-256 checksum How to use checksums |
f2be5b7967273701d357487b9e1c4901b0d717631a980c119a269d8da11662f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.5 Darwin/23.5.0
|
Security for frapars 0.2.6
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.