Corin1998's picture
Create util_text.py
e87692d verified
raw
history blame contribute delete
177 Bytes
import re
_WS = re.compile(r"\s+")
def clean_text(x: str) -> str:
if not x:
return ""
t = x.replace("\u3000", " ").strip()
t = _WS.sub(" ", t)
return t