| ### 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 | |
| ``` | |
| ### Furcuras. | |
| ### 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 | |
| ``` | |
| ### Instruction: |