-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathutils.py
More file actions
28 lines (23 loc) · 794 Bytes
/
Copy pathutils.py
File metadata and controls
28 lines (23 loc) · 794 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
@authors:
- Alycia Leonard, University of Oxford, alycia.leonard@eng.ox.ac.uk
- Samiyha Naqvi, University of Oxford, samiyha.naqvi@eng.ox.ac.uk
A simple file used for shared functions.
Contains clean_country_name().
"""
from unidecode import unidecode
def clean_country_name(country_name):
"""
Takes in a country name and standardises to a version without spaces, full-
stops and apostrophes.
...
Parameters
----------
country_name : string
Name of country to be standardised.
"""
country_name_clean = unidecode(country_name)
country_name_clean = country_name_clean.replace(" ", "")
country_name_clean = country_name_clean.replace(".", "")
country_name_clean = country_name_clean.replace("'", "")
return country_name_clean