Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| import re | |
| import unicodedata | |
| def norm_term(term: str) -> str: | |
| if not term: | |
| return "" | |
| text = unicodedata.normalize("NFKC", str(term)).casefold().strip() | |
| text = text.lstrip("*") | |
| text = text.replace("β", "2").replace("β", "3").replace("β", "1").replace("β", "4") | |
| text = text.replace("hβ", "h2").replace("hβ", "h3").replace("hβ", "h1").replace("hβ", "h4") | |
| text = re.sub(r"\s+", " ", text) | |
| return text | |