Created
June 29, 2022 20:50
-
-
Save rod-dot-codes/2cff81208800be5d869a2452c1095564 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import json | |
from_list = 'ÁÄÂÀÃÅČÇĆĎÉĚËÈÊẼĔȆÍÌÎÏŇÑÓÖÒÔÕØŘŔŠŤÚŮÜÙÛÝŸŽáäâàãåčçćďéěëèêẽĕȇíìîïňñóöòôõøðřŕšťúůüùûýÿžþÞĐđ߯a·/_,:;' | |
to_list = 'AAAAAACCCDEEEEEEEEIIIINNOOOOOORRSTUUUUUYYZaaaaaacccdeeeeeeeeiiiinnooooooorrstuuuuuyyzbBDdBAa------' | |
def remove_accents(input_string): | |
for char in from_list: | |
re.sub(char, to_list[from_list.index(char)], input_string) | |
return input_string | |
def vtex_slugify(brand_name): | |
brand_name = re.sub(r"[*+~.()'\"!:@&[\]`,/ %$#?{}|><=_^]", '-', brand_name) | |
return str.lower(remove_accents(brand_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment