Files
_Geulbeot/02. Prompts/문서생성/codedomain/엔티티_불필요한_Python_v01.py

9 lines
408 B
Python

def clean_text(text: str) -> str:
"""HTML 엔티티 및 불필요한 태그 제거"""
reps = {
' ': ' ', '‘': "'", '’': "'", '“': '"', '”': '"',
'&amp;': '&', '&lt;': '<', '&gt;': '>', '&#39;': "'", '&quot;': "'", '&middot;': "'"
}
for key, val in reps.items():
text = text.replace(key, val)
return re.sub(r'<[^>]+>', '', text).strip()