Lower text and remove punctuation, articles and extra whitespace.
(s: str)
| 16 | |
| 17 | |
| 18 | def normalize(s: str) -> str: |
| 19 | """Lower text and remove punctuation, articles and extra whitespace.""" |
| 20 | s = s.lower() |
| 21 | exclude = set(string.punctuation) |
| 22 | s = ''.join(char for char in s if char not in exclude) |
| 23 | s = re.sub(r'\b(a|an|the)\b', ' ', s) |
| 24 | s = ' '.join(s.split()) |
| 25 | return s |
| 26 | |
| 27 | |
| 28 | def fuzzy_match(s1: str, s2: str) -> bool: |
no test coverage detected