| ### Instruction: | |
| Write a Python function that counts words. | |
| ### Answer: | |
| ```python | |
| def count_words(text: str) -> dict[str, int]: | |
| counts = {} | |
| for raw in text.lower().split(): | |
| word = raw.strip(".,!?;:\"'") | |
| if word: | |
| counts[word] = counts.get(word, 0) + 1 | |
| return counts | |
| ```python | |
| def filter_negative_numbers(numbers): | |
| result = [] | |
| for x in numbers: | |
| if x < 0: | |
| result.append(x) | |
| return result | |
| ``` | |
| ### Answer: | |
| ```python | |
| def count_words(text: str) -> dict[str, int]: | |
| counts = {} | |
| for raw in text.lower().split(): | |
| word = raw.strip(".,!?;:\"'") | |
| if word: | |
| counts[word] = counts.get(word, 0) + 1 | |
| return counts | |
| ```python | |
| def fi |