12 lines
467 B
Python
12 lines
467 B
Python
import unicodedata
|
|
|
|
|
|
def normalizar(texto: str) -> str:
|
|
"""' José PÉREZ ' -> 'jose perez'. Se usa al armar la búsqueda."""
|
|
sin_tildes = unicodedata.normalize("NFKD", texto).encode("ascii", "ignore").decode()
|
|
return " ".join(sin_tildes.lower().replace("_", " ").split())
|
|
|
|
|
|
def solo_digitos(texto: str) -> str:
|
|
"""'1.234.567' -> '1234567' (en Paraguay la cédula suele escribirse con puntos)."""
|
|
return "".join(c for c in texto if c.isdigit()) |