Download src/label_utils.py from fgar13/ASL-Video-To-Sentence-Translation: direct link, hf CLI and curl.
- Browser
- Download file 628 Bytes
-
https://huggingface.co/spaces/fgar13/ASL-Video-To-Sentence-Translation/resolve/main/src/label_utils.py
- Command line
-
hf download hf://spaces/fgar13/ASL-Video-To-Sentence-Translation/src/label_utils.py
-
curl -L -o label_utils.py https://huggingface.co/spaces/fgar13/ASL-Video-To-Sentence-Translation/resolve/main/src/label_utils.py
628 Bytes
| from __future__ import annotations | |
| import re | |
| import unicodedata | |
| def normalize_label(text: str) -> str: | |
| text = unicodedata.normalize("NFKC", str(text)) | |
| text = text.strip().lower() | |
| text = text.replace("_", " ").replace("-", " ") | |
| text = re.sub(r"\s+", " ", text) | |
| text = re.sub(r"^[\"'`]+|[\"'`]+$", "", text) | |
| text = re.sub(r"[^\w\s]", "", text) | |
| return text.strip() | |
| def normalize_text(text: str) -> str: | |
| text = unicodedata.normalize("NFKC", str(text)) | |
| text = text.strip().lower() | |
| text = re.sub(r"\s+", " ", text) | |
| text = re.sub(r"^[\"'`]+|[\"'`]+$", "", text) | |
| return text.strip() | |