Normalize text: remove punctuation, whitespace, convert to lowercase.
(text: str)
| 8 | |
| 9 | |
| 10 | def normalize_text(text: str) -> str: |
| 11 | """Normalize text: remove punctuation, whitespace, convert to lowercase.""" |
| 12 | punctuation = string.punctuation + ',。!?、;:""''()【】《》·…—~-–·' |
| 13 | text = text.translate(str.maketrans('', '', punctuation)) |
| 14 | text = ''.join(text.split()) |
| 15 | return text.strip().lower() |
| 16 | |
| 17 | |
| 18 | def extract_option_letters(text: str) -> Set[str]: |