import re from collections import Counter def count_words(text: str) -> dict[str, int]: text = text.lower words = re.findall(r"[a-z0-9áäčďéíľňóôŕšťúýž]+(?:'[a-z0-9áäčďéíľňóôŕšťúýž]+)?", text) return dict(Counter(words))