I want to start with a hard-coded, rule based structure in Python, preferably using IF-ELSE to solve the following:
For example, I have this properly formatted
UK postal address:
Flat 8, The Apartment, King Philip Street, SE1 3WX
The different variations that can be derived from the above Actual address are:
These ones focuses on the first line of the address variations:
Flat 8 - Actual
8
F8
f8
flat 8
flat8
FLAT8
FLAT 8
These ones focuses on second line of the address variations:
The Apartment - Actual
Apartment,
TheApartment
theapartment
the apartment
These ones focuses on the third line of the address variations:
King Philip Street - Actual
King Philip St
King Philip st
King Philip street
King Philip STREET
king philip St
king philip st
king philip street
king philip STREET
These ones focuses on the fourth line of the address variations:
SE1 3WX - Actual
SE13WX
SE1 3WX
se1 3wx
se13wx
Hence, the Python function should be able to parse and output the above segmented results, once an address input into the function.
I have a few thousand addresses such as this to be parsed as well.
Has anyone done anything like this before, could someone please help to show me how this can be achieved ?
Aucun commentaire:
Enregistrer un commentaire