diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-03-15 11:40:32 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2024-03-15 14:13:05 +0100 |
commit | 3d3b3f13b33beca4909b5b3d617105a1e8b242fe (patch) | |
tree | 07321d72df65e355fcaa28e04aa8b13e3a90bc62 /archaeological_operations/utils.py | |
parent | f1fe4253fff3a50a40d3d5064cabb400285bdde9 (diff) | |
download | Ishtar-3d3b3f13b33beca4909b5b3d617105a1e8b242fe.tar.bz2 Ishtar-3d3b3f13b33beca4909b5b3d617105a1e8b242fe.zip |
✨ Parcel: free input improvment - filter special spaces and stranges commas (refs #5790)
Diffstat (limited to 'archaeological_operations/utils.py')
-rw-r--r-- | archaeological_operations/utils.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py index a571228b8..010716adb 100644 --- a/archaeological_operations/utils.py +++ b/archaeological_operations/utils.py @@ -485,6 +485,11 @@ def parse_parcels(parcel_str, insee_code=None, owner=None): if len(town) >= 2 or not town: return parcels town = town[0] + parcel_str = parcel_str.strip().replace("\ufe50", ",").replace("\uff0c", ",").replace("\n", " ") + parcel_str = re.sub(r'\s+', ' ', parcel_str) + parcel_str = parcel_str.replace("à", "_aaaa_").replace("n°", "_nnnn_") + parcel_str = parcel_str.encode("ascii", "ignore").decode("utf-8") + parcel_str = parcel_str.replace("_aaaa_", "à").replace("_nnnn_", "n°") m = PARCEL_YEAR_REGEXP.match(parcel_str) year = None if m: |